rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
diffusivity_composite_components.m
Go to the documentation of this file.
1 function [C,Cmatrix] = diffusivity_composite_components(glob, params)
2 % glob is a npoints times 2 matrix
3 %
4 % required fields of params:
5 % B1, B2: number of composite blocks
6 %
7 % generated fields of diffusivity:
8 % diffusivity: cell array of vectors with component values
9 % { c1,... c_Qc} with Qc = B1*B2
10 % and c1 = vector with values 0 or 1 of length glob
11 %
12 % sanity check: sum_i ci = ones(size(glob,1),1);
13 
14 
15 xB=params.B1;
16 yB=params.B2;
17 
18 dx=1/params.B1;
19 dy=1/params.B2;
20 
21 nob=xB*yB;
22 
23 xblocknum = ceil(glob(:,1) /dx);
24 yblocknum = ceil(glob(:,2) /dy);
25 blocknum = xblocknum+ params.B1*(yblocknum-1);
26 
27 
28 C=cell(1,nob);
29 Cmatrix=[];
30 
31 for i=1:nob
32  %c_zeros=zeros(length(glob),1);
33  c_block= blocknum == i;
34  %c_zeros(c_block)=1;
35  C{1,i}=c_block;
36  Cmatrix(:,i)=c_block;
37 end
function [ C , Cmatrix ] = diffusivity_composite_components(glob, params)
glob is a npoints times 2 matrix