Changeset 15351
- Timestamp:
- 06/27/13 15:52:44 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/gauss/GaussTria.cpp
r15298 r15351 43 43 IssmPDouble *seg_coords = NULL; 44 44 IssmPDouble *seg_weights = NULL; 45 IssmDouble a1,b1,c1,a2,b2,c2; 45 46 int i,index3; 46 47 … … 55 56 weights=xNew<IssmDouble>(numgauss); 56 57 57 /*Reverse index1 and 2 if necessary*/ 58 if (index1>index2){ 59 index3=index1; index1=index2; index2=index3; 60 for(i=0;i<numgauss;i++) seg_coords[i]=-seg_coords[i]; 58 /*Figure out coords of index1 (a1,b1,c1) and index2 (a2,b2,c2)*/ 59 if(index1==0){ 60 a1=1; b1=0; c1=0; 61 } 62 else if(index1==1){ 63 a1=0; b1=1; c1=0; 64 } 65 else if(index1==2){ 66 a1=0; b1=0; c1=1; 67 } 68 else{ 69 _error_("First indice provided is not supported yet (user provided " << index1 << ")"); 70 } 71 if(index2==0){ 72 a2=1; b2=0; c2=0; 73 } 74 else if(index2==1){ 75 a2=0; b2=1; c2=0; 76 } 77 else if(index2==2){ 78 a2=0; b2=0; c2=1; 79 } 80 else{ 81 _error_("Second indice provided is not supported yet (user provided " << index2 << " )"); 61 82 } 62 83 63 84 /*Build Triangle Gauss point*/ 64 if (index1==0 && index2==1){ 65 for(i=0;i<numgauss;i++) coords1[i]= 0.5*(1-seg_coords[i]); 66 for(i=0;i<numgauss;i++) coords2[i]=1-0.5*(1.-seg_coords[i]); 67 for(i=0;i<numgauss;i++) coords3[i]=0; 68 for(i=0;i<numgauss;i++) weights[i]=seg_weights[i]; 69 } 70 else if (index1==0 && index2==2){ 71 for(i=0;i<numgauss;i++) coords1[i]= 0.5*(1-seg_coords[i]); 72 for(i=0;i<numgauss;i++) coords2[i]= 0 ; 73 for(i=0;i<numgauss;i++) coords3[i]=1-0.5*(1.-seg_coords[i]); 74 for(i=0;i<numgauss;i++) weights[i]=seg_weights[i]; 75 } 76 else if (index1==1 && index2==2){ 77 for(i=0;i<numgauss;i++) coords1[i]=0; 78 for(i=0;i<numgauss;i++) coords2[i]= 0.5*(1-seg_coords[i]); 79 for(i=0;i<numgauss;i++) coords3[i]=1-0.5*(1.-seg_coords[i]); 80 for(i=0;i<numgauss;i++) weights[i]=seg_weights[i]; 81 } 82 else 83 _error_("The 2 indices provided are not supported yet (user provided " << index1 << " and " << index2 << ")"); 85 for(i=0;i<numgauss;i++){ 86 coords1[i]=0.5*(a1+a2) + 0.5*seg_coords[i]*(a2-a1); 87 coords2[i]=0.5*(b1+b2) + 0.5*seg_coords[i]*(b2-b1); 88 coords3[i]=0.5*(c1+c2) + 0.5*seg_coords[i]*(c2-c1); 89 weights[i]=seg_weights[i]; 90 } 84 91 85 92 /*Initialize static fields as undefined*/
Note:
See TracChangeset
for help on using the changeset viewer.