Changeset 1236 for issm/trunk/src/m/classes/public/mesh/meshadaptation.m
- Timestamp:
- 07/06/09 11:12:27 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/mesh/meshadaptation.m
r1214 r1236 22 22 disp(sprintf(' metric computation') ) 23 23 24 %load some variables (it is much faster if the variab;es are loaded from md once for all) 24 %initialization 25 index=md.elements; 26 numberofgrids=md.numberofgrids; 25 27 numberofelements=md.numberofelements; 26 numberofgrids=md.numberofgrids; 27 index=md.elements; 28 x=md.x; y=md.y; z=md.z; 29 30 %initialization 31 alpha=zeros(md.numberofelements,3); 32 beta=zeros(md.numberofelements,3); 33 gradx=zeros(md.numberofgrids,1); 34 grady=zeros(md.numberofgrids,1); 35 metric=zeros(md.numberofelements,1); 28 gradx=zeros(numberofgrids,1); 29 grady=zeros(numberofgrids,1); 30 metric=zeros(numberofelements,1); 36 31 37 32 %build some usefull variables … … 40 35 summation=1/3*ones(3,1); 41 36 linesize=3*numberofelements; 42 x1=x(index(:,1)); x2=x(index(:,2)); x3=x(index(:,3)); y1=y(index(:,1)); y2=y(index(:,2)); y3=y(index(:,3));43 37 44 %compute nodal functions coefficients N(x,y)=alpha x + beta y + gamma 45 invdet=1./(x1.*(y2-y3)-x2.*(y1-y3)+x3.*(y1-y2)); 46 alpha=[invdet.*(y2-y3) invdet.*(y3-y1) invdet.*(y1-y2)]; 47 beta=[invdet.*(x3-x2) invdet.*(x1-x3) invdet.*(x2-x1)]; 38 %get areas and nodal functions coefficients N(x,y)=alpha x + beta y + gamma 39 [alpha beta]=GetNodalFunctionsCoeff(index,md.x,md.y); 40 areas=Getareas(index,md.x,md.y); 48 41 49 42 %Compute gradient for each element 50 43 grad_elx=sum(field(index).*alpha,2); 51 44 grad_ely=sum(field(index).*beta,2); 52 53 %compute the volume of each element54 areas=area(md);55 45 56 46 %update weights that holds the volume of all the element holding the grid i
Note:
See TracChangeset
for help on using the changeset viewer.