Changeset 15583


Ignore:
Timestamp:
07/24/13 13:53:00 (12 years ago)
Author:
Mathieu Morlighem
Message:

CHG: Nodes do not look for iomodel->flowequations[i] but the approximation must now be provided to the constructor

Location:
issm/trunk-jpl/src/c
Files:
6 edited

Legend:

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

    r15567 r15583  
    2222}
    2323/*}}}*/
    24 /*FUNCTION Node::Node(int node_id,int node_sid,int io_index, IoModel* iomodel,int analysis_type) {{{*/
    25 Node::Node(int node_id,int node_sid,int io_index, IoModel* iomodel,int analysis_type){
     24/*FUNCTION Node::Node(int node_id,int node_sid,int io_index, IoModel* iomodel,int analysis_type,int approximation) {{{*/
     25Node::Node(int node_id,int node_sid,int io_index, IoModel* iomodel,int analysis_type,int in_approximation){
    2626
    2727        /*Intermediary*/
    2828        int k,l;
    2929        int gsize;
    30         int node_type;
    3130
    3231        /*id: */
     
    4039
    4140        /*indexing:*/
    42         node_type = reCast<int>(iomodel->Data(FlowequationVertexEquationEnum)[io_index]);
    43         DistributeNumDofs(&this->indexing,analysis_type,node_type); //number of dofs per node
     41        DistributeNumDofs(&this->indexing,analysis_type,in_approximation); //number of dofs per node
    4442        gsize=this->indexing.gsize;
    4543
    4644        if(analysis_type==DiagnosticHorizAnalysisEnum)
    47          this->approximation=reCast<int>(node_type);
     45         this->approximation=in_approximation;
    4846        else
    4947         this->approximation=0;
     
    5553        if(iomodel->Data(MaskVertexongroundediceEnum))
    5654          this->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,reCast<bool>(iomodel->Data(MaskVertexongroundediceEnum)[io_index])));
    57         if(analysis_type==DiagnosticHorizAnalysisEnum)
    58          this->approximation=reCast<int>(node_type);
    5955        /*set single point constraints: */
    6056
     
    7773                        _assert_(iomodel->Data(MeshVertexonbedEnum));
    7874                        _assert_(iomodel->Data(FlowequationVertexEquationEnum));
    79                         if(node_type==SSAApproximationEnum && !reCast<int>(iomodel->Data(MeshVertexonbedEnum)[io_index])){
     75                        if(in_approximation==SSAApproximationEnum && !reCast<int>(iomodel->Data(MeshVertexonbedEnum)[io_index])){
    8076                                this->Deactivate();
    8177                        }
    82                         if(node_type==L1L2ApproximationEnum && !reCast<int>(iomodel->Data(MeshVertexonbedEnum)[io_index])){
     78                        if(in_approximation==L1L2ApproximationEnum && !reCast<int>(iomodel->Data(MeshVertexonbedEnum)[io_index])){
    8379                                this->Deactivate();
    8480                        }
    85                         if(node_type==SSAHOApproximationEnum && reCast<int>(iomodel->Data(FlowequationBorderSSAEnum)[io_index])){
     81                        if(in_approximation==SSAHOApproximationEnum && reCast<int>(iomodel->Data(FlowequationBorderSSAEnum)[io_index])){
    8682                                if(!reCast<int>(iomodel->Data(MeshVertexonbedEnum)[io_index])){
    8783                                        this->Deactivate();
    8884                                }
    8985                        }
    90                         if(node_type==SSAFSApproximationEnum && reCast<int>(iomodel->Data(FlowequationBorderSSAEnum)[io_index])){
     86                        if(in_approximation==SSAFSApproximationEnum && reCast<int>(iomodel->Data(FlowequationBorderSSAEnum)[io_index])){
    9187                                if(!reCast<int>(iomodel->Data(MeshVertexonbedEnum)[io_index])){
    9288                                        for(k=1;k<=2;k++) this->FreezeDof(k);
     
    9591                }
    9692                /*spc all nodes on SIA*/
    97                 if(node_type==SIAApproximationEnum){
     93                if(in_approximation==SIAApproximationEnum){
    9894                        this->Deactivate();
    9995                }
     
    105101                _assert_(iomodel->Data(FlowequationVertexEquationEnum));
    106102                /*Constrain all nodes that are not SIA*/
    107                 if(reCast<int>(node_type)!=SIAApproximationEnum){
     103                if(reCast<int>(in_approximation)!=SIAApproximationEnum){
    108104                        this->Deactivate();
    109105                }
     
    143139
    144140        _printf_("Node:\n");
    145         _printf_("   id: " << id << "\n");
     141        _printf_("   id : " << id << "\n");
    146142        _printf_("   sid: " << sid << "\n");
    147143        _printf_("   analysis_type: " << EnumToStringx(analysis_type) << "\n");
     144        _printf_("   approximation: " << EnumToStringx(approximation) << "\n");
    148145        indexing.Echo();
    149         _printf_("   inputs:      " << inputs << "\n");
     146        _printf_("   inputs: " << inputs << "\n");
    150147
    151148}
     
    451448         * to a fixed value during computations. */
    452449
     450        if(dof>=this->indexing.gsize){
     451                printf("dof spc = %i\n",dof);
     452                this->Echo();
     453        }
    453454        _assert_(dof<this->indexing.gsize);
    454455
  • issm/trunk-jpl/src/c/classes/Node.h

    r15535 r15583  
    1111#include "../shared/shared.h"
    1212#include "./DofIndexing.h"
     13#include "./Update.h"
    1314class  Inputs;
    1415class  Hook;
     
    2021class ElementVector;
    2122class ElementMatrix;
    22 #include "Update.h"
    2323/*}}}*/
    2424
     
    3838                IssmDouble   coord_system[3][3];
    3939
    40                 /*Node constructors, destructors {{{*/
     40                /*Node constructors, destructors*/
    4141                Node();
    42                 Node(int node_id,int node_sid,int io_index, IoModel* iomodel,int analysis_type);
     42                Node(int node_id,int node_sid,int io_index, IoModel* iomodel,int analysis_type,int approximation_in);
    4343                ~Node();
    44                 /*}}}*/
    45                 /*Object virtual functions definitions:{{{ */
     44
     45                /*Object virtual functions definitions:*/
    4646                void    Echo();
    4747                void    DeepEcho();
    4848                int     Id();
    4949                int     ObjectEnum();
    50                 Object *copy()        {_error_("Not implemented yet (similar to Elements)"); };
    51                 /*}}}*/
    52                 /*Update virtual functions definitions: {{{*/
     50                Object *copy(){_error_("Not implemented yet (similar to Elements)"); };
     51
     52                /*Update virtual functions definitions:*/
    5353                void  InputUpdateFromVector(IssmDouble* vector, int name, int type);
    5454                void  InputUpdateFromVector(int* vector, int name, int type);
     
    6363                void  InputUpdateFromSolution(IssmDouble* solution){_error_("Not implemented yet!");}
    6464                void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("Not implemented yet!");}
    65                 /*}}}*/
    66                 /*Node numerical routines {{{*/
     65
     66                /*Node numerical routines*/
    6767                void  CreateNodalConstraints(Vector<IssmDouble>* ys);
    6868                void  SetCurrentConfiguration(DataSet* nodes,Vertices* vertices);
     
    9797                void  UpdateCloneDofs(int* alltruerows,int ncols,int setenum);
    9898                void  SetClone(int* minranks);
    99                 /*}}}*/
    10099};
    101100
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp

    r15533 r15583  
    99#include "./ModelProcessorx.h"
    1010
    11 void CreateNodes(Nodes** pnodes, IoModel* iomodel,int analysis,int finite_element){
     11void CreateNodes(Nodes** pnodes, IoModel* iomodel,int analysis,int finite_element,int approximation){
    1212
    1313        /*Intermediaries*/
     
    2626                        for(i=0;i<iomodel->numberofvertices;i++){
    2727                                if(iomodel->my_vertices[i]){
    28                                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,i,iomodel,analysis));
     28                                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,i,iomodel,analysis,approximation));
    2929                                }
    3030                        }
     
    3636                                for(j=0;j<3;j++){
    3737                                        if(my_nodes[3*i+j]){
    38                                                 nodes->AddObject(new Node(iomodel->nodecounter+3*i+j+1,iomodel->nodecounter+3*i+j,iomodel->elements[+3*i+j]-1,iomodel,analysis));
     38                                                nodes->AddObject(new Node(iomodel->nodecounter+3*i+j+1,iomodel->nodecounter+3*i+j,iomodel->elements[+3*i+j]-1,iomodel,analysis,approximation));
    3939
    4040                                        }
     
    4848                        for(i=0;i<iomodel->numberofvertices;i++){
    4949                                if(iomodel->my_vertices[i]){
    50                                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,i,iomodel,analysis));
     50                                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,i,iomodel,analysis,approximation));
    5151                                }
    5252                        }
    5353                        for(i=0;i<iomodel->numberofedges;i++){
    5454                                if(my_edges[i]){
    55                                         nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,0,iomodel,analysis));
     55                                        nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,0,iomodel,analysis,approximation));
    5656                                }
    5757                        }
     
    5959
    6060                case MINIcondensedEnum:
     61                        _assert_(approximation==FSApproximationEnum);
    6162                        /*P1 velocity*/
    6263                        for(i=0;i<iomodel->numberofvertices;i++){
    6364                                if(iomodel->my_vertices[i]){
    64                                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,i,iomodel,analysis));
     65                                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,i,iomodel,analysis,approximation));
    6566                                }
    6667                        }
     
    6869                        for(i=0;i<iomodel->numberofvertices;i++){
    6970                                if(iomodel->my_vertices[i]){
    70                                         nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,i,i,iomodel,analysis));
     71                                        nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,i,i,iomodel,analysis,approximation));
    7172                                }
    7273                        }
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp

    r15564 r15583  
    1212
    1313        /*Intermediary*/
    14         bool   isSSA,isL1L2,isHO,isFS;
    15         int    finiteelementssa;
     14        bool isSSA,isL1L2,isHO,isFS,iscoupling;
     15        int  temp,finiteelement=-1,approximation=-1;
    1616
    1717        /*Fetch parameters: */
     
    2020        iomodel->Constant(&isHO,FlowequationIsHOEnum);
    2121        iomodel->Constant(&isFS,FlowequationIsFSEnum);
    22         iomodel->Constant(&finiteelementssa,FlowequationFeSSAEnum);
    2322
    24         /*Now, is the flag macayaealHO on? otherwise, do nothing: */
     23        /*Now, check that we have non SIA elements */
    2524        if(!isSSA & !isL1L2 & !isHO & !isFS) return;
    2625
    27         /*Create nodes: */
    28         iomodel->FetchData(9,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
    29                                 MaskVertexongroundediceEnum,MaskVertexonfloatingiceEnum,MaskVertexonwaterEnum,FlowequationVertexEquationEnum,DiagnosticReferentialEnum);
    30         if(finiteelementssa==0){
    31                 CreateNodes(pnodes,iomodel,DiagnosticHorizAnalysisEnum,P1Enum);
    32         }
    33         else if(finiteelementssa==1){
    34                 CreateNodes(pnodes,iomodel,DiagnosticHorizAnalysisEnum,P2Enum);
     26        /*Do we have coupling*/
     27        if( (isSSA?1.:0.) + (isL1L2?1.:0.) + (isHO?1.:0.) + (isFS?1.:0.) >1.)
     28         iscoupling = true;
     29        else
     30         iscoupling = false;
     31
     32        /*If no coupling, call Regular CreateNodes, else, use P1 elements only*/
     33        if(!iscoupling){
     34
     35                /*Get finite element type*/
     36                if(isSSA){
     37                        approximation=SSAApproximationEnum;
     38                        iomodel->Constant(&temp,FlowequationFeSSAEnum);
     39                        switch(temp){
     40                                case 0 : finiteelement = P1Enum; break;
     41                                case 1 : finiteelement = P2Enum; break;
     42                                default: _error_("finite element "<<temp<<" not supported");
     43                        }
     44                }
     45                else if(isL1L2){
     46                        approximation = L1L2ApproximationEnum;
     47                        finiteelement = P1Enum;
     48                }
     49                else if(isHO){
     50                        approximation = HOApproximationEnum;
     51                        finiteelement = P1Enum;
     52                }
     53                else if(isFS){
     54                        approximation = FSApproximationEnum;
     55                        finiteelement = P1Enum;
     56                }
     57
     58                iomodel->FetchData(9,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
     59                                        MaskVertexongroundediceEnum,MaskVertexonfloatingiceEnum,MaskVertexonwaterEnum,FlowequationVertexEquationEnum,DiagnosticReferentialEnum);
     60                CreateNodes(pnodes,iomodel,DiagnosticHorizAnalysisEnum,finiteelement,approximation);
     61                iomodel->DeleteData(9,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
     62                                        MaskVertexongroundediceEnum,MaskVertexonfloatingiceEnum,MaskVertexonwaterEnum,FlowequationVertexEquationEnum,DiagnosticReferentialEnum);
    3563        }
    3664        else{
    37                 _error_("finite element not supported yet");
     65                /*Coupling: we are going to create P1 Elements only*/
     66
     67                /*First create nodes*/
     68                Nodes* nodes=*pnodes;
     69                if(!nodes) nodes = new Nodes();
     70
     71                iomodel->FetchData(9,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
     72                                        MaskVertexongroundediceEnum,MaskVertexonfloatingiceEnum,MaskVertexonwaterEnum,FlowequationVertexEquationEnum,DiagnosticReferentialEnum);
     73                for(int i=0;i<iomodel->numberofvertices;i++){
     74                        if(iomodel->my_vertices[i]){
     75                                nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,i,iomodel,DiagnosticHorizAnalysisEnum,reCast<int>(iomodel->Data(FlowequationVertexEquationEnum)[i])));
     76                        }
     77                }
     78                iomodel->DeleteData(9,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
     79                                        MaskVertexongroundediceEnum,MaskVertexonfloatingiceEnum,MaskVertexonwaterEnum,FlowequationVertexEquationEnum,DiagnosticReferentialEnum);
     80
     81                /*Assign output pointer: */
     82                *pnodes=nodes;
    3883        }
    39         iomodel->DeleteData(9,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
    40                                 MaskVertexongroundediceEnum,MaskVertexonfloatingiceEnum,MaskVertexonwaterEnum,FlowequationVertexEquationEnum,DiagnosticReferentialEnum);
    4184}
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp

    r15564 r15583  
    1818        if(!isSIA) return;
    1919
    20         iomodel->FetchData(6,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,MaskVertexongroundediceEnum,MaskVertexonfloatingiceEnum,FlowequationVertexEquationEnum,MaskVertexonwaterEnum);
    21         CreateNodes(pnodes,iomodel,DiagnosticSIAAnalysisEnum,P1Enum);
    22         iomodel->DeleteData(6,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,MaskVertexongroundediceEnum,MaskVertexonfloatingiceEnum,FlowequationVertexEquationEnum,MaskVertexonwaterEnum);
     20        /*First create nodes*/
     21        Nodes* nodes=*pnodes;
     22        if(!nodes) nodes = new Nodes();
     23
     24        iomodel->FetchData(9,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
     25                                MaskVertexongroundediceEnum,MaskVertexonfloatingiceEnum,MaskVertexonwaterEnum,FlowequationVertexEquationEnum,DiagnosticReferentialEnum);
     26        for(int i=0;i<iomodel->numberofvertices;i++){
     27                if(iomodel->my_vertices[i]){
     28                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,i,iomodel,DiagnosticSIAAnalysisEnum,reCast<int>(iomodel->Data(FlowequationVertexEquationEnum)[i])));
     29                }
     30        }
     31        iomodel->DeleteData(9,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
     32                                MaskVertexongroundediceEnum,MaskVertexonfloatingiceEnum,MaskVertexonwaterEnum,FlowequationVertexEquationEnum,DiagnosticReferentialEnum);
     33
     34        /*Assign output pointer: */
     35        *pnodes=nodes;
    2336}
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h

    r15564 r15583  
    2323void CreateParametersHydrologyDCEfficient(Parameters** pparameters,IoModel* iomodel,int solution_type,int analysis_type);
    2424void UpdateElementsAndMaterialsControl(Elements* elements,Materials* materials, IoModel* iomodel);
    25 void CreateNodes(Nodes** pnodes, IoModel* iomodel,int analysis,int finite_element);
     25void CreateNodes(Nodes** pnodes, IoModel* iomodel,int analysis,int finite_element,int approximation=NoneApproximationEnum);
    2626
    2727/*Creation of fem datasets: specialised drivers: */
Note: See TracChangeset for help on using the changeset viewer.