Ignore:
Timestamp:
12/03/14 21:11:19 (10 years ago)
Author:
seroussi
Message:

CHG: reorder Tetra

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp

    r18521 r18923  
    104104/*}}}*/
    105105
    106 int      Tetra::FiniteElement(void){/*{{{*/
    107         return this->element_type;
    108 } /*}}}*/
    109 int      Tetra::ObjectEnum(void){/*{{{*/
    110 
    111         return TetraEnum;
    112 
    113 }/*}}}*/
    114106void     Tetra::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){/*{{{*/
    115107
     
    196188}
    197189/*}}}*/
     190void     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/*}}}*/
    198210void     Tetra::FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3){/*{{{*/
    199211
     
    216228}
    217229/*}}}*/
    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 /*}}}*/
     230int      Tetra::FiniteElement(void){/*{{{*/
     231        return this->element_type;
     232} /*}}}*/
    238233int      Tetra::GetElementType(){/*{{{*/
    239234
     
    475470}
    476471/*}}}*/
    477 bool     Tetra::IsOnBase(){/*{{{*/
    478         return HasFaceOnBase();
    479 }
    480 /*}}}*/
    481 bool     Tetra::IsOnSurface(){/*{{{*/
    482         return HasFaceOnSurface();
    483 }
    484 /*}}}*/
    485472bool     Tetra::IsIcefront(void){/*{{{*/
    486473
     
    497484        return false;
    498485}/*}}}*/
     486bool     Tetra::IsOnBase(){/*{{{*/
     487        return HasFaceOnBase();
     488}
     489/*}}}*/
     490bool     Tetra::IsOnSurface(){/*{{{*/
     491        return HasFaceOnSurface();
     492}
     493/*}}}*/
    499494void     Tetra::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    500495
     
    504499}
    505500/*}}}*/
     501void     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/*}}}*/
    506508void     Tetra::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    507509
    508510        _assert_(gauss->Enum()==GaussTetraEnum);
    509511        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);
    517512
    518513}
     
    561556}
    562557/*}}}*/
     558void     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/*}}}*/
     565void     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/*}}}*/
     572void     Tetra::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){/*{{{*/
     573
     574        _assert_(gauss->Enum()==GaussTetraEnum);
     575        this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->PressureInterpolation());
     576
     577}
     578/*}}}*/
     579void     Tetra::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){/*{{{*/
     580
     581        _assert_(gauss->Enum()==GaussTetraEnum);
     582        this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->TensorInterpolation());
     583
     584}
     585/*}}}*/
    563586void     Tetra::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){/*{{{*/
    564587
     
    568591}
    569592/*}}}*/
    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 
     593void     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.);
    596615}
    597616/*}}}*/
     
    616635}
    617636/*}}}*/
    618 void     Tetra::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){/*{{{*/
     637void     Tetra::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){/*{{{*/
    619638
    620639        IssmDouble v13[3],v23[3];
     
    632651        normal_norm=sqrt(normal[0]*normal[0]+ normal[1]*normal[1]+ normal[2]*normal[2]);
    633652
    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 
    658653        top_normal[0]=normal[0]/normal_norm;
    659654        top_normal[1]=normal[1]/normal_norm;
     
    668663int      Tetra::NumberofNodesVelocity(void){/*{{{*/
    669664        return TetraRef::NumberofNodes(this->VelocityInterpolation());
     665}
     666/*}}}*/
     667int      Tetra::ObjectEnum(void){/*{{{*/
     668
     669        return TetraEnum;
     670
     671}/*}}}*/
     672int      Tetra::PressureInterpolation(void){/*{{{*/
     673        return TetraRef::PressureInterpolation(this->element_type);
    670674}
    671675/*}}}*/
     
    764768}
    765769/*}}}*/
    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 /*}}}*/
    781770void     Tetra::ResetHooks(){/*{{{*/
    782771
     
    793782        this->hmatpar->reset();
    794783        if(this->hneighbors) this->hneighbors->reset();
     784}
     785/*}}}*/
     786void     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
    795799}
    796800/*}}}*/
     
    836840        /*Return new Tria*/
    837841        return tria;
     842}
     843/*}}}*/
     844int      Tetra::TensorInterpolation(void){/*{{{*/
     845        return TetraRef::TensorInterpolation(this->element_type);
    838846}
    839847/*}}}*/
     
    981989}
    982990/*}}}*/
    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 /*}}}*/
    991991void     Tetra::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){/*{{{*/
    992992        /*Compute portion of the element that is grounded*/
Note: See TracChangeset for help on using the changeset viewer.