Changeset 18923 for issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp
- Timestamp:
- 12/03/14 21:11:19 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp
r18521 r18923 104 104 /*}}}*/ 105 105 106 int Tetra::FiniteElement(void){/*{{{*/107 return this->element_type;108 } /*}}}*/109 int Tetra::ObjectEnum(void){/*{{{*/110 111 return TetraEnum;112 113 }/*}}}*/114 106 void Tetra::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){/*{{{*/ 115 107 … … 196 188 } 197 189 /*}}}*/ 190 void Tetra::FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3){/*{{{*/ 191 192 IssmDouble values[NUMVERTICES]; 193 int indices[4][3] = {{0,1,2},{0,3,1},{1,3,2},{0,2,3}}; 194 195 /*Retrieve all inputs and parameters*/ 196 GetInputListOnVertices(&values[0],MaskIceLevelsetEnum); 197 198 for(int i=0;i<4;i++){ 199 if(values[indices[i][0]] == 0. && values[indices[i][1]] == 0. && values[indices[i][2]] == 0.){ 200 *pindex1 = indices[i][0]; 201 *pindex2 = indices[i][1]; 202 *pindex3 = indices[i][2]; 203 return; 204 } 205 } 206 207 _error_("Could not find 3 vertices on bed"); 208 } 209 /*}}}*/ 198 210 void Tetra::FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3){/*{{{*/ 199 211 … … 216 228 } 217 229 /*}}}*/ 218 void Tetra::FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3){/*{{{*/ 219 220 IssmDouble values[NUMVERTICES]; 221 int indices[4][3] = {{0,1,2},{0,3,1},{1,3,2},{0,2,3}}; 222 223 /*Retrieve all inputs and parameters*/ 224 GetInputListOnVertices(&values[0],MaskIceLevelsetEnum); 225 226 for(int i=0;i<4;i++){ 227 if(values[indices[i][0]] == 0. && values[indices[i][1]] == 0. && values[indices[i][2]] == 0.){ 228 *pindex1 = indices[i][0]; 229 *pindex2 = indices[i][1]; 230 *pindex3 = indices[i][2]; 231 return; 232 } 233 } 234 235 _error_("Could not find 3 vertices on bed"); 236 } 237 /*}}}*/ 230 int Tetra::FiniteElement(void){/*{{{*/ 231 return this->element_type; 232 } /*}}}*/ 238 233 int Tetra::GetElementType(){/*{{{*/ 239 234 … … 475 470 } 476 471 /*}}}*/ 477 bool Tetra::IsOnBase(){/*{{{*/478 return HasFaceOnBase();479 }480 /*}}}*/481 bool Tetra::IsOnSurface(){/*{{{*/482 return HasFaceOnSurface();483 }484 /*}}}*/485 472 bool Tetra::IsIcefront(void){/*{{{*/ 486 473 … … 497 484 return false; 498 485 }/*}}}*/ 486 bool Tetra::IsOnBase(){/*{{{*/ 487 return HasFaceOnBase(); 488 } 489 /*}}}*/ 490 bool Tetra::IsOnSurface(){/*{{{*/ 491 return HasFaceOnSurface(); 492 } 493 /*}}}*/ 499 494 void Tetra::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 500 495 … … 504 499 } 505 500 /*}}}*/ 501 void Tetra::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){/*{{{*/ 502 503 _assert_(gauss->Enum()==GaussTetraEnum); 504 this->GetJacobianDeterminantFace(pJdet,xyz_list_base,(GaussTetra*)gauss); 505 506 } 507 /*}}}*/ 506 508 void Tetra::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 507 509 508 510 _assert_(gauss->Enum()==GaussTetraEnum); 509 511 this->GetJacobianDeterminantFace(pJdet,xyz_list,(GaussTetra*)gauss); 510 511 }512 /*}}}*/513 void Tetra::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){/*{{{*/514 515 _assert_(gauss->Enum()==GaussTetraEnum);516 this->GetJacobianDeterminantFace(pJdet,xyz_list_base,(GaussTetra*)gauss);517 512 518 513 } … … 561 556 } 562 557 /*}}}*/ 558 void Tetra::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 559 560 _assert_(gauss->Enum()==GaussTetraEnum); 561 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss,this->element_type); 562 563 } 564 /*}}}*/ 565 void Tetra::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 566 567 _assert_(gauss->Enum()==GaussTetraEnum); 568 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss,this->VelocityInterpolation()); 569 570 } 571 /*}}}*/ 572 void Tetra::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){/*{{{*/ 573 574 _assert_(gauss->Enum()==GaussTetraEnum); 575 this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->PressureInterpolation()); 576 577 } 578 /*}}}*/ 579 void Tetra::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){/*{{{*/ 580 581 _assert_(gauss->Enum()==GaussTetraEnum); 582 this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->TensorInterpolation()); 583 584 } 585 /*}}}*/ 563 586 void Tetra::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){/*{{{*/ 564 587 … … 568 591 } 569 592 /*}}}*/ 570 void Tetra::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){/*{{{*/ 571 572 _assert_(gauss->Enum()==GaussTetraEnum); 573 this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->PressureInterpolation()); 574 575 } 576 /*}}}*/ 577 void Tetra::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){/*{{{*/ 578 579 _assert_(gauss->Enum()==GaussTetraEnum); 580 this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->TensorInterpolation()); 581 582 } 583 /*}}}*/ 584 void Tetra::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 585 586 _assert_(gauss->Enum()==GaussTetraEnum); 587 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss,this->element_type); 588 589 } 590 /*}}}*/ 591 void Tetra::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 592 593 _assert_(gauss->Enum()==GaussTetraEnum); 594 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss,this->VelocityInterpolation()); 595 593 void Tetra::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){/*{{{*/ 594 595 IssmDouble v13[3],v23[3]; 596 IssmDouble normal[3]; 597 IssmDouble normal_norm; 598 599 for(int i=0;i<3;i++){ 600 v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i]; 601 v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i]; 602 } 603 604 normal[0]=v13[1]*v23[2]-v13[2]*v23[1]; 605 normal[1]=v13[2]*v23[0]-v13[0]*v23[2]; 606 normal[2]=v13[0]*v23[1]-v13[1]*v23[0]; 607 normal_norm=sqrt(normal[0]*normal[0]+ normal[1]*normal[1]+ normal[2]*normal[2]); 608 609 /*Bed normal is opposite to surface normal*/ 610 bed_normal[0]=-normal[0]/normal_norm; 611 bed_normal[1]=-normal[1]/normal_norm; 612 bed_normal[2]=-normal[2]/normal_norm; 613 614 _assert_(bed_normal[2]<0.); 596 615 } 597 616 /*}}}*/ … … 616 635 } 617 636 /*}}}*/ 618 void Tetra::Normal Base(IssmDouble* bed_normal,IssmDouble* xyz_list){/*{{{*/637 void Tetra::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){/*{{{*/ 619 638 620 639 IssmDouble v13[3],v23[3]; … … 632 651 normal_norm=sqrt(normal[0]*normal[0]+ normal[1]*normal[1]+ normal[2]*normal[2]); 633 652 634 /*Bed normal is opposite to surface normal*/635 bed_normal[0]=-normal[0]/normal_norm;636 bed_normal[1]=-normal[1]/normal_norm;637 bed_normal[2]=-normal[2]/normal_norm;638 639 _assert_(bed_normal[2]<0.);640 }641 /*}}}*/642 void Tetra::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){/*{{{*/643 644 IssmDouble v13[3],v23[3];645 IssmDouble normal[3];646 IssmDouble normal_norm;647 648 for(int i=0;i<3;i++){649 v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];650 v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];651 }652 653 normal[0]=v13[1]*v23[2]-v13[2]*v23[1];654 normal[1]=v13[2]*v23[0]-v13[0]*v23[2];655 normal[2]=v13[0]*v23[1]-v13[1]*v23[0];656 normal_norm=sqrt(normal[0]*normal[0]+ normal[1]*normal[1]+ normal[2]*normal[2]);657 658 653 top_normal[0]=normal[0]/normal_norm; 659 654 top_normal[1]=normal[1]/normal_norm; … … 668 663 int Tetra::NumberofNodesVelocity(void){/*{{{*/ 669 664 return TetraRef::NumberofNodes(this->VelocityInterpolation()); 665 } 666 /*}}}*/ 667 int Tetra::ObjectEnum(void){/*{{{*/ 668 669 return TetraEnum; 670 671 }/*}}}*/ 672 int Tetra::PressureInterpolation(void){/*{{{*/ 673 return TetraRef::PressureInterpolation(this->element_type); 670 674 } 671 675 /*}}}*/ … … 764 768 } 765 769 /*}}}*/ 766 void Tetra::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){/*{{{*/767 768 /*go into parameters and get the analysis_counter: */769 int analysis_counter;770 parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);771 772 /*Get Element type*/773 this->element_type=this->element_type_list[analysis_counter];774 775 /*Pick up nodes*/776 if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();777 else this->nodes=NULL;778 779 }780 /*}}}*/781 770 void Tetra::ResetHooks(){/*{{{*/ 782 771 … … 793 782 this->hmatpar->reset(); 794 783 if(this->hneighbors) this->hneighbors->reset(); 784 } 785 /*}}}*/ 786 void Tetra::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){/*{{{*/ 787 788 /*go into parameters and get the analysis_counter: */ 789 int analysis_counter; 790 parametersin->FindParam(&analysis_counter,AnalysisCounterEnum); 791 792 /*Get Element type*/ 793 this->element_type=this->element_type_list[analysis_counter]; 794 795 /*Pick up nodes*/ 796 if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp(); 797 else this->nodes=NULL; 798 795 799 } 796 800 /*}}}*/ … … 836 840 /*Return new Tria*/ 837 841 return tria; 842 } 843 /*}}}*/ 844 int Tetra::TensorInterpolation(void){/*{{{*/ 845 return TetraRef::TensorInterpolation(this->element_type); 838 846 } 839 847 /*}}}*/ … … 981 989 } 982 990 /*}}}*/ 983 int Tetra::PressureInterpolation(void){/*{{{*/984 return TetraRef::PressureInterpolation(this->element_type);985 }986 /*}}}*/987 int Tetra::TensorInterpolation(void){/*{{{*/988 return TetraRef::TensorInterpolation(this->element_type);989 }990 /*}}}*/991 991 void Tetra::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){/*{{{*/ 992 992 /*Compute portion of the element that is grounded*/
Note:
See TracChangeset
for help on using the changeset viewer.