Changeset 5734
- Timestamp:
- 09/09/10 16:13:22 (15 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Tria.cpp
r5731 r5734 1333 1333 double mass_flux=0; 1334 1334 double xyz_list[NUMVERTICES][3]; 1335 double gauss_1[3];1336 double gauss_2[3];1335 GaussTria* gauss_1=NULL; 1336 GaussTria* gauss_2=NULL; 1337 1337 double normal[2]; 1338 1338 double length; … … 1355 1355 1356 1356 /*get area coordinates of 0 and 1 locations: */ 1357 for(i=0;i<3;i++){1358 gauss_1[i]=this->GetAreaCoordinate(x1,y1,i+1);1359 gauss_2[i]=this->GetAreaCoordinate(x2,y2,i+1);1360 }1357 gauss_1=new GaussTria(); 1358 gauss_1->GaussFromCoords(x1,y1,&xyz_list[0][0]); 1359 gauss_2=new GaussTria(); 1360 gauss_2->GaussFromCoords(x2,y2,&xyz_list[0][0]); 1361 1361 1362 1362 /*get normal of segment: */ … … 1368 1368 1369 1369 /*get thickness and velocity at two segment extremities: */ 1370 inputs->GetParameterValue(&h1, &gauss_1[0],ThicknessEnum);1371 inputs->GetParameterValue(&h2, &gauss_2[0],ThicknessEnum);1372 inputs->GetParameterValue(&vx1, &gauss_1[0],VxEnum);1373 inputs->GetParameterValue(&vx2, &gauss_2[0],VxEnum);1374 inputs->GetParameterValue(&vy1, &gauss_1[0],VyEnum);1375 inputs->GetParameterValue(&vy2, &gauss_2[0],VyEnum);1370 inputs->GetParameterValue(&h1, gauss_1,ThicknessEnum); 1371 inputs->GetParameterValue(&h2, gauss_2,ThicknessEnum); 1372 inputs->GetParameterValue(&vx1,gauss_1,VxEnum); 1373 inputs->GetParameterValue(&vx2,gauss_2,VxEnum); 1374 inputs->GetParameterValue(&vy1,gauss_1,VyEnum); 1375 inputs->GetParameterValue(&vy2,gauss_2,VyEnum); 1376 1376 1377 1377 mass_flux= rho_ice*length*( … … 1382 1382 /*Process units: */ 1383 1383 mass_flux=UnitConversion(mass_flux,IuToExtEnum,MassFluxEnum,this->parameters); 1384 1385 /*clean up*/ 1386 delete gauss_1; 1387 delete gauss_2; 1384 1388 1385 1389 return mass_flux; … … 5416 5420 } 5417 5421 /*}}}*/ 5418 /*FUNCTION Tria::GetAreaCoordinate {{{1*/5419 double Tria::GetAreaCoordinate(double x, double y, int which_one){5420 5421 /*Intermediaries*/5422 double area = 0;5423 double xyz_list[NUMVERTICES][3];5424 double x1,y1,x2,y2,x3,y3;5425 5426 /*Get area: */5427 area=this->GetArea();5428 5429 /*Get xyz list: */5430 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);5431 x1=xyz_list[0][0]; y1=xyz_list[0][1];5432 x2=xyz_list[1][0]; y2=xyz_list[1][1];5433 x3=xyz_list[2][0]; y3=xyz_list[2][1];5434 5435 switch(which_one){5436 case 1:5437 /*Get first area coordinate = det(x-x3 x2-x3 ; y-y3 y2-y3)/area*/5438 return ((x-x3)*(y2-y3)-(x2-x3)*(y-y3))/area;5439 case 2:5440 /*Get second area coordinate = det(x1-x3 x-x3 ; y1-y3 y-y3)/area*/5441 return ((x1-x3)*(y-y3)-(x-x3)*(y1-y3))/area;5442 case 3:5443 /*Get third area coordinate 1-area1-area2: */5444 return 1-((x-x3)*(y2-y3)-(x2-x3)*(y-y3))/area -((x1-x3)*(y-y3)-(x-x3)*(y1-y3))/area;5445 default:5446 ISSMERROR("%s%i%s\n"," error message: area coordinate ",which_one," done not exist!");5447 }5448 }5449 /*}}}*/5450 5422 /*FUNCTION Tria::GetElementType {{{1*/ 5451 5423 int Tria::GetElementType(){ -
issm/trunk/src/c/objects/Elements/Tria.h
r5719 r5734 147 147 void CreatePVectorThermalSheet( Vec pg); 148 148 void CreatePVectorThermalShelf( Vec pg); 149 double GetArea(void); 150 double GetAreaCoordinate(double x, double y, int which_one); 151 int GetElementType(void); 149 double GetArea(void); 150 int GetElementType(void); 152 151 void GetDofList(int** pdoflist,int approximation_enum=0); 153 152 void GetDofList1(int* doflist); -
issm/trunk/src/c/objects/Gauss/GaussTria.cpp
r5719 r5734 164 164 coord2=coords2[ig]; 165 165 coord3=coords3[ig]; 166 167 } 168 /*}}}*/ 169 /*FUNCTION GaussTria::GaussFromCoords{{{1*/ 170 void GaussTria::GaussFromCoords(double x,double y,double* xyz_list){ 171 172 /*Intermediaries*/ 173 double area = 0; 174 double x1,y1,x2,y2,x3,y3; 175 176 /*in debugging mode: check that the default constructor has been called*/ 177 ISSMASSERT(numgauss==-1); 178 179 x1=*(xyz_list+3*0+0); y1=*(xyz_list+3*0+1); 180 x2=*(xyz_list+3*1+0); y2=*(xyz_list+3*1+1); 181 x3=*(xyz_list+3*2+0); y3=*(xyz_list+3*2+1); 182 183 area=(x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1)/2; 184 185 /*Get first area coordinate = det(x-x3 x2-x3 ; y-y3 y2-y3)/area*/ 186 coord1=((x-x3)*(y2-y3)-(x2-x3)*(y-y3))/area; 187 188 /*Get second area coordinate = det(x1-x3 x-x3 ; y1-y3 y-y3)/area*/ 189 coord2=((x1-x3)*(y-y3)-(x-x3)*(y1-y3))/area; 190 191 /*Get third area coordinate 1-area1-area2: */ 192 coord3=1-coord1-coord2; 166 193 167 194 } -
issm/trunk/src/c/objects/Gauss/GaussTria.h
r5719 r5734 38 38 int end(void); 39 39 void Echo(void); 40 void GaussFromCoords(double x1,double y1,double* xyz_list); 40 41 void GaussPoint(int ig); 41 42 void GaussVertex(int iv);
Note:
See TracChangeset
for help on using the changeset viewer.