Changeset 17472


Ignore:
Timestamp:
03/18/14 22:44:50 (11 years ago)
Author:
Mathieu Morlighem
Message:

NEW: working on Tetra elements

Location:
issm/trunk-jpl/src/c
Files:
2 added
24 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Makefile.am

    r17457 r17472  
    446446                                        ./classes/Inputs/PentaInput.h\
    447447                                        ./classes/Inputs/PentaInput.cpp\
     448                                        ./classes/Inputs/TetraInput.h\
     449                                        ./classes/Inputs/TetraInput.cpp\
    448450                                        #}}}
    449451#DAKOTA sources  {{{
  • issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp

    r17463 r17472  
    2020                         switch(meshtype){
    2121                                 case Mesh3DEnum:           numdofs=2; break;
     22                                 case Mesh3DtetrasEnum:     numdofs=2; break;
    2223                                 case Mesh2DhorizontalEnum: numdofs=2; break;
    2324                                 case Mesh2DverticalEnum:   numdofs=1; break;
     
    2930                         switch(meshtype){
    3031                                 case Mesh3DEnum:         numdofs=2; break;
     32                                 case Mesh3DtetrasEnum:   numdofs=2; break;
    3133                                 case Mesh2DverticalEnum: numdofs=1; break;
    3234                                 default: _error_("mesh type not supported yet");
     
    3739                         switch(meshtype){
    3840                                 case Mesh3DEnum:         numdofs=3; break;
     41                                 case Mesh3DtetrasEnum:   numdofs=3; break;
    3942                                 case Mesh2DverticalEnum: numdofs=2; break;
    4043                                 default: _error_("mesh type not supported yet");
     
    4548                         switch(meshtype){
    4649                                 case Mesh3DEnum:         numdofs=4; break;
     50                                 case Mesh3DtetrasEnum:   numdofs=4; break;
    4751                                 case Mesh2DverticalEnum: numdofs=3; break;
    4852                                 default: _error_("mesh type not supported yet");
     
    215219                if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
    216220        }
     221        if(iomodel->meshtype==Mesh3DtetrasEnum){
     222                iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
     223                iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
     224                iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
     225                iomodel->FetchDataToInput(elements,LoadingforceZEnum);
     226                iomodel->FetchDataToInput(elements,VzEnum,0.);
     227                if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
     228        }
    217229        if(iomodel->meshtype==Mesh2DverticalEnum){
    218               iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
     230                iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
    219231        }
    220232        if(isFS){
     
    963975                case Mesh2DverticalEnum:   dim = 2; dofpernode = 1; break;
    964976                case Mesh3DEnum:           dim = 3; dofpernode = 2; break;
     977                case Mesh3DtetrasEnum:     dim = 3; dofpernode = 2; break;
    965978                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    966979        }
     
    11801193                case Mesh2DhorizontalEnum: dim = 2;break;
    11811194                case Mesh3DEnum:           dim = 2;break;
     1195                case Mesh3DtetrasEnum:     dim = 2;break;
    11821196                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    11831197        }
     
    12651279                case Mesh2DhorizontalEnum: dim = 2; bsize = 3; break;
    12661280                case Mesh3DEnum:           dim = 2; bsize = 3; break;
     1281                case Mesh3DtetrasEnum:     dim = 2; bsize = 3; break;
    12671282                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    12681283        }
     
    13771392                case Mesh2DhorizontalEnum: dim = 2;break;
    13781393                case Mesh3DEnum:           dim = 2;break;
     1394                case Mesh3DtetrasEnum:     dim = 2;break;
    13791395                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    13801396        }
     
    14421458                case Mesh2DhorizontalEnum: dim = 2;break;
    14431459                case Mesh3DEnum:           dim = 2;break;
     1460                case Mesh3DtetrasEnum:     dim = 2;break;
    14441461                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    14451462        }
     
    21402157                case Mesh2DverticalEnum: dim = 2; bsize = 2; break;
    21412158                case Mesh3DEnum:         dim = 3; bsize = 5; break;
     2159                case Mesh3DtetrasEnum:   dim = 3; bsize = 5; break;
    21422160                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    21432161        }
     
    22192237                case Mesh2DverticalEnum: dim = 2; break;
    22202238                case Mesh3DEnum:         dim = 3; break;
     2239                case Mesh3DtetrasEnum:   dim = 3; break;
    22212240                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    22222241        }
     
    23042323                case Mesh2DverticalEnum: dim = 2; break;
    23052324                case Mesh3DEnum:         dim = 3; break;
     2325                case Mesh3DtetrasEnum:   dim = 3; break;
    23062326                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    23072327        }
     
    23802400                case Mesh2DverticalEnum: dim = 2; break;
    23812401                case Mesh3DEnum:         dim = 3; break;
     2402                case Mesh3DtetrasEnum:   dim = 3; break;
    23822403                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    23832404        }
     
    24412462                case Mesh2DverticalEnum: dim = 2; break;
    24422463                case Mesh3DEnum:         dim = 3; break;
     2464                case Mesh3DtetrasEnum:   dim = 3; break;
    24432465                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    24442466        }
     
    26392661                case Mesh2DverticalEnum: dim = 2; break;
    26402662                case Mesh3DEnum:         dim = 3; break;
     2663                case Mesh3DtetrasEnum:   dim = 3; break;
    26412664                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    26422665        }
     
    27262749                case Mesh2DverticalEnum: dim = 2; break;
    27272750                case Mesh3DEnum:         dim = 3; break;
     2751                case Mesh3DtetrasEnum:   dim = 3; break;
    27282752                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    27292753        }
     
    28572881                case Mesh2DverticalEnum: dim = 2; epssize = 3; break;
    28582882                case Mesh3DEnum:         dim = 3; epssize = 6; break;
     2883                case Mesh3DtetrasEnum:   dim = 3; epssize = 6; break;
    28592884                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    28602885        }
     
    29402965                case Mesh2DverticalEnum: dim = 2;break;
    29412966                case Mesh3DEnum:         dim = 3;break;
     2967                case Mesh3DtetrasEnum:   dim = 3;break;
    29422968                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    29432969        }
     
    30343060                case Mesh2DverticalEnum: dim = 2;break;
    30353061                case Mesh3DEnum:         dim = 3;break;
     3062                case Mesh3DtetrasEnum:   dim = 3;break;
    30363063                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    30373064        }
     
    30923119        element->FindParam(&meshtype,MeshTypeEnum);
    30933120        switch(meshtype){
     3121                case Mesh2DverticalEnum: dim = 2; break;
    30943122                case Mesh3DEnum:         dim = 3; break;
    3095                 case Mesh2DverticalEnum: dim = 2; break;
     3123                case Mesh3DtetrasEnum:   dim = 3; break;
    30963124                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    30973125        }
     
    31763204                case Mesh2DverticalEnum: dim = 2; break;
    31773205                case Mesh3DEnum:         dim = 3; break;
     3206                case Mesh3DtetrasEnum:   dim = 3; break;
    31783207                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    31793208        }
     
    32543283                case Mesh2DverticalEnum: dim = 2; break;
    32553284                case Mesh3DEnum:         dim = 3; break;
     3285                case Mesh3DtetrasEnum:   dim = 3; break;
    32563286                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    32573287        }
     
    33303360                case Mesh2DverticalEnum: dim = 2; break;
    33313361                case Mesh3DEnum:         dim = 3; break;
     3362                case Mesh3DtetrasEnum:   dim = 3; break;
    33323363                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    33333364        }
     
    36823713                case Mesh2DverticalEnum: dim = 2; break;
    36833714                case Mesh3DEnum:         dim = 3; break;
     3715                case Mesh3DtetrasEnum:   dim = 3; break;
    36843716                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    36853717        }
     
    37493781                case Mesh2DverticalEnum: dim = 2; break;
    37503782                case Mesh3DEnum:         dim = 3; break;
     3783                case Mesh3DtetrasEnum:   dim = 3; break;
    37513784                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    37523785        }
  • issm/trunk-jpl/src/c/classes/Elements/Element.cpp

    r17394 r17472  
    429429
    430430}/*}}}*/
     431void Element::GetNodesSidList(int* sidlist){/*{{{*/
     432
     433        _assert_(sidlist);
     434        _assert_(nodes);
     435        int numnodes = this->GetNumberOfNodes();
     436        for(int i=0;i<numnodes;i++){
     437                sidlist[i]=nodes[i]->Sid();
     438        }
     439}
     440/*}}}*/
     441void Element::GetNodesLidList(int* lidlist){/*{{{*/
     442
     443        _assert_(lidlist);
     444        _assert_(nodes);
     445        int numnodes = this->GetNumberOfNodes();
     446        for(int i=0;i<numnodes;i++){
     447                lidlist[i]=nodes[i]->Lid();
     448        }
     449}
     450/*}}}*/
     451void Element::GetVerticesCoordinates(IssmDouble** pxyz_list){/*{{{*/
     452
     453        int         numvertices = this->GetNumberOfVertices();
     454        IssmDouble* xyz_list    = xNew<IssmDouble>(numvertices*3);
     455        ::GetVerticesCoordinates(xyz_list,this->vertices,numvertices);
     456
     457        *pxyz_list = xyz_list;
     458
     459}/*}}}*/
    431460void Element::GetVerticesSidList(int* sidlist){/*{{{*/
    432461
     
    439468        int numvertices = this->GetNumberOfVertices();
    440469        for(int i=0;i<numvertices;i++) connectivity[i]=this->vertices[i]->Connectivity();
     470}
     471/*}}}*/
     472void Element::InputChangeName(int original_enum,int new_enum){/*{{{*/
     473        this->inputs->ChangeEnum(original_enum,new_enum);
     474}
     475/*}}}*/
     476void Element::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){/*{{{*/
     477
     478        /*Intermediaries*/
     479        int        i,t,row;
     480        IssmDouble time;
     481
     482        /*Branch on type of vector: nodal or elementary: */
     483        if(vector_type==1){ //nodal vector
     484
     485                int         numvertices = this->GetNumberOfVertices();
     486                int        *vertexids   = xNew<int>(numvertices);
     487                IssmDouble *values      = xNew<IssmDouble>(numvertices);
     488
     489                /*Recover vertices ids needed to initialize inputs*/
     490                _assert_(iomodel->elements);
     491                for(i=0;i<numvertices;i++){
     492                        vertexids[i]=reCast<int>(iomodel->elements[numvertices*this->Sid()+i]); //ids for vertices are in the elements array from Matlab
     493                }
     494
     495                /*Are we in transient or static? */
     496                if(M==iomodel->numberofvertices){
     497                        for(i=0;i<numvertices;i++) values[i]=vector[vertexids[i]-1];
     498                        this->AddInput(vector_enum,values,P1Enum);
     499                }
     500                else if(M==iomodel->numberofvertices+1){
     501                        /*create transient input: */
     502                        IssmDouble* times = xNew<IssmDouble>(N);
     503                        for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
     504                        TransientInput* transientinput=new TransientInput(vector_enum,times,N);
     505                        for(t=0;t<N;t++){
     506                                for(i=0;i<numvertices;i++) values[i]=vector[N*(vertexids[i]-1)+t];
     507                                switch(this->ObjectEnum()){
     508                                        case TriaEnum:  transientinput->AddTimeInput(new TriaInput( vector_enum,values,P1Enum)); break;
     509                                        case PentaEnum: transientinput->AddTimeInput(new PentaInput(vector_enum,values,P1Enum)); break;
     510                                        case TetraEnum: transientinput->AddTimeInput(new TetraInput(vector_enum,values,P1Enum)); break;
     511                                        default: _error_("Not implemented yet");
     512                                }
     513                        }
     514                        this->inputs->AddInput(transientinput);
     515                        xDelete<IssmDouble>(times);
     516                }
     517                else _error_("nodal vector is either numberofvertices or numberofvertices+1 long. Field provided (" << EnumToStringx(vector_enum) << ") is " << M << " long");
     518
     519                xDelete<IssmDouble>(values);
     520                xDelete<int>(vertexids);
     521        }
     522        else if(vector_type==2){ //element vector
     523                /*Are we in transient or static? */
     524                if(M==iomodel->numberofelements){
     525                        if (code==5){ //boolean
     526                                this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool>(vector[this->Sid()])));
     527                        }
     528                        else if (code==6){ //integer
     529                                this->inputs->AddInput(new IntInput(vector_enum,reCast<int>(vector[this->Sid()])));
     530                        }
     531                        else if (code==7){ //IssmDouble
     532                                this->inputs->AddInput(new DoubleInput(vector_enum,vector[this->Sid()]));
     533                        }
     534                        else _error_("could not recognize nature of vector from code " << code);
     535                }
     536                else {
     537                        _error_("transient element inputs not supported yet!");
     538                }
     539        }
     540        else{
     541                _error_("Cannot add input for vector type " << vector_type << " (not supported)");
     542        }
     543}/*}}}*/
     544void Element::InputUpdateFromConstant(int constant, int name){/*{{{*/
     545
     546        /*Check that name is an element input*/
     547        if(!IsInput(name)) return;
     548
     549        /*update input*/
     550        this->inputs->AddInput(new IntInput(name,constant));
     551}
     552/*}}}*/
     553void Element::InputUpdateFromConstant(IssmDouble constant, int name){/*{{{*/
     554
     555        /*Check that name is an element input*/
     556        if(!IsInput(name)) return;
     557
     558        /*update input*/
     559        this->inputs->AddInput(new DoubleInput(name,constant));
     560}
     561/*}}}*/
     562void Element::InputUpdateFromConstant(bool constant, int name){/*{{{*/
     563
     564        /*Check that name is an element input*/
     565        if(!IsInput(name)) return;
     566
     567        /*update input*/
     568        this->inputs->AddInput(new BoolInput(name,constant));
    441569}
    442570/*}}}*/
     
    535663}
    536664/*}}}*/
     665ElementVector* Element::NewElementVector(int approximation_enum){/*{{{*/
     666        return new ElementVector(nodes,this->GetNumberOfNodes(),this->parameters,approximation_enum);
     667}
     668/*}}}*/
     669ElementMatrix* Element::NewElementMatrix(int approximation_enum){/*{{{*/
     670        return new ElementMatrix(nodes,this->GetNumberOfNodes(),this->parameters,approximation_enum);
     671}
     672/*}}}*/
     673ElementMatrix* Element::NewElementMatrixCoupling(int number_nodes,int approximation_enum){/*{{{*/
     674        return new ElementMatrix(nodes,number_nodes,this->parameters,approximation_enum);
     675}
     676/*}}}*/
    537677void Element::ResultInterpolation(int* pinterpolation,int* pnodesperelement,int output_enum){/*{{{*/
    538678
  • issm/trunk-jpl/src/c/classes/Elements/Element.h

    r17394 r17472  
    7575                void       GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
    7676                IssmDouble GetMaterialParameter(int enum_in);
     77                void       GetNodesSidList(int* sidlist);
     78                void       GetNodesLidList(int* lidlist);
    7779                void       GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
     80                void       GetVerticesCoordinates(IssmDouble** xyz_list);
    7881                void       GetVerticesSidList(int* sidlist);
    7982                void       GetVerticesConnectivityList(int* connectivitylist);
     83                void       InputChangeName(int enum_type,int enum_type_old);
     84                void       InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
     85                void       InputUpdateFromConstant(IssmDouble constant, int name);
     86                void       InputUpdateFromConstant(int constant, int name);
     87                void       InputUpdateFromConstant(bool constant, int name);
    8088                bool         IsInput(int name);
    8189                bool       IsFloating();
     90                ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum);
     91                ElementMatrix*  NewElementMatrix(int approximation_enum=NoneApproximationEnum);
     92                ElementMatrix*  NewElementMatrixCoupling(int number_nodes,int approximation_enum=NoneApproximationEnum);
    8293                void       ResultInterpolation(int* pinterpolation,int*nodesperelement,int output_enum);
    8394                void       ResultToVector(Vector<IssmDouble>* vector,int output_enum);
     
    161172                virtual int    GetNumberOfNodesPressure(void)=0;
    162173                virtual int    GetNumberOfVertices(void)=0;
    163                 virtual void   GetNodesSidList(int* sidlist)=0;
    164                 virtual void   GetNodesLidList(int* sidlist)=0;
    165174
    166175                virtual int    Id()=0;
     
    174183                virtual void   GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
    175184                virtual Node*  GetNode(int node_number)=0;
    176                 virtual void   GetVerticesCoordinates(IssmDouble** xyz_list)=0;
    177185                virtual void   GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
    178186                virtual void   GetVerticesCoordinatesTop(IssmDouble** xyz_list)=0;
     
    184192                virtual IssmDouble SurfaceArea(void)=0;
    185193                virtual void   InputDepthAverageAtBase(int enum_type,int average_enum_type)=0;
    186                 virtual void   InputChangeName(int enum_type,int enum_type_old)=0;
    187194                virtual void   ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
    188195                virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
     
    191198                virtual void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finite_element)=0;
    192199                virtual void   InputDuplicate(int original_enum,int new_enum)=0;
    193                 virtual void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0;
    194200                virtual void   InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int inputenum)=0;
    195201                virtual void   InputUpdateFromSolutionOneDof(IssmDouble* solution,int inputenum)=0;
     
    206212                virtual Gauss* NewGaussLine(int vertex1,int vertex2,int order)=0;
    207213                virtual Gauss* NewGaussTop(int order)=0;
    208                 virtual ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum)=0;
    209                 virtual ElementMatrix*  NewElementMatrix(int approximation_enum=NoneApproximationEnum)=0;
    210                 virtual ElementMatrix*  NewElementMatrixCoupling(int number_nodes,int approximation_enum=NoneApproximationEnum)=0;
     214
    211215                virtual void   InputScale(int enum_type,IssmDouble scale_factor)=0;
    212216                virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum)=0;
  • issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r17463 r17472  
    2828Penta::Penta(int penta_id, int penta_sid, int index, IoModel* iomodel,int nummodels)
    2929        :PentaRef(nummodels)
    30         ,ElementHook(nummodels,index+1,6,iomodel){
     30        ,ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
    3131
    3232        int penta_elements_ids[2];
     
    843843}
    844844/*}}}*/
    845 /*FUNCTION Penta::GetNodesSidList{{{*/
    846 void Penta::GetNodesSidList(int* sidlist){
    847 
    848         _assert_(sidlist);
    849         _assert_(nodes);
    850         int numnodes = this->NumberofNodes();
    851 
    852         for(int i=0;i<numnodes;i++){
    853                 sidlist[i]=nodes[i]->Sid();
    854         }
    855 }
    856 /*}}}*/
    857 /*FUNCTION Penta::GetNodesLidList{{{*/
    858 void Penta::GetNodesLidList(int* lidlist){
    859 
    860         _assert_(lidlist);
    861         _assert_(nodes);
    862         int numnodes = this->NumberofNodes();
    863 
    864         for(int i=0;i<numnodes;i++){
    865                 lidlist[i]=nodes[i]->Lid();
    866         }
    867 }
    868 /*}}}*/
    869845/*FUNCTION Penta::GetNumberOfNodes;{{{*/
    870846int Penta::GetNumberOfNodes(void){
     
    907883}
    908884/*}}}*/
    909 /*FUNCTION Penta::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
    910 void Penta::GetVerticesCoordinates(IssmDouble** pxyz_list){
    911 
    912         IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
    913         ::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
    914 
    915         /*Assign output pointer*/
    916         *pxyz_list = xyz_list;
    917 
    918 }/*}}}*/
    919885/*FUNCTION Penta::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
    920886void Penta::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
     
    953919
    954920        cross(normal,AB,AC);
    955         norm=sqrt(pow(normal[0],2.0)+pow(normal[1],2.0)+pow(normal[2],2.0));
     921        norm=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
    956922
    957923        for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
     
    12061172int    Penta::Id(void){
    12071173        return id;
    1208 }
    1209 /*}}}*/
    1210 /*FUNCTION Penta::InputChangeName{{{*/
    1211 void  Penta::InputChangeName(int original_enum,int new_enum){
    1212 
    1213         /*Call inputs method*/
    1214         this->inputs->ChangeEnum(original_enum,new_enum);
    1215 }
    1216 /*}}}*/
    1217 /*FUNCTION Penta::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/
    1218 void Penta::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){
    1219 
    1220         /*Intermediaries*/
    1221         int             i,t;
    1222         int             penta_vertex_ids[6];
    1223         int             row;
    1224         IssmDouble      nodeinputs[6];
    1225         IssmDouble      time;
    1226         TransientInput *transientinput      = NULL;
    1227 
    1228         /*Branch on type of vector: nodal or elementary: */
    1229         if(vector_type==1){ //nodal vector
    1230 
    1231                 /*Recover vertices ids needed to initialize inputs*/
    1232                 for(i=0;i<6;i++){
    1233                         _assert_(iomodel->elements);
    1234                         penta_vertex_ids[i]=iomodel->elements[6*this->sid+i]; //ids for vertices are in the elements array from Matlab
    1235                 }
    1236 
    1237                 /*Are we in transient or static? */
    1238                 if(M==iomodel->numberofvertices){
    1239 
    1240                         /*create input values: */
    1241                         for(i=0;i<6;i++)nodeinputs[i]=(IssmDouble)vector[penta_vertex_ids[i]-1];
    1242 
    1243                         /*create static input: */
    1244                         this->inputs->AddInput(new PentaInput(vector_enum,nodeinputs,P1Enum));
    1245                 }
    1246                 else if(M==iomodel->numberofvertices+1){
    1247                         /*create transient input: */
    1248                         IssmDouble* times = xNew<IssmDouble>(N);
    1249                         for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
    1250                         transientinput=new TransientInput(vector_enum,times,N);
    1251                         for(t=0;t<N;t++){
    1252                                 for(i=0;i<NUMVERTICES;i++) nodeinputs[i]=vector[N*(penta_vertex_ids[i]-1)+t];
    1253                                 transientinput->AddTimeInput(new PentaInput(vector_enum,nodeinputs,P1Enum));
    1254                         }
    1255                         this->inputs->AddInput(transientinput);
    1256                         xDelete<IssmDouble>(times);
    1257                 }
    1258                 else _error_("nodal vector is either numberofvertices (" << iomodel->numberofvertices << "), or numberofvertices+1 long. Field provided is " << M << " long. Enum " << EnumToStringx(vector_enum));
    1259         }
    1260         else if(vector_type==2){ //element vector
    1261                 /*Are we in transient or static? */
    1262                 if(M==iomodel->numberofelements){
    1263 
    1264                         /*static mode: create an input out of the element value: */
    1265 
    1266                         if (code==5){ //boolean
    1267                                 this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool,IssmDouble>(vector[this->sid])));
    1268                         }
    1269                         else if (code==6){ //integer
    1270                                 this->inputs->AddInput(new IntInput(vector_enum,reCast<int,IssmDouble>(vector[this->sid])));
    1271                         }
    1272                         else if (code==7){ //IssmDouble
    1273                                 this->inputs->AddInput(new DoubleInput(vector_enum,vector[this->sid]));
    1274                         }
    1275                         else _error_("could not recognize nature of vector from code " << code);
    1276                 }
    1277                 else {
    1278                         _error_("transient elementary inputs not supported yet!");
    1279                 }
    1280         }
    1281         else{
    1282                 _error_("Cannot add input for vector type " << vector_type << " (not supported)");
    1283         }
    1284 
    12851174}
    12861175/*}}}*/
     
    14521341}
    14531342/*}}}*/
    1454 /*FUNCTION Penta::InputUpdateFromConstant(bool value, int name);{{{*/
    1455 void  Penta::InputUpdateFromConstant(bool constant, int name){
    1456 
    1457         /*Check that name is an element input*/
    1458         if (!IsInput(name)) return;
    1459 
    1460         /*update input*/
    1461         this->inputs->AddInput(new BoolInput(name,constant));
    1462 }
    1463 /*}}}*/
    1464 /*FUNCTION Penta::InputUpdateFromConstant(IssmDouble value, int name);{{{*/
    1465 void  Penta::InputUpdateFromConstant(IssmDouble constant, int name){
    1466         /*Check that name is an element input*/
    1467         if (!IsInput(name)) return;
    1468 
    1469         /*update input*/
    1470         this->inputs->AddInput(new DoubleInput(name,constant));
    1471 }
    1472 /*}}}*/
    1473 /*FUNCTION Penta::InputUpdateFromConstant(int value, int name);{{{*/
    1474 void  Penta::InputUpdateFromConstant(int constant, int name){
    1475         /*Check that name is an element input*/
    1476         if (!IsInput(name)) return;
    1477 
    1478         /*update input*/
    1479         this->inputs->AddInput(new IntInput(name,constant));
    1480 }
    1481 /*}}}*/
    14821343/*FUNCTION Penta::InputUpdateFromIoModel {{{*/
    14831344void Penta::InputUpdateFromIoModel(int index,IoModel* iomodel){
    14841345
    14851346        /*Intermediaries*/
    1486         IssmInt i,j;
    1487         int     penta_vertex_ids[6];
    1488         IssmDouble  nodeinputs[6];
    1489         IssmDouble  cmmininputs[6];
    1490         IssmDouble  cmmaxinputs[6];
     1347        int        i,j;
     1348        int         penta_vertex_ids[NUMVERTICES];
     1349        IssmDouble  nodeinputs[NUMVERTICES];
     1350        IssmDouble  cmmininputs[NUMVERTICES];
     1351        IssmDouble  cmmaxinputs[NUMVERTICES];
    14911352
    14921353        IssmDouble  yts;
     
    15001361        if(control_analysis) iomodel->Constant(&num_responses,InversionNumCostFunctionsEnum);
    15011362
    1502         /*Checks if debuging*/
    1503         /*{{{*/
     1363        /*Recover vertices ids needed to initialize inputs*/
    15041364        _assert_(iomodel->elements);
    1505         /*}}}*/
    1506 
    1507         /*Recover vertices ids needed to initialize inputs*/
    1508         for(i=0;i<6;i++){
    1509                 penta_vertex_ids[i]=iomodel->elements[6*index+i]; //ids for vertices are in the elements array from Matlab
     1365        for(i=0;i<NUMVERTICES;i++){
     1366                penta_vertex_ids[i]=iomodel->elements[NUMVERTICES*index+i]; //ids for vertices are in the elements array from Matlab
    15101367        }
    15111368
     
    15161373                                case BalancethicknessThickeningRateEnum:
    15171374                                        if (iomodel->Data(BalancethicknessThickeningRateEnum)){
    1518                                                 for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(BalancethicknessThickeningRateEnum)[penta_vertex_ids[j]-1]/yts;
    1519                                                 for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    1520                                                 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     1375                                                for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(BalancethicknessThickeningRateEnum)[penta_vertex_ids[j]-1]/yts;
     1376                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     1377                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    15211378                                                this->inputs->AddInput(new ControlInput(BalancethicknessThickeningRateEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    15221379                                        }
     
    15241381                                case VxEnum:
    15251382                                        if (iomodel->Data(VxEnum)){
    1526                                                 for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(VxEnum)[penta_vertex_ids[j]-1]/yts;
    1527                                                 for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    1528                                                 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     1383                                                for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(VxEnum)[penta_vertex_ids[j]-1]/yts;
     1384                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     1385                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    15291386                                                this->inputs->AddInput(new ControlInput(VxEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    15301387                                        }
     
    15321389                                case VyEnum:
    15331390                                        if (iomodel->Data(VyEnum)){
    1534                                                 for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(VyEnum)[penta_vertex_ids[j]-1]/yts;
    1535                                                 for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    1536                                                 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     1391                                                for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(VyEnum)[penta_vertex_ids[j]-1]/yts;
     1392                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     1393                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    15371394                                                this->inputs->AddInput(new ControlInput(VyEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    15381395                                        }
     
    15401397                                case FrictionCoefficientEnum:
    15411398                                        if (iomodel->Data(FrictionCoefficientEnum)){
    1542                                                 for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(FrictionCoefficientEnum)[penta_vertex_ids[j]-1];
    1543                                                 for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
    1544                                                 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
     1399                                                for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(FrictionCoefficientEnum)[penta_vertex_ids[j]-1];
     1400                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
     1401                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
    15451402                                                this->inputs->AddInput(new ControlInput(FrictionCoefficientEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    15461403                                        }
     
    15481405                                case MaterialsRheologyBbarEnum:
    15491406                                        if(iomodel->Data(MaterialsRheologyBEnum)){
    1550                                                 for(j=0;j<6;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[penta_vertex_ids[j]-1];
    1551                                                 for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
    1552                                                 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
     1407                                                for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[penta_vertex_ids[j]-1];
     1408                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
     1409                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
    15531410                                                this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    15541411                                        }
     
    15561413                                case DamageDbarEnum:
    15571414                                        if(iomodel->Data(DamageDEnum)){
    1558                                                 for(j=0;j<6;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[penta_vertex_ids[j]-1];
    1559                                                 for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
    1560                                                 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
     1415                                                for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[penta_vertex_ids[j]-1];
     1416                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
     1417                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
    15611418                                                this->inputs->AddInput(new ControlInput(DamageDEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    15621419                                        }
     
    15791436                DatasetInput* datasetinput=new DatasetInput(InversionCostFunctionsCoefficientsEnum);
    15801437                for(i=0;i<num_responses;i++){
    1581                         for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(InversionCostFunctionsCoefficientsEnum)[(penta_vertex_ids[j]-1)*num_responses+i];
     1438                        for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(InversionCostFunctionsCoefficientsEnum)[(penta_vertex_ids[j]-1)*num_responses+i];
    15821439                        datasetinput->AddInput(new PentaInput(InversionCostFunctionsCoefficientsEnum,nodeinputs,P1Enum),reCast<int>(iomodel->Data(InversionCostFunctionsEnum)[i]));
    15831440                }
     
    18871744Gauss* Penta::NewGaussTop(int order){
    18881745        return new GaussPenta(3,4,5,order);
    1889 }
    1890 /*}}}*/
    1891 /*FUNCTION Penta::NewElementVector{{{*/
    1892 ElementVector* Penta::NewElementVector(int approximation_enum){
    1893         return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
    1894 }
    1895 /*}}}*/
    1896 /*FUNCTION Penta::NewElementMatrix{{{*/
    1897 ElementMatrix* Penta::NewElementMatrix(int approximation_enum){
    1898         return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
    1899 }
    1900 /*}}}*/
    1901 /*FUNCTION Penta::NewElementMatrixCoupling{{{*/
    1902 ElementMatrix* Penta::NewElementMatrixCoupling(int number_nodes,int approximation_enum){
    1903         return new ElementMatrix(nodes,number_nodes,this->parameters,approximation_enum);
    19041746}
    19051747/*}}}*/
     
    22122054void  Penta::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
    22132055
     2056        /*go into parameters and get the analysis_counter: */
    22142057        int analysis_counter;
    2215 
    2216         /*go into parameters and get the analysis_counter: */
    22172058        parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
    22182059
     
    22202061        this->element_type=this->element_type_list[analysis_counter];
    22212062
    2222         /*Pick up nodes */
    2223         if (this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
     2063        /*Pick up nodes*/
     2064        if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
    22242065        else this->nodes=NULL;
     2066
    22252067}
    22262068/*}}}*/
  • issm/trunk-jpl/src/c/classes/Elements/Penta.h

    r17372 r17472  
    5050                /*}}}*/
    5151                /*Update virtual functions definitions: {{{*/
    52                 void  InputUpdateFromConstant(bool constant, int name);
    53                 void  InputUpdateFromConstant(IssmDouble constant, int name);
    54                 void  InputUpdateFromConstant(int constant, int name);
    5552                void  InputUpdateFromVector(IssmDouble* vector, int name, int type);
    5653                #ifdef _HAVE_DAKOTA_
     
    8582                IssmDouble GetGroundedPortion(IssmDouble* xyz_list);
    8683                int    GetNodeIndex(Node* node);
    87                 void   GetNodesSidList(int* sidlist);
    88                 void   GetNodesLidList(int* lidlist);
    8984                int    GetNumberOfNodes(void);
    9085                int    GetNumberOfNodesPressure(void);
     
    9691                IssmDouble GetZcoord(Gauss* gauss);
    9792                void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
    98                 void   GetVerticesCoordinates(IssmDouble** pxyz_list);
    9993                void   GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
    10094                void   GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
    10195
    10296                int    Sid();
    103                 void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
    10497                void   InputDepthAverageAtBase(int enum_type,int average_enum_type);
    10598                void   InputDuplicate(int original_enum,int new_enum);
     
    204197                void           GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
    205198                Node*          GetNode(int node_number);
    206                 void           InputChangeName(int input_enum, int enum_type_old);
    207199                void             InputExtrude(int enum_type);
    208200                void           InputUpdateFromSolutionOneDof(IssmDouble* solutiong,int enum_type);
     
    225217                Gauss*         NewGaussLine(int vertex1,int vertex2,int order);
    226218                Gauss*         NewGaussTop(int order);
    227                 ElementVector* NewElementVector(int approximation_enum);
    228                 ElementMatrix* NewElementMatrix(int approximation_enum);
    229                 ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum);
    230219                void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
    231220                void           NodalFunctionsP1(IssmDouble* basis,Gauss* gauss);
  • issm/trunk-jpl/src/c/classes/Elements/Seg.cpp

    r17347 r17472  
    2121/*FUNCTION Seg::Seg(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
    2222Seg::Seg(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)
    23                 :SegRef(nummodels),ElementHook(nummodels,index+1,2,iomodel){
     23                :SegRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
    2424
    2525                        /*id: */
     
    263263}
    264264/*}}}*/
    265 /*FUNCTION Seg::NewElementVector{{{*/
    266 ElementVector* Seg::NewElementVector(int approximation_enum){
    267         return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
    268 }
    269 /*}}}*/
    270 /*FUNCTION Seg::NewElementMatrix{{{*/
    271 ElementMatrix* Seg::NewElementMatrix(int approximation_enum){
    272         return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
    273 }
    274 /*}}}*/
    275265/*FUNCTION Seg::NodalFunctions{{{*/
    276266void Seg::NodalFunctions(IssmDouble* basis, Gauss* gauss){
  • issm/trunk-jpl/src/c/classes/Elements/Seg.h

    r17375 r17472  
    5353                void  InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type){_error_("not implemented yet");};
    5454#endif
    55                 void  InputUpdateFromConstant(IssmDouble constant, int name){_error_("not implemented yet");};
    56                 void  InputUpdateFromConstant(int constant, int name){_error_("not implemented yet");};
    57                 void  InputUpdateFromConstant(bool constant, int name){_error_("not implemented yet");};
    5855                void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
    5956                /*}}}*/
     
    8077                Element*    GetBasalElement(void){_error_("not implemented yet");};
    8178                int         GetNodeIndex(Node* node){_error_("not implemented yet");};
    82                 void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
    83                 void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
    8479                int         GetNumberOfNodes(void);
    8580                int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
     
    9085                void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
    9186                int         Sid(){_error_("not implemented yet");};
    92                 void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
    9387                bool        IsOnBed(){_error_("not implemented yet");};
    9488                bool        IsOnSurface(){_error_("not implemented yet");};
     
    138132                Gauss*      NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
    139133                Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
    140                 ElementVector* NewElementVector(int approximation_enum);
    141                 ElementMatrix* NewElementMatrix(int approximation_enum);
    142                 ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum){_error_("not implemented yet");};
    143134                int         VertexConnectivity(int vertexindex){_error_("not implemented yet");};
    144135                void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
     
    152143                void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
    153144                void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
    154                 void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");};
    155145                void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
    156146                void        InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
  • issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp

    r17398 r17472  
    2222/*FUNCTION Tetra::Tetra(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
    2323Tetra::Tetra(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)
    24                 :TetraRef(nummodels),ElementHook(nummodels,index+1,2,iomodel){
     24                :TetraRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
    2525
    2626                        /*id: */
     
    127127/*}}}*/
    128128
     129/*FUNCTION Tetra::AddInput{{{*/
     130void  Tetra::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){
     131
     132        /*Call inputs method*/
     133        _assert_(this->inputs);
     134        this->inputs->AddInput(new TetraInput(input_enum,values,interpolation_enum));
     135}
     136/*}}}*/
     137/*FUNCTION Tetra::Configure {{{*/
     138void  Tetra::Configure(Elements* elementsin, Loads* loadsin, Nodes* nodesin,Vertices* verticesin, Materials* materialsin, Parameters* parametersin){
     139
     140        int analysis_counter;
     141
     142        /*go into parameters and get the analysis_counter: */
     143        parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
     144
     145        /*Get Element type*/
     146        this->element_type=this->element_type_list[analysis_counter];
     147
     148        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
     149         * datasets, using internal ids and offsets hidden in hooks: */
     150        if (this->hnodes[analysis_counter]) this->hnodes[analysis_counter]->configure(nodesin);
     151        this->hvertices->configure(verticesin);
     152        this->hmaterial->configure(materialsin);
     153        this->hmatpar->configure(materialsin);
     154
     155        /*Now, go pick up the objects inside the hooks: */
     156        if (this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
     157        else this->nodes=NULL;
     158        this->vertices          = (Vertex**)this->hvertices->deliverp();
     159        this->material          = (Material*)this->hmaterial->delivers();
     160        this->matpar            = (Matpar*)this->hmatpar->delivers();
     161
     162        /*point parameters to real dataset: */
     163        this->parameters=parametersin;
     164
     165        /*get inputs configured too: */
     166        this->inputs->Configure(parameters);
     167}
     168/*}}}*/
     169/*FUNCTION Tetra::FaceOnBedIndices{{{*/
     170void Tetra::FaceOnBedIndices(int* pindex1,int* pindex2,int* pindex3){
     171
     172        IssmDouble values[NUMVERTICES];
     173        int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
     174
     175        /*Retrieve all inputs and parameters*/
     176        GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
     177
     178        for(int i=0;i<4;i++){
     179                if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1. && values[indices[i][2]] == 1.){
     180                        *pindex1 = indices[i][0];
     181                        *pindex2 = indices[i][1];
     182                        *pindex3 = indices[i][2];
     183                        return;
     184                }
     185        }
     186
     187        _error_("Could not find 3 vertices on bed");
     188}
     189/*}}}*/
     190/*FUNCTION Tetra::FaceOnSurfaceIndices{{{*/
     191void Tetra::FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3){
     192
     193        IssmDouble values[NUMVERTICES];
     194        int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
     195
     196        /*Retrieve all inputs and parameters*/
     197        GetInputListOnVertices(&values[0],MeshVertexonsurfaceEnum);
     198
     199        for(int i=0;i<4;i++){
     200                if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1. && values[indices[i][2]] == 1.){
     201                        *pindex1 = indices[i][0];
     202                        *pindex2 = indices[i][1];
     203                        *pindex3 = indices[i][2];
     204                        return;
     205                }
     206        }
     207
     208        _error_("Could not find 3 vertices on bed");
     209}
     210/*}}}*/
     211/*FUNCTION Tetra::FaceOnFranceIndices{{{*/
     212void Tetra::FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3){
     213
     214        IssmDouble values[NUMVERTICES];
     215        int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
     216
     217        /*Retrieve all inputs and parameters*/
     218        GetInputListOnVertices(&values[0],MaskIceLevelsetEnum);
     219
     220        for(int i=0;i<4;i++){
     221                if(values[indices[i][0]] == 0. && values[indices[i][1]] == 0. && values[indices[i][2]] == 0.){
     222                        *pindex1 = indices[i][0];
     223                        *pindex2 = indices[i][1];
     224                        *pindex3 = indices[i][2];
     225                        return;
     226                }
     227        }
     228
     229        _error_("Could not find 3 vertices on bed");
     230}
     231/*}}}*/
    129232/*FUNCTION Tetra::GetNumberOfNodes;{{{*/
    130233int Tetra::GetNumberOfNodes(void){
     
    137240}
    138241/*}}}*/
    139 /*FUNCTION Tetra::GetVerticesCoordinates(IssmDouble** pxyz_list)   THIS ONE{{{*/
    140 void Tetra::GetVerticesCoordinates(IssmDouble** pxyz_list){
    141 
    142         IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
    143         ::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
     242/*FUNCTION Tetra::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
     243void Tetra::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
     244
     245        int        indices[3];
     246        IssmDouble xyz_list[NUMVERTICES][3];
     247
     248        /*Element XYZ list*/
     249        ::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
     250
     251        /*Allocate Output*/
     252        IssmDouble* xyz_list_edge = xNew<IssmDouble>(3*3);
     253        this->FaceOnBedIndices(&indices[0],&indices[1],&indices[2]);
     254        for(int i=0;i<3;i++) for(int j=0;j<3;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
    144255
    145256        /*Assign output pointer*/
    146         *pxyz_list = xyz_list;
     257        *pxyz_list = xyz_list_edge;
    147258
    148259}/*}}}*/
    149 /*FUNCTION Tetra::IsIceInElement {{{*/
     260/*FUNCTION Tetra::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){{{*/
     261void Tetra::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){
     262
     263        int        indices[3];
     264        IssmDouble xyz_list[NUMVERTICES][3];
     265
     266        /*Element XYZ list*/
     267        ::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
     268
     269        /*Allocate Output*/
     270        IssmDouble* xyz_list_edge = xNew<IssmDouble>(3*3);
     271        this->FaceOnSurfaceIndices(&indices[0],&indices[1],&indices[2]);
     272        for(int i=0;i<3;i++) for(int j=0;j<3;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
     273
     274        /*Assign output pointer*/
     275        *pxyz_list = xyz_list_edge;
     276
     277}/*}}}*/
     278/*FUNCTION Tetra::GetZcoord {{{*/
     279IssmDouble Tetra::GetZcoord(Gauss* gauss){
     280
     281        int    i;
     282        IssmDouble z;
     283        IssmDouble xyz_list[NUMVERTICES][3];
     284        IssmDouble z_list[NUMVERTICES];
     285
     286        ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
     287        for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][2];
     288        TetraRef::GetInputValue(&z,&z_list[0],(GaussTetra*)gauss,P1Enum);
     289
     290        return z;
     291}
     292/*}}}*/
     293/*FUNCTION Tetra::HasFaceOnBed{{{*/
     294bool Tetra::HasFaceOnBed(){
     295
     296        IssmDouble values[NUMVERTICES];
     297        IssmDouble sum;
     298
     299        /*Retrieve all inputs and parameters*/
     300        GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
     301        sum = values[0]+values[1]+values[2]+values[3];
     302
     303        _assert_(sum==0. || sum==1. || sum==2. || sum==3.);
     304
     305        if(sum==3){
     306                return true;
     307        }
     308        else{
     309                return false;
     310        }
     311}
     312/*}}}*/
     313/*FUNCTION Tetra::HasFaceOnSurface{{{*/
     314bool Tetra::HasFaceOnSurface(){
     315
     316        IssmDouble values[NUMVERTICES];
     317        IssmDouble sum;
     318
     319        /*Retrieve all inputs and parameters*/
     320        GetInputListOnVertices(&values[0],MeshVertexonsurfaceEnum);
     321        sum = values[0]+values[1]+values[2]+values[3];
     322
     323        _assert_(sum==0. || sum==1. || sum==2. || sum==3.);
     324
     325        if(sum==3){
     326                return true;
     327        }
     328        else{
     329                return false;
     330        }
     331}
     332/*}}}*/
     333/*FUNCTION Tetra::InputUpdateFromIoModel {{{*/
     334void Tetra::InputUpdateFromIoModel(int index,IoModel* iomodel){
     335
     336        /*Intermediaries*/
     337        int         i,j;
     338        int         tetra_vertex_ids[NUMVERTICES];
     339        IssmDouble  nodeinputs[NUMVERTICES];
     340        IssmDouble  cmmininputs[NUMVERTICES];
     341        IssmDouble  cmmaxinputs[NUMVERTICES];
     342
     343        IssmDouble  yts;
     344        bool    control_analysis;
     345        int     num_control_type,num_responses;
     346
     347        /*Fetch parameters: */
     348        iomodel->Constant(&yts,ConstantsYtsEnum);
     349        iomodel->Constant(&control_analysis,InversionIscontrolEnum);
     350        if(control_analysis) iomodel->Constant(&num_control_type,InversionNumControlParametersEnum);
     351        if(control_analysis) iomodel->Constant(&num_responses,InversionNumCostFunctionsEnum);
     352
     353        /*Recover vertices ids needed to initialize inputs*/
     354        _assert_(iomodel->elements);
     355        for(i=0;i<NUMVERTICES;i++){
     356                tetra_vertex_ids[i]=iomodel->elements[NUMVERTICES*index+i]; //ids for vertices are in the elements array from Matlab
     357        }
     358
     359        /*Control Inputs*/
     360        if (control_analysis && iomodel->Data(InversionControlParametersEnum)){
     361                for(i=0;i<num_control_type;i++){
     362                        switch(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])){
     363                                case BalancethicknessThickeningRateEnum:
     364                                        if (iomodel->Data(BalancethicknessThickeningRateEnum)){
     365                                                for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(BalancethicknessThickeningRateEnum)[tetra_vertex_ids[j]-1]/yts;
     366                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
     367                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
     368                                                this->inputs->AddInput(new ControlInput(BalancethicknessThickeningRateEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
     369                                        }
     370                                        break;
     371                                case VxEnum:
     372                                        if (iomodel->Data(VxEnum)){
     373                                                for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(VxEnum)[tetra_vertex_ids[j]-1]/yts;
     374                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
     375                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
     376                                                this->inputs->AddInput(new ControlInput(VxEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
     377                                        }
     378                                        break;
     379                                case VyEnum:
     380                                        if (iomodel->Data(VyEnum)){
     381                                                for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(VyEnum)[tetra_vertex_ids[j]-1]/yts;
     382                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
     383                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
     384                                                this->inputs->AddInput(new ControlInput(VyEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
     385                                        }
     386                                        break;
     387                                case FrictionCoefficientEnum:
     388                                        if (iomodel->Data(FrictionCoefficientEnum)){
     389                                                for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(FrictionCoefficientEnum)[tetra_vertex_ids[j]-1];
     390                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
     391                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
     392                                                this->inputs->AddInput(new ControlInput(FrictionCoefficientEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
     393                                        }
     394                                        break;
     395                                case MaterialsRheologyBbarEnum:
     396                                        if(iomodel->Data(MaterialsRheologyBEnum)){
     397                                                for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[tetra_vertex_ids[j]-1];
     398                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
     399                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
     400                                                this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
     401                                        }
     402                                        break;
     403                                case DamageDbarEnum:
     404                                        if(iomodel->Data(DamageDEnum)){
     405                                                for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[tetra_vertex_ids[j]-1];
     406                                                for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
     407                                                for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
     408                                                this->inputs->AddInput(new ControlInput(DamageDEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
     409                                        }
     410                                        break;
     411                                default:
     412                                        _error_("Control " << EnumToStringx(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])) << " not implemented yet");
     413                        }
     414                }
     415        }
     416
     417        /*Need to know the type of approximation for this element*/
     418        if(iomodel->Data(FlowequationElementEquationEnum)){
     419                this->inputs->AddInput(new IntInput(ApproximationEnum,reCast<int>(iomodel->Data(FlowequationElementEquationEnum)[index])));
     420        }
     421
     422        /*DatasetInputs*/
     423        if (control_analysis && iomodel->Data(InversionCostFunctionsCoefficientsEnum)) {
     424
     425                /*Create inputs and add to DataSetInput*/
     426                DatasetInput* datasetinput=new DatasetInput(InversionCostFunctionsCoefficientsEnum);
     427                for(i=0;i<num_responses;i++){
     428                        for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(InversionCostFunctionsCoefficientsEnum)[(tetra_vertex_ids[j]-1)*num_responses+i];
     429                        datasetinput->AddInput(new TetraInput(InversionCostFunctionsCoefficientsEnum,nodeinputs,P1Enum),reCast<int>(iomodel->Data(InversionCostFunctionsEnum)[i]));
     430                }
     431
     432                /*Add datasetinput to element inputs*/
     433                this->inputs->AddInput(datasetinput);
     434        }
     435}
     436/*}}}*/
     437/*FUNCTION Tetra::IsIceInElement    THIS ONE{{{*/
    150438bool   Tetra::IsIceInElement(){
    151439
    152         _error_("not implemented yet");
     440        /*Get levelset*/
     441        IssmDouble ls[NUMVERTICES];
     442        GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
     443
     444        /*If the level set on one of the nodes is <0, ice is present in this element*/
     445        for(int i=0;i<NUMVERTICES;i++){
     446                if(ls[i]<0.) return true;
     447        }
     448
     449        return false;
     450}
     451/*}}}*/
     452/*FUNCTION Tetra::IsOnBed {{{*/
     453bool Tetra::IsOnBed(){
     454        return HasFaceOnBed();
     455}
     456/*}}}*/
     457/*FUNCTION Tetra::IsOnSurface {{{*/
     458bool Tetra::IsOnSurface(){
     459        return HasFaceOnSurface();
    153460}
    154461/*}}}*/
    155462bool Tetra::IsIcefront(void){/*{{{*/
    156463
    157         _error_("not implemented yet");
     464        /*Retrieve all inputs and parameters*/
     465        IssmDouble ls[NUMVERTICES];
     466        GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
     467
     468        /* If only one vertex has ice, there is an ice front here */
     469        if(IsIceInElement()){
     470                int nrice=0;       
     471                for(int i=0;i<NUMVERTICES;i++) if(ls[i]<0.) nrice++;
     472                if(nrice==1) return true;
     473        }
     474        return false;
    158475}/*}}}*/
    159476/*FUNCTION Tetra::JacobianDeterminant{{{*/
     
    168485void Tetra::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
    169486
    170         _error_("not implemented yet");
     487        _assert_(gauss->Enum()==GaussTetraEnum);
     488        this->GetJacobianDeterminantFace(pJdet,xyz_list,(GaussTetra*)gauss);
     489
     490}
     491/*}}}*/
     492/*FUNCTION Tetra::JacobianDeterminantBase{{{*/
     493void Tetra::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){
     494
     495        _assert_(gauss->Enum()==GaussTetraEnum);
     496        this->GetJacobianDeterminantFace(pJdet,xyz_list_base,(GaussTetra*)gauss);
     497
     498}
     499/*}}}*/
     500/*FUNCTION Tetra::JacobianDeterminantTop{{{*/
     501void Tetra::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){
     502
     503        _assert_(gauss->Enum()==GaussTetraEnum);
     504        this->GetJacobianDeterminantFace(pJdet,xyz_list_base,(GaussTetra*)gauss);
    171505
    172506}
     
    182516}
    183517/*}}}*/
    184 /*FUNCTION Tetra::NewElementVector THIS ONE{{{*/
    185 ElementVector* Tetra::NewElementVector(int approximation_enum){
    186         return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
    187 }
    188 /*}}}*/
    189 /*FUNCTION Tetra::NewElementMatrix  THIS ONE{{{*/
    190 ElementMatrix* Tetra::NewElementMatrix(int approximation_enum){
    191         return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
     518/*FUNCTION Tetra::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){{{*/
     519Gauss* Tetra::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){
     520        /*FIXME: this is messed up, should provide indices and not xyz_list!*/
     521        int indices[3];
     522        this->FaceOnFrontIndices(&indices[0],&indices[1],&indices[2]);
     523        return new GaussTetra(indices[0],indices[1],indices[2],max(order_horiz,order_vert));
     524}
     525/*}}}*/
     526/*FUNCTION Tetra::NewGaussBase(int order){{{*/
     527Gauss* Tetra::NewGaussBase(int order){
     528
     529        int indices[3];
     530        this->FaceOnBedIndices(&indices[0],&indices[1],&indices[2]);
     531        return new GaussTetra(indices[0],indices[1],indices[2],order);
     532}
     533/*}}}*/
     534/*FUNCTION Tetra::NewGaussTop(int order){{{*/
     535Gauss* Tetra::NewGaussTop(int order){
     536
     537        int indices[3];
     538        this->FaceOnSurfaceIndices(&indices[0],&indices[1],&indices[2]);
     539        return new GaussTetra(indices[0],indices[1],indices[2],order);
    192540}
    193541/*}}}*/
     
    209557/*}}}*/
    210558/*FUNCTION Tetra::NormalSection{{{*/
    211 void Tetra::NormalSection(IssmDouble* normal,IssmDouble* xyz_list_front){
    212 
    213         _error_("Not implemented yet");
    214 }
    215 /*}}}*/
     559void Tetra::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
     560
     561        /*Build unit outward pointing vector*/
     562        IssmDouble AB[3];
     563        IssmDouble AC[3];
     564        IssmDouble norm;
     565
     566        AB[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
     567        AB[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
     568        AB[2]=xyz_list[1*3+2] - xyz_list[0*3+2];
     569        AC[0]=xyz_list[2*3+0] - xyz_list[0*3+0];
     570        AC[1]=xyz_list[2*3+1] - xyz_list[0*3+1];
     571        AC[2]=xyz_list[2*3+2] - xyz_list[0*3+2];
     572
     573        cross(normal,AB,AC);
     574        norm=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
     575
     576        for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
     577}
     578/*}}}*/
     579/*FUNCTION Tetra::ReduceMatrices{{{*/
     580void Tetra::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
     581
     582        int analysis_type;
     583        parameters->FindParam(&analysis_type,AnalysisTypeEnum);
     584
     585        if(pe){
     586                if(analysis_type==StressbalanceAnalysisEnum){
     587                        if(this->element_type==MINIcondensedEnum){
     588                                int approximation;
     589                                inputs->GetInputValue(&approximation,ApproximationEnum);
     590                                if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
     591                                        //Do nothing, condensation already done in PVectorCoupling
     592                                }
     593                                else{
     594                                        _error_("Not implemented");
     595                                }
     596                        }
     597                        else if(this->element_type==P1bubblecondensedEnum){
     598                                _error_("Not implemented");
     599                        }
     600                }
     601        }
     602
     603        if(Ke){
     604                if(analysis_type==StressbalanceAnalysisEnum){
     605                        int approximation;
     606                        inputs->GetInputValue(&approximation,ApproximationEnum);
     607                        if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
     608                                //Do nothing condensatino already done for Stokes part
     609                        }
     610                        else{
     611                                if(this->element_type==MINIcondensedEnum){
     612                                        _error_("Not implemented");
     613                                }
     614                                else if(this->element_type==P1bubblecondensedEnum){
     615                                        _error_("Not implemented");
     616                                }
     617                        }
     618                }
     619        }
     620}
     621/*}}}*/
     622/*FUNCTION Tetra::SetCurrentConfiguration {{{*/
     623void  Tetra::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
     624
     625        /*go into parameters and get the analysis_counter: */
     626        int analysis_counter;
     627        parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
     628
     629        /*Get Element type*/
     630        this->element_type=this->element_type_list[analysis_counter];
     631
     632        /*Pick up nodes*/
     633        if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
     634        else this->nodes=NULL;
     635
     636}
     637/*}}}*/
     638/*FUNCTION Tetra::SetwiseNodeConnectivity   THIS ONE (take from Penta.cpp){{{*/
     639void Tetra::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){
     640
     641        /*Intermediaries*/
     642        const int numnodes = this->NumberofNodes();
     643
     644        /*Output */
     645        int d_nz = 0;
     646        int o_nz = 0;
     647
     648        /*Loop over all nodes*/
     649        for(int i=0;i<numnodes;i++){
     650
     651                if(!flags[this->nodes[i]->Lid()]){
     652
     653                        /*flag current node so that no other element processes it*/
     654                        flags[this->nodes[i]->Lid()]=true;
     655
     656                        int counter=0;
     657                        while(flagsindices[counter]>=0) counter++;
     658                        flagsindices[counter]=this->nodes[i]->Lid();
     659
     660                        /*if node is clone, we have an off-diagonal non-zero, else it is a diagonal non-zero*/
     661                        switch(set2_enum){
     662                                case FsetEnum:
     663                                        if(nodes[i]->indexing.fsize){
     664                                                if(this->nodes[i]->IsClone())
     665                                                 o_nz += 1;
     666                                                else
     667                                                 d_nz += 1;
     668                                        }
     669                                        break;
     670                                case GsetEnum:
     671                                        if(nodes[i]->indexing.gsize){
     672                                                if(this->nodes[i]->IsClone())
     673                                                 o_nz += 1;
     674                                                else
     675                                                 d_nz += 1;
     676                                        }
     677                                        break;
     678                                case SsetEnum:
     679                                        if(nodes[i]->indexing.ssize){
     680                                                if(this->nodes[i]->IsClone())
     681                                                 o_nz += 1;
     682                                                else
     683                                                 d_nz += 1;
     684                                        }
     685                                        break;
     686                                default: _error_("not supported");
     687                        }
     688                }
     689        }
     690
     691        /*Assign output pointers: */
     692        *pd_nz=d_nz;
     693        *po_nz=o_nz;
     694}
     695/*}}}*/
     696/*FUNCTION Tetra::Sid  THIS ONE{{{*/
     697int    Tetra::Sid(){
     698
     699        return sid;
     700
     701}
     702/*}}}*/
     703/*FUNCTION Tetra::Update {{{*/
     704void Tetra::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){
     705
     706        /*Intermediaries*/
     707        int        i;
     708        int        tetra_vertex_ids[6];
     709        IssmDouble nodeinputs[6];
     710        IssmDouble yts;
     711        bool       dakota_analysis;
     712        bool       isFS;
     713        int        numnodes;
     714        int*       tetra_node_ids = NULL;
     715
     716        /*Fetch parameters: */
     717        iomodel->Constant(&yts,ConstantsYtsEnum);
     718        iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
     719        iomodel->Constant(&isFS,FlowequationIsFSEnum);
     720
     721        /*Checks if debuging*/
     722        _assert_(iomodel->elements);
     723
     724        /*Recover element type*/
     725        this->SetElementType(finiteelement_type,analysis_counter);
     726
     727        /*Recover vertices ids needed to initialize inputs*/
     728        for(i=0;i<6;i++) tetra_vertex_ids[i]=iomodel->elements[6*index+i]; //ids for vertices are in the elements array from Matlab
     729
     730        /*Recover nodes ids needed to initialize the node hook.*/
     731        switch(finiteelement_type){
     732                case P1Enum:
     733                        numnodes         = 4;
     734                        tetra_node_ids   = xNew<int>(numnodes);
     735                        tetra_node_ids[0]=iomodel->nodecounter+iomodel->elements[4*index+0];
     736                        tetra_node_ids[1]=iomodel->nodecounter+iomodel->elements[4*index+1];
     737                        tetra_node_ids[2]=iomodel->nodecounter+iomodel->elements[4*index+2];
     738                        tetra_node_ids[3]=iomodel->nodecounter+iomodel->elements[4*index+3];
     739                        break;
     740                default:
     741                        _error_("Finite element "<<EnumToStringx(finiteelement_type)<<" not supported yet");
     742        }
     743
     744        /*hooks: */
     745        this->SetHookNodes(tetra_node_ids,numnodes,analysis_counter); this->nodes=NULL;
     746        xDelete<int>(tetra_node_ids);
     747
     748        /*Fill with IoModel*/
     749        this->InputUpdateFromIoModel(index,iomodel);
     750}
     751/*}}}*/
     752/*FUNCTION Tetra::ZeroLevelsetCoordinates{{{*/
     753void Tetra::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
     754        /*Compute portion of the element that is grounded*/
     755
     756        IssmDouble  levelset[NUMVERTICES];
     757        IssmDouble* xyz_zero = xNew<IssmDouble>(3*3);
     758
     759        /*Recover parameters and values*/
     760        GetInputListOnVertices(&levelset[0],levelsetenum);
     761
     762        if(levelset[0]==0. && levelset[1]==0. && levelset[2]==0.){
     763                xyz_zero[3*0+0]=xyz_list[0*3+0];
     764                xyz_zero[3*0+1]=xyz_list[0*3+1];
     765                xyz_zero[3*0+2]=xyz_list[0*3+2];
     766
     767                /*New point 2*/
     768                xyz_zero[3*1+0]=xyz_list[1*3+0];
     769                xyz_zero[3*1+1]=xyz_list[1*3+1];
     770                xyz_zero[3*1+2]=xyz_list[1*3+2];
     771
     772                /*New point 3*/
     773                xyz_zero[3*2+0]=xyz_list[2*3+0];
     774                xyz_zero[3*2+1]=xyz_list[2*3+1];
     775                xyz_zero[3*2+2]=xyz_list[2*3+2];
     776        }
     777        else if(levelset[0]==0. && levelset[1]==0. && levelset[3]==0.){
     778                xyz_zero[3*0+0]=xyz_list[0*3+0];
     779                xyz_zero[3*0+1]=xyz_list[0*3+1];
     780                xyz_zero[3*0+2]=xyz_list[0*3+2];
     781
     782                /*New point 2*/
     783                xyz_zero[3*1+0]=xyz_list[1*3+0];
     784                xyz_zero[3*1+1]=xyz_list[1*3+1];
     785                xyz_zero[3*1+2]=xyz_list[1*3+2];
     786
     787                /*New point 3*/
     788                xyz_zero[3*2+0]=xyz_list[3*3+0];
     789                xyz_zero[3*2+1]=xyz_list[3*3+1];
     790                xyz_zero[3*2+2]=xyz_list[3*3+2];
     791        }
     792        else if(levelset[1]==0. && levelset[2]==0. && levelset[3]==0.){
     793                xyz_zero[3*0+0]=xyz_list[1*3+0];
     794                xyz_zero[3*0+1]=xyz_list[1*3+1];
     795                xyz_zero[3*0+2]=xyz_list[1*3+2];
     796
     797                /*New point 2*/
     798                xyz_zero[3*1+0]=xyz_list[2*3+0];
     799                xyz_zero[3*1+1]=xyz_list[2*3+1];
     800                xyz_zero[3*1+2]=xyz_list[2*3+2];
     801
     802                /*New point 3*/
     803                xyz_zero[3*2+0]=xyz_list[3*3+0];
     804                xyz_zero[3*2+1]=xyz_list[3*3+1];
     805                xyz_zero[3*2+2]=xyz_list[3*3+2];
     806        }
     807        else if(levelset[2]==0. && levelset[0]==0. && levelset[3]==0.){
     808                xyz_zero[3*0+0]=xyz_list[2*3+0];
     809                xyz_zero[3*0+1]=xyz_list[2*3+1];
     810                xyz_zero[3*0+2]=xyz_list[2*3+2];
     811
     812                /*New point 2*/
     813                xyz_zero[3*1+0]=xyz_list[0*3+0];
     814                xyz_zero[3*1+1]=xyz_list[0*3+1];
     815                xyz_zero[3*1+2]=xyz_list[0*3+2];
     816
     817                /*New point 3*/
     818                xyz_zero[3*2+0]=xyz_list[3*3+0];
     819                xyz_zero[3*2+1]=xyz_list[3*3+1];
     820                xyz_zero[3*2+2]=xyz_list[3*3+2];
     821        }
     822        else _error_("Case not covered");
     823
     824        /*Assign output pointer*/
     825        *pxyz_zero= xyz_zero;
     826}
     827/*}}}*/
  • issm/trunk-jpl/src/c/classes/Elements/Tetra.h

    r17398 r17472  
    5353                void  InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type){_error_("not implemented yet");};
    5454#endif
    55                 void  InputUpdateFromConstant(IssmDouble constant, int name){_error_("not implemented yet");};
    56                 void  InputUpdateFromConstant(int constant, int name){_error_("not implemented yet");};
    57                 void  InputUpdateFromConstant(bool constant, int name){_error_("not implemented yet");};
    58                 void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
     55                void  InputUpdateFromIoModel(int index, IoModel* iomodel);
    5956                /*}}}*/
    6057                /*Element virtual functions definitions: {{{*/
    6158                void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
    62                 void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
     59                void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
    6360                IssmDouble  CharacteristicLength(void){_error_("not implemented yet");};
    6461                void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
    6562                void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
    6663                void        ComputeStressTensor(){_error_("not implemented yet");};
    67                 void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
    68                 void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
    69                 void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
     64                void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
     65                void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
     66                void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
    7067                void        Delta18oParameterization(void){_error_("not implemented yet");};
    7168                void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
     
    7471                IssmDouble  EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
    7572                IssmDouble  EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
     73                void        FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3);
     74                void        FaceOnBedIndices(int* pindex1,int* pindex2,int* pindex3);
     75                void        FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3);
    7676                int         FiniteElement(void);
    7777                Element*    GetUpperElement(void){_error_("not implemented yet");};
     
    8080                Element*    GetBasalElement(void){_error_("not implemented yet");};
    8181                int         GetNodeIndex(Node* node){_error_("not implemented yet");};
    82                 void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
    83                 void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
    8482                int         GetNumberOfNodes(void);
    8583                int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
    8684                int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
    8785                int         GetNumberOfVertices(void);
    88                 void        GetVerticesCoordinates(IssmDouble** pxyz_list);
    89                 void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
    90                 void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
    91                 int         Sid(){_error_("not implemented yet");};
    92                 void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
    93                 bool        IsOnBed(){_error_("not implemented yet");};
    94                 bool        IsOnSurface(){_error_("not implemented yet");};
     86                void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
     87                void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
     88                bool        HasFaceOnBed();
     89                bool        HasFaceOnSurface();
     90                int         Sid();
     91                bool        IsOnBed();
     92                bool        IsOnSurface();
    9593                bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
    9694                void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
    9795                void        JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
    9896                void        JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
    99                 void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
    100                 void        JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
     97                void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
     98                void        JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
    10199                IssmDouble  MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
    102100                void        NodalFunctions(IssmDouble* basis,Gauss* gauss);
     
    128126                IssmDouble  GetXcoord(Gauss* gauss){_error_("Not implemented");};
    129127                IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
    130                 IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
     128                IssmDouble  GetZcoord(Gauss* gauss);
    131129                int         GetElementType(void){_error_("not implemented yet");};
    132130                Gauss*      NewGauss(void);
    133131                Gauss*      NewGauss(int order);
    134132      Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
    135       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
     133      Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
    136134      Gauss*      NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){_error_("not implemented yet");};
    137                 Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
     135                Gauss*      NewGaussBase(int order);
    138136                Gauss*      NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
    139                 Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
    140                 ElementVector* NewElementVector(int approximation_enum);
    141                 ElementMatrix* NewElementMatrix(int approximation_enum);
    142                 ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum){_error_("not implemented yet");};
     137                Gauss*      NewGaussTop(int order);
    143138                int         VertexConnectivity(int vertexindex){_error_("not implemented yet");};
    144139                void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
     
    146141                bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
    147142                bool               IsIcefront(void);
    148                 void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
     143                void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
    149144                void               GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
    150145                void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
     
    152147                void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
    153148                void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
    154                 void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");};
    155149                void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
    156150                void        InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
     
    160154                void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){_error_("not implemented yet");};
    161155                void        ResetFSBasalBoundaryCondition(void){_error_("not implemented yet");};
    162                 void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){_error_("not implemented yet");};
     156                void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
    163157                void        SetTemporaryElementType(int element_type_in){_error_("not implemented yet");};
    164158                void          SmbGradients(){_error_("not implemented yet");};
    165159                IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
    166                 void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");};
     160                void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
    167161                IssmDouble  TimeAdapt(){_error_("not implemented yet");};
    168162                void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
  • issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp

    r17406 r17472  
    329329}
    330330/*}}}*/
     331/*FUNCTION TetraRef::GetJacobianDeterminantFace{{{*/
     332void TetraRef::GetJacobianDeterminantFace(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss){
     333        /*The Jacobian determinant is constant over the element, discard the gaussian points.
     334         * J is assumed to have been allocated of size NDOF2xNDOF2.*/
     335
     336        IssmDouble x1=xyz_list[3*0+0];
     337        IssmDouble y1=xyz_list[3*0+1];
     338        IssmDouble z1=xyz_list[3*0+2];
     339        IssmDouble x2=xyz_list[3*1+0];
     340        IssmDouble y2=xyz_list[3*1+1];
     341        IssmDouble z2=xyz_list[3*1+2];
     342        IssmDouble x3=xyz_list[3*2+0];
     343        IssmDouble y3=xyz_list[3*2+1];
     344        IssmDouble z3=xyz_list[3*2+2];
     345
     346        /*Jdet = norm( AB ^ AC ) / (2 * area of the reference triangle), with areaRef=sqrt(3) */
     347        *Jdet=SQRT3/6.*pow(pow(((y2-y1)*(z3-z1)-(z2-z1)*(y3-y1)),2)+pow(((z2-z1)*(x3-x1)-(x2-x1)*(z3-z1)),2)+pow(((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)),2),0.5);
     348        if(*Jdet<0) _error_("negative jacobian determinant!");
     349}
     350/*}}}*/
    331351/*FUNCTION TetraRef::GetJacobianInvert {{{*/
    332352void TetraRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTetra* gauss){
  • issm/trunk-jpl/src/c/classes/Elements/TetraRef.h

    r17398 r17472  
    2525                void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTetra* gauss);
    2626                void GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss);
     27                void GetJacobianDeterminantFace(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss);
    2728                void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTetra* gauss);
    2829                void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss);
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r17463 r17472  
    2626/*FUNCTION Tria::Tria(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
    2727Tria::Tria(int tria_id, int tria_sid, int index, IoModel* iomodel,int nummodels)
    28         :TriaRef(nummodels),ElementHook(nummodels,index+1,3,iomodel){
     28        :TriaRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
    2929
    3030                /*id: */
     
    687687}
    688688/*}}}*/
    689 /*FUNCTION Tria::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
    690 void Tria::GetVerticesCoordinates(IssmDouble** pxyz_list){
    691 
    692         IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
    693         ::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
    694 
    695         /*Assign output pointer*/
    696         *pxyz_list = xyz_list;
    697 
    698 }/*}}}*/
    699689/*FUNCTION Tria::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
    700690void Tria::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
     
    927917}
    928918/*}}}*/
    929 /*FUNCTION Tria::GetNodesSidList{{{*/
    930 void Tria::GetNodesSidList(int* sidlist){
    931 
    932         _assert_(sidlist);
    933         _assert_(nodes);
    934         int numnodes = this->NumberofNodes();
    935 
    936         for(int i=0;i<numnodes;i++){
    937                 sidlist[i]=nodes[i]->Sid();
    938         }
    939 }
    940 /*}}}*/
    941 /*FUNCTION Tria::GetNodesLidList{{{*/
    942 void Tria::GetNodesLidList(int* lidlist){
    943 
    944         _assert_(lidlist);
    945         _assert_(nodes);
    946         int numnodes = this->NumberofNodes();
    947 
    948         for(int i=0;i<numnodes;i++){
    949                 lidlist[i]=nodes[i]->Lid();
    950         }
    951 }
    952 /*}}}*/
    953919/*FUNCTION Tria::GetNumberOfNodes;{{{*/
    954920int Tria::GetNumberOfNodes(void){
     
    10861052}
    10871053/*}}}*/
    1088 /*FUNCTION Tria::InputChangeName{{{*/
    1089 void  Tria::InputChangeName(int original_enum,int new_enum){
    1090 
    1091         /*Call inputs method*/
    1092         this->inputs->ChangeEnum(original_enum,new_enum);
    1093 }
    1094 /*}}}*/
    10951054/*FUNCTION Tria::InputScale{{{*/
    10961055void  Tria::InputScale(int enum_type,IssmDouble scale_factor){
     
    11041063        /*Scale: */
    11051064        input->Scale(scale_factor);
    1106 }
    1107 /*}}}*/
    1108 /*FUNCTION Tria::InputUpdateFromConstant(int value, int name);{{{*/
    1109 void  Tria::InputUpdateFromConstant(int constant, int name){
    1110 
    1111         /*Check that name is an element input*/
    1112         if(!IsInput(name)) return;
    1113 
    1114         /*update input*/
    1115         this->inputs->AddInput(new IntInput(name,constant));
    1116 }
    1117 /*}}}*/
    1118 /*FUNCTION Tria::InputUpdateFromConstant(IssmDouble value, int name);{{{*/
    1119 void  Tria::InputUpdateFromConstant(IssmDouble constant, int name){
    1120 
    1121         /*Check that name is an element input*/
    1122         if(!IsInput(name)) return;
    1123 
    1124         /*update input*/
    1125         this->inputs->AddInput(new DoubleInput(name,constant));
    1126 }
    1127 /*}}}*/
    1128 /*FUNCTION Tria::InputUpdateFromConstant(bool value, int name);{{{*/
    1129 void  Tria::InputUpdateFromConstant(bool constant, int name){
    1130 
    1131         /*Check that name is an element input*/
    1132         if(!IsInput(name)) return;
    1133 
    1134         /*update input*/
    1135         this->inputs->AddInput(new BoolInput(name,constant));
    11361065}
    11371066/*}}}*/
     
    13401269}
    13411270/*}}}*/
    1342 /*FUNCTION Tria::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/
    1343 void Tria::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){
    1344 
    1345         /*Intermediaries*/
    1346         int    i,t;
    1347         int    tria_vertex_ids[3];
    1348         int    row;
    1349         IssmDouble nodeinputs[3];
    1350         IssmDouble time;
    1351         TransientInput* transientinput=NULL;
    1352 
    1353         /*Branch on type of vector: nodal or elementary: */
    1354         if(vector_type==1){ //nodal vector
    1355 
    1356                 /*Recover vertices ids needed to initialize inputs*/
    1357                 for(i=0;i<3;i++){
    1358                         _assert_(iomodel->elements);
    1359                         tria_vertex_ids[i]=reCast<int>(iomodel->elements[3*this->sid+i]); //ids for vertices are in the elements array from Matlab
    1360                 }
    1361 
    1362                 /*Are we in transient or static? */
    1363                 if(M==iomodel->numberofvertices){
    1364 
    1365                         /*create input values: */
    1366                         for(i=0;i<3;i++)nodeinputs[i]=vector[tria_vertex_ids[i]-1];
    1367 
    1368                         /*create static input: */
    1369                         this->inputs->AddInput(new TriaInput(vector_enum,nodeinputs,P1Enum));
    1370                 }
    1371                 else if(M==iomodel->numberofvertices+1){
    1372                         /*create transient input: */
    1373                         IssmDouble* times = xNew<IssmDouble>(N);
    1374                         for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
    1375                         transientinput=new TransientInput(vector_enum,times,N);
    1376                         for(t=0;t<N;t++){
    1377                                 for(i=0;i<NUMVERTICES;i++) nodeinputs[i]=vector[N*(tria_vertex_ids[i]-1)+t];
    1378                                 transientinput->AddTimeInput(new TriaInput(vector_enum,nodeinputs,P1Enum));
    1379                         }
    1380                         this->inputs->AddInput(transientinput);
    1381                         xDelete<IssmDouble>(times);
    1382                 }
    1383                 else _error_("nodal vector is either numberofvertices or numberofvertices+1 long. Field provided (" << EnumToStringx(vector_enum) << ") is " << M << " long");
    1384         }
    1385         else if(vector_type==2){ //element vector
    1386                 /*Are we in transient or static? */
    1387                 if(M==iomodel->numberofelements){
    1388 
    1389                         /*static mode: create an input out of the element value: */
    1390 
    1391                         if (code==5){ //boolean
    1392                                 this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool>(vector[this->sid])));
    1393                         }
    1394                         else if (code==6){ //integer
    1395                                 this->inputs->AddInput(new IntInput(vector_enum,reCast<int>(vector[this->sid])));
    1396                         }
    1397                         else if (code==7){ //IssmDouble
    1398                                 this->inputs->AddInput(new DoubleInput(vector_enum,vector[this->sid]));
    1399                         }
    1400                         else _error_("could not recognize nature of vector from code " << code);
    1401                 }
    1402                 else {
    1403                         _error_("transient element inputs not supported yet!");
    1404                 }
    1405         }
    1406         else{
    1407                 _error_("Cannot add input for vector type " << vector_type << " (not supported)");
    1408         }
    1409 
    1410 }
    1411 /*}}}*/
    14121271/*FUNCTION Tria::IsOnBed {{{*/
    14131272bool Tria::IsOnBed(){
     
    16811540        this->EdgeOnSurfaceIndices(&indices[0],&indices[1]);
    16821541        return new GaussTria(indices[0],indices[1],order);
    1683 }
    1684 /*}}}*/
    1685 /*FUNCTION Tria::NewElementVector{{{*/
    1686 ElementVector* Tria::NewElementVector(int approximation_enum){
    1687         return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
    1688 }
    1689 /*}}}*/
    1690 /*FUNCTION Tria::NewElementMatrix{{{*/
    1691 ElementMatrix* Tria::NewElementMatrix(int approximation_enum){
    1692         return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
    16931542}
    16941543/*}}}*/
     
    20241873}
    20251874/*}}}*/
    2026 /*FUNCTION Tria::SetCurrentConfiguration {{{*/
    2027 void  Tria::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
    2028 
    2029         /*go into parameters and get the analysis_counter: */
    2030         int analysis_counter;
    2031         parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
    2032 
    2033         /*Get Element type*/
    2034         this->element_type=this->element_type_list[analysis_counter];
    2035 
    2036         /*Pick up nodes*/
    2037         if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
    2038         else this->nodes=NULL;
    2039 
    2040 }
    2041 /*}}}*/
    20421875/*FUNCTION Tria::SpawnSeg {{{*/
    20431876Seg*  Tria::SpawnSeg(int index1,int index2){
     
    21041937                        _error_("not implemented yet");
    21051938        }
     1939}
     1940/*}}}*/
     1941/*FUNCTION Tria::SetCurrentConfiguration {{{*/
     1942void  Tria::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
     1943
     1944        /*go into parameters and get the analysis_counter: */
     1945        int analysis_counter;
     1946        parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
     1947
     1948        /*Get Element type*/
     1949        this->element_type=this->element_type_list[analysis_counter];
     1950
     1951        /*Pick up nodes*/
     1952        if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
     1953        else this->nodes=NULL;
     1954
    21061955}
    21071956/*}}}*/
  • issm/trunk-jpl/src/c/classes/Elements/Tria.h

    r17372 r17472  
    5353                void  InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type);
    5454                #endif
    55                 void  InputUpdateFromConstant(IssmDouble constant, int name);
    56                 void  InputUpdateFromConstant(int constant, int name);
    57                 void  InputUpdateFromConstant(bool constant, int name);
    5855                void  InputUpdateFromIoModel(int index, IoModel* iomodel);
    5956                /*}}}*/
     
    7976                IssmDouble  GetGroundedPortion(IssmDouble* xyz_list);
    8077                int         GetNodeIndex(Node* node);
    81                 void        GetNodesSidList(int* sidlist);
    82                 void        GetNodesLidList(int* lidlist);
    8378                int         GetNumberOfNodes(void);
    8479                int         GetNumberOfNodesPressure(void);
     
    10297                void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
    10398                void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
    104                 void        GetVerticesCoordinates(IssmDouble** pxyz_list);
    10599                void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
    106100                void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
    107                 void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
    108101                void        InputDepthAverageAtBase(int enum_type,int average_enum_type);
    109102                void        InputDuplicate(int original_enum,int new_enum);
     
    215208                void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
    216209                Node*          GetNode(int node_number);
    217                 void             InputChangeName(int enum_type,int enum_type_old);
    218210                void             InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
    219211                void             InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
     
    232224                Gauss*         NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
    233225                Gauss*         NewGaussTop(int order);
    234                 ElementVector* NewElementVector(int approximation_enum);
    235                 ElementMatrix* NewElementMatrix(int approximation_enum);
    236                 ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum){_error_("not implemented yet");};
    237226                void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
    238227                void           NodalFunctionsP1(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
  • issm/trunk-jpl/src/c/classes/classes.h

    r17398 r17472  
    6161#include "./Inputs/DoubleInput.h"
    6262#include "./Inputs/IntInput.h"
     63#include "./Inputs/TetraInput.h"
    6364#include "./Inputs/PentaInput.h"
    6465#include "./Inputs/TriaInput.h"
  • issm/trunk-jpl/src/c/classes/gauss/GaussTetra.cpp

    r17398 r17472  
    33 */
    44
     5#include <math.h>
    56#include "./GaussTetra.h"
    67#include "../../shared/io/Print/Print.h"
     
    3233/*FUNCTION GaussTetra::GaussTetra(int order) {{{*/
    3334GaussTetra::GaussTetra(int order){
    34         _error_("not implemented yet");
     35        /*Get gauss points*/
     36        GaussLegendreTetra(&numgauss,&coords1,&coords2,&coords3,&coords4,&weights,order);
     37        for(int i=0;i<numgauss;i++) this->weights[i]=this->weights[i]*sqrt(2.)/6.; //FIXME: double check that
     38
     39        /*Initialize static fields as undefinite*/
     40        weight=UNDEF;
     41        coord1=UNDEF;
     42        coord2=UNDEF;
     43        coord3=UNDEF;
     44}
     45/*}}}*/
     46/*FUNCTION GaussTetra::GaussTetra(int index1,int index2,int index3,int order) {{{*/
     47GaussTetra::GaussTetra(int index1,int index2,int index3,int order){
     48
     49        /*Basal Tria*/
     50        if(index1==0 && index2==1 && index3==2){
     51                GaussLegendreTria(&numgauss,&coords1,&coords2,&coords3,&weights,order);
     52                coords4=xNew<IssmDouble>(numgauss);
     53                for(int i=0;i<numgauss;i++) coords4[i]=0.;
     54        }
     55        else if(index1==0 && index2==1 && index3==3){
     56                GaussLegendreTria(&numgauss,&coords1,&coords2,&coords4,&weights,order);
     57                coords3=xNew<IssmDouble>(numgauss);
     58                for(int i=0;i<numgauss;i++) coords3[i]=0.;
     59        }
     60        else if(index1==1 && index2==2 && index3==3){
     61                GaussLegendreTria(&numgauss,&coords2,&coords3,&coords4,&weights,order);
     62                coords1=xNew<IssmDouble>(numgauss);
     63                for(int i=0;i<numgauss;i++) coords1[i]=0.;
     64        }
     65        else if(index1==2 && index2==0 && index3==3){
     66                GaussLegendreTria(&numgauss,&coords1,&coords3,&coords4,&weights,order);
     67                coords2=xNew<IssmDouble>(numgauss);
     68                for(int i=0;i<numgauss;i++) coords2[i]=0.;
     69        }
     70        else{
     71                _error_(index1 <<" "<<index2 <<" "<<index3 <<" Not supported yet");
     72        }
    3573}
    3674/*}}}*/
     
    119157        /*update static arrays*/
    120158        switch(iv){
    121                 default: _error_("vertex index should be in [0 5]");
     159                case 0: coord1=1.; coord2=0.; coord3=0.; coord4=0.; break;
     160                case 1: coord1=0.; coord2=1.; coord3=0.; coord4=0.; break;
     161                case 2: coord1=0.; coord2=0.; coord3=1.; coord4=0.; break;
     162                case 3: coord1=0.; coord2=0.; coord3=0.; coord4=1.; break;
     163                default: _error_("vertex index should be in [0 3]");
    122164
    123165        }
     
    133175        /*update static arrays*/
    134176        switch(finiteelement){
     177                case P1Enum: case P1DGEnum:
     178                        switch(iv){
     179                                case 0: coord1=1.; coord2=0.; coord3=0.; coord4=0.; break;
     180                                case 1: coord1=0.; coord2=1.; coord3=0.; coord4=0.; break;
     181                                case 2: coord1=0.; coord2=0.; coord3=1.; coord4=0.; break;
     182                                case 3: coord1=0.; coord2=0.; coord3=0.; coord4=1.; break;
     183                                default: _error_("node index should be in [0 3]");
     184                        }
     185                        break;
    135186                default: _error_("Finite element "<<EnumToStringx(finiteelement)<<" not supported");
    136187        }
  • issm/trunk-jpl/src/c/classes/gauss/GaussTetra.h

    r17398 r17472  
    3131                GaussTetra();
    3232                GaussTetra(int order);
     33                GaussTetra(int index1,int index2,int index3,int order);
    3334                ~GaussTetra();
    3435
  • issm/trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h

    r16328 r17472  
    3333        switch(meshtype){
    3434                case Mesh2DhorizontalEnum:
    35                         epart=xNew<int>(numberofelements);
    36                         npart=xNew<int>(numberofnodes);
    37                         index=xNew<int>(elements_width*numberofelements);
    38                         for (i=0;i<numberofelements;i++){
    39                                 for (j=0;j<elements_width;j++){
    40                                         *(index+elements_width*i+j)=(*(elements+elements_width*i+j))-1; //-1 for C indexing in Metis
    41                                 }
    42                         }
    43 
    44                         /*Partition using Metis:*/
    45                         if (num_procs>1){
    46 #ifdef _HAVE_METIS_
    47                                 METIS_PartMeshNodalPatch(&numberofelements,&numberofnodes, index, &etype, &numflag, &num_procs, &edgecut, epart, npart);
    48 #else
    49                                 _error_("metis has not beed installed. Cannot run with more than 1 cpu");
    50 #endif
    51                         }
    52                         else if (num_procs==1){
    53                                 /*METIS does not know how to deal with one cpu only!*/
    54                                 for (i=0;i<numberofelements;i++) epart[i]=0;
    55                                 for (i=0;i<numberofnodes;i++)    npart[i]=0;
    56                         }
    57                         else _error_("At least one processor is required");
    58                         break;
    5935                case Mesh2DverticalEnum:
     36                case Mesh3DtetrasEnum:
    6037                        epart=xNew<int>(numberofelements);
    6138                        npart=xNew<int>(numberofnodes);
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp

    r17309 r17472  
    3737                        }
    3838                        break;
     39                case Mesh3DtetrasEnum:
     40                        for(i=0;i<iomodel->numberofelements;i++){
     41                                if(iomodel->my_elements[i]) elements->AddObject(new Tetra(i+1,i,i,iomodel,nummodels));
     42                        }
     43                        break;
    3944                case Mesh3DEnum:
    4045                        iomodel->FetchData(2,MeshUpperelementsEnum,MeshLowerelementsEnum);
     
    6065                                        if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);
    6166                                        break;
    62                                 case Mesh3DEnum:
     67                                case Mesh3DEnum: case Mesh3DtetrasEnum:
    6368                                        if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBEnum,QmuMaterialsRheologyBEnum);
    6469                                        break;
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp

    r16336 r17472  
    3939                case Mesh2DhorizontalEnum: elementswidth=3; break;
    4040                case Mesh2DverticalEnum:   elementswidth=3; break;
     41                case Mesh3DtetrasEnum:     elementswidth=4; break;
    4142                case Mesh3DEnum:           elementswidth=6; break;
    4243                default:                   _error_("mesh not supported yet");
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp

    r16539 r17472  
    6060                case Mesh2DverticalEnum:
    6161                        elements_width=3;
     62                        numberofelements2d = 0;
     63                        numberofvertices2d = 0;
     64                        numlayers          = 0;
     65                        break;
     66                case Mesh3DtetrasEnum:
     67                        elements_width=4; //penta elements
    6268                        numberofelements2d = 0;
    6369                        numberofvertices2d = 0;
  • issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h

    r17459 r17472  
    215215        Mesh2DverticalEnum,
    216216        Mesh3DEnum,
     217        Mesh3DtetrasEnum,
    217218        MiscellaneousNameEnum, //FIXME: only used by qmu, should not be marshalled (already in queueing script)
    218219        MasstransportHydrostaticAdjustmentEnum,
  • issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp

    r17459 r17472  
    223223                case Mesh2DverticalEnum : return "Mesh2Dvertical";
    224224                case Mesh3DEnum : return "Mesh3D";
     225                case Mesh3DtetrasEnum : return "Mesh3Dtetras";
    225226                case MiscellaneousNameEnum : return "MiscellaneousName";
    226227                case MasstransportHydrostaticAdjustmentEnum : return "MasstransportHydrostaticAdjustment";
  • issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp

    r17459 r17472  
    226226              else if (strcmp(name,"Mesh2Dvertical")==0) return Mesh2DverticalEnum;
    227227              else if (strcmp(name,"Mesh3D")==0) return Mesh3DEnum;
     228              else if (strcmp(name,"Mesh3Dtetras")==0) return Mesh3DtetrasEnum;
    228229              else if (strcmp(name,"MiscellaneousName")==0) return MiscellaneousNameEnum;
    229230              else if (strcmp(name,"MasstransportHydrostaticAdjustment")==0) return MasstransportHydrostaticAdjustmentEnum;
     
    259260              else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
    260261              else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
    261               else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
    262262         else stage=3;
    263263   }
    264264   if(stage==3){
    265               if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
     265              if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
     266              else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
    266267              else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
    267268              else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
     
    382383              else if (strcmp(name,"Materials")==0) return MaterialsEnum;
    383384              else if (strcmp(name,"Nodes")==0) return NodesEnum;
    384               else if (strcmp(name,"Contours")==0) return ContoursEnum;
    385385         else stage=4;
    386386   }
    387387   if(stage==4){
    388               if (strcmp(name,"Parameters")==0) return ParametersEnum;
     388              if (strcmp(name,"Contours")==0) return ContoursEnum;
     389              else if (strcmp(name,"Parameters")==0) return ParametersEnum;
    389390              else if (strcmp(name,"Vertices")==0) return VerticesEnum;
    390391              else if (strcmp(name,"Results")==0) return ResultsEnum;
     
    505506              else if (strcmp(name,"Vz")==0) return VzEnum;
    506507              else if (strcmp(name,"VzSSA")==0) return VzSSAEnum;
    507               else if (strcmp(name,"VzHO")==0) return VzHOEnum;
    508508         else stage=5;
    509509   }
    510510   if(stage==5){
    511               if (strcmp(name,"VzPicard")==0) return VzPicardEnum;
     511              if (strcmp(name,"VzHO")==0) return VzHOEnum;
     512              else if (strcmp(name,"VzPicard")==0) return VzPicardEnum;
    512513              else if (strcmp(name,"VzFS")==0) return VzFSEnum;
    513514              else if (strcmp(name,"VxMesh")==0) return VxMeshEnum;
     
    628629              else if (strcmp(name,"LockFileName")==0) return LockFileNameEnum;
    629630              else if (strcmp(name,"ToolkitsOptionsAnalyses")==0) return ToolkitsOptionsAnalysesEnum;
    630               else if (strcmp(name,"ToolkitsOptionsStrings")==0) return ToolkitsOptionsStringsEnum;
    631631         else stage=6;
    632632   }
    633633   if(stage==6){
    634               if (strcmp(name,"QmuErrName")==0) return QmuErrNameEnum;
     634              if (strcmp(name,"ToolkitsOptionsStrings")==0) return ToolkitsOptionsStringsEnum;
     635              else if (strcmp(name,"QmuErrName")==0) return QmuErrNameEnum;
    635636              else if (strcmp(name,"QmuInName")==0) return QmuInNameEnum;
    636637              else if (strcmp(name,"QmuOutName")==0) return QmuOutNameEnum;
Note: See TracChangeset for help on using the changeset viewer.