Changeset 4117


Ignore:
Timestamp:
06/22/10 11:00:15 (15 years ago)
Author:
Mathieu Morlighem
Message:

some fixing in node creation. Now, vertex_id must be an argument of Node constructor

Location:
issm/trunk/src/c
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/ModelProcessorx/Balancedthickness/CreateNodesBalancedthickness.cpp

    r4057 r4117  
    4646
    4747                        /*Add node to nodes dataset: */
    48                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,iomodel,BalancedthicknessAnalysisEnum));
     48                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i+1,i,iomodel,BalancedthicknessAnalysisEnum));
    4949
    5050                }
  • issm/trunk/src/c/modules/ModelProcessorx/Balancedthickness2/CreateNodesBalancedthickness2.cpp

    r4057 r4117  
    1818        int i,j;
    1919        bool continuous_galerkin=false;
    20         int  vertex_index;
    21         int node_index;
     20        int  node_id;
     21        int  vertex_id;
     22        int  io_index;
    2223
    2324        /*DataSets: */
     
    5354
    5455                                //Get index of the vertex on which the current node is located
    55                                 vertex_index=(int)*(iomodel->elements+3*i+j)-1; //(Matlab to C indexing)
    56                                 ISSMASSERT(vertex_index>=0 && vertex_index<iomodel->numberofvertices);
     56                                vertex_id=(int)*(iomodel->elements+3*i+j); //(Matlab indexing)
     57                                io_index=vertex_id-1;                      //(C indexing)
     58                                ISSMASSERT(vertex_id>0 && vertex_id<=iomodel->numberofvertices);
    5759
    58                                 //Compute Node index (id-1)
    59                                 node_index=3*i+j;
     60                                //Compute Node id
     61                                node_id=iomodel->nodecounter+3*i+j+1;
    6062
    6163                                /*Add node to nodes dataset: */
    62                                 nodes->AddObject(new Node(iomodel->nodecounter+i+1,vertex_index,node_index,iomodel,Balancedthickness2AnalysisEnum));
     64                                nodes->AddObject(new Node(node_id,vertex_id,io_index,iomodel,Balancedthickness2AnalysisEnum));
    6365
    6466                        }
  • issm/trunk/src/c/modules/ModelProcessorx/Balancedvelocities/CreateNodesBalancedvelocities.cpp

    r4057 r4117  
    4646                       
    4747                        /*Add node to nodes dataset: */
    48                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,iomodel,BalancedvelocitiesAnalysisEnum));
     48                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i+1,i,iomodel,BalancedvelocitiesAnalysisEnum));
    4949
    5050                }
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp

    r4025 r4117  
    5151                       
    5252                        /*Add node to nodes dataset: */
    53                         nodes->AddObject(new Node(totalnodes+i+1,i,iomodel,DiagnosticHorizAnalysisEnum));
     53                        nodes->AddObject(new Node(totalnodes+i+1,i+1,i,iomodel,DiagnosticHorizAnalysisEnum));
    5454                }
    5555        }
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp

    r4057 r4117  
    5252
    5353                        /*Add node to nodes dataset: */
    54                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,iomodel,DiagnosticHutterAnalysisEnum));
     54                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i+1,i,iomodel,DiagnosticHutterAnalysisEnum));
    5555
    5656                }
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticStokes/CreateNodesDiagnosticStokes.cpp

    r4057 r4117  
    5050
    5151                        /*Add node to nodes dataset: */
    52                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,iomodel,DiagnosticStokesAnalysisEnum));
     52                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i+1,i,iomodel,DiagnosticStokesAnalysisEnum));
    5353
    5454                }
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateNodesDiagnosticVert.cpp

    r4057 r4117  
    4747
    4848                        /*Add node to nodes dataset: */
    49                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,iomodel,DiagnosticVertAnalysisEnum));
     49                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i+1,i,iomodel,DiagnosticVertAnalysisEnum));
    5050
    5151                }
  • issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateNodesMelting.cpp

    r4057 r4117  
    4646                       
    4747                        /*Add node to nodes dataset: */
    48                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,iomodel,MeltingAnalysisEnum));
     48                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i+1,i,iomodel,MeltingAnalysisEnum));
    4949
    5050                }
  • issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp

    r4092 r4117  
    4141                analysis_type=analysis_type_list[i];
    4242       
    43                 _printf_("   create datasets for this analysis type:\n");
     43                _printf_("   create datasets for analysis %s\n",EnumAsString(analysis_type));
    4444                CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,&parameters,iomodel,IOMODEL,solution_type,analysis_type,nummodels,i);
    4545        }
  • issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp

    r4057 r4117  
    4646
    4747                        /*Add node to nodes dataset: */
    48                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,iomodel,PrognosticAnalysisEnum));
     48                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i+1,i,iomodel,PrognosticAnalysisEnum));
    4949
    5050                }
  • issm/trunk/src/c/modules/ModelProcessorx/Prognostic2/CreateNodesPrognostic2.cpp

    r4057 r4117  
    1717        /*Intermediary*/
    1818        int i,j;
    19         int vertex_index;
    20         int node_index;
    2119        bool continuous_galerkin=false;
     20        int  node_id;
     21        int  vertex_id;
     22        int  io_index;
    2223
    2324        /*DataSets: */
     
    5253
    5354                                //Get index of the vertex on which the current node is located
    54                                 vertex_index=(int)*(iomodel->elements+3*i+j)-1; //(Matlab to C indexing)
    55                                 ISSMASSERT(vertex_index>=0 && vertex_index<iomodel->numberofvertices);
     55                                vertex_id=(int)*(iomodel->elements+3*i+j); //(Matlab indexing)
     56                                io_index=vertex_id-1;                      //(C indexing)
     57                                ISSMASSERT(vertex_id>0 && vertex_id<=iomodel->numberofvertices);
    5658
    57                                 //Compute Node index (id-1)
    58                                 node_index=3*i+j;
     59                                //Compute Node id
     60                                node_id=iomodel->nodecounter+3*i+j+1;
    5961
    6062                                /*Add node to nodes dataset: */
    61                                 nodes->AddObject(new Node(iomodel->nodecounter+node_index+1,vertex_index,node_index,iomodel,Prognostic2AnalysisEnum));
     63                                nodes->AddObject(new Node(node_id,vertex_id,io_index,iomodel,Balancedthickness2AnalysisEnum));
    6264
    6365                        }
  • issm/trunk/src/c/modules/ModelProcessorx/SlopeCompute/CreateNodesSlopeCompute.cpp

    r4057 r4117  
    4646                       
    4747                        /*Add node to nodes dataset: */
    48                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,iomodel,SlopeAnalysisEnum));
     48                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i+1,i,iomodel,SlopeAnalysisEnum));
    4949
    5050                }
  • issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp

    r4057 r4117  
    4646                       
    4747                        /*Add node to nodes dataset: */
    48                         nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,iomodel,ThermalAnalysisEnum));
     48                        nodes->AddObject(new Node(iomodel->nodecounter+i+1,i+1,i,iomodel,ThermalAnalysisEnum));
    4949
    5050                }
  • issm/trunk/src/c/objects/FemModel.cpp

    r4063 r4117  
    5656
    5757                analysis_type=analysis_type_list[i];
     58                _printf_("   processing finite element model of analysis %s:\n",EnumAsString(analysis_type));
    5859       
    59                 _printf_("   create degrees of freedom: \n");
     60                _printf_("      create degrees of freedom\n");
    6061                VerticesDofx( &partition,&tpartition,vertices,parameters);
    6162                NodesDofx(nodes,parameters);
    6263
    63                 _printf_("   create single point constraints: \n");
     64                _printf_("      create single point constraints\n");
    6465                SpcNodesx( &m_yg[i], nodes,constraints,analysis_type);
    6566
    66                 _printf_("   create rigid body constraints:\n");
     67                _printf_("      create rigid body constraints\n");
    6768                MpcNodesx( &m_Rmg[i], nodes,constraints,analysis_type);
    6869
    69                 _printf_("   create node sets:\n");
     70                _printf_("      create node sets\n");
    7071                BuildNodeSetsx(&m_nodesets[i], nodes,analysis_type);
    7172
    72                 _printf_("   reducing single point constraints vector:\n");
     73                _printf_("      reducing single point constraints vector\n");
    7374                Reducevectorgtosx(&m_ys[i], m_yg[i],m_nodesets[i]);
    7475
    75                 _printf_("   normalizing rigid body constraints matrix:\n");
     76                _printf_("      normalizing rigid body constraints matrix\n");
    7677                NormalizeConstraintsx(&m_Gmn[i], m_Rmg[i],m_nodesets[i]);
    7778
    78                 _printf_("   configuring element and loads:\n");
     79                _printf_("      configuring element and loads\n");
    7980                ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
    8081        }
  • issm/trunk/src/c/objects/Node.cpp

    r4091 r4117  
    5454}
    5555/*}}}*/
    56 /*FUNCTION Node::Node(int id, int i, IoModel* iomodel,int analysis_type)          -> Continuous Galerkin{{{2*/
    57 Node::Node(int node_id, int i, IoModel* iomodel,int analysis_type){ //i is the node index
    58 
     56/*FUNCTION Node::Node(int node_id,int vertex_id,int io_index, IoModel* iomodel,int analysis_type) {{{2*/
     57Node::Node(int node_id,int vertex_id,int io_index, IoModel* iomodel,int analysis_type){
     58
     59        /*Intermediary*/
    5960        int k;
    6061        int numdofs;
    61         int vertex_id;
    6262        int upper_node_id;
    6363
     
    6868        /*indexing:*/
    6969        DistributeNumDofs(&numdofs,analysis_type); //number of dofs per node
    70 
    7170        this->indexing.Init(numdofs);
    7271
    7372        /*hooks: */
    74         vertex_id=this->id; //node and vertex have the same id, as we are running galerkin continuous, with same number of nodes and vertices.
    75 
    7673        if (iomodel->dim==3){
    77                 if (isnan(iomodel->uppernodes[i])){
     74                if (isnan(iomodel->uppernodes[io_index])){
    7875                        upper_node_id=this->id; //nodes on surface do not have upper nodes, only themselves.
    7976                }
    8077                else{
    81                         upper_node_id=(int)iomodel->uppernodes[i];
     78                        upper_node_id=(int)iomodel->uppernodes[io_index];
    8279                }
    8380        }
     
    8986        this->hvertex.Init(&vertex_id,1); //node id is the same as the vertex id, continuous galerkin!
    9087        this->hupper_node.Init(&upper_node_id,1);
     88
     89        //intialize inputs, and add as many inputs per element as requested:
     90        this->inputs=new Inputs();
     91        if (iomodel->gridonbed)      this->inputs->AddInput(new BoolInput(NodeOnBedEnum,(IssmBool)iomodel->gridonbed[io_index]));
     92        if (iomodel->gridonsurface)  this->inputs->AddInput(new BoolInput(NodeOnSurfaceEnum,(IssmBool)iomodel->gridonsurface[io_index]));
     93        if (iomodel->gridoniceshelf) this->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,(IssmBool)iomodel->gridoniceshelf[io_index]));
     94        if (iomodel->gridonicesheet) this->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,(IssmBool)iomodel->gridonicesheet[io_index]));
     95        if (iomodel->numbernodetoelementconnectivity) this->inputs->AddInput(new IntInput(NumberNodeToElementConnectivityEnum,iomodel->numbernodetoelementconnectivity[io_index]));
    9196
    9297        /*set single point constraints: */
     
    97102                        /*We have a  3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */
    98103                        if (!iomodel->deadgrids) ISSMERROR("iomodel->deadgrids is NULL");
    99                         if (iomodel->deadgrids[i]){
     104                        if (iomodel->deadgrids[io_index]){
    100105                                for(k=1;k<=numdofs;k++){
    101106                                        this->FreezeDof(k);
     
    105110                /*spc all nodes on hutter*/
    106111                if (!iomodel->gridonhutter) ISSMERROR("iomodel->gridonhutter is NULL");
    107                 if (iomodel->gridonhutter[i]){
     112                if (iomodel->gridonhutter[io_index]){
    108113                        for(k=1;k<=numdofs;k++){
    109114                                this->FreezeDof(k);
     
    116121                /*On a 3d mesh, in stokes formualtions, only stokes grids are free, the others are frozen: */
    117122                if (!iomodel->borderstokes) ISSMERROR("iomodel->borderstokes is NULL");
    118                 if (iomodel->borderstokes[i]){
     123                if (iomodel->borderstokes[io_index]){
    119124                        //freeze everything except pressure
    120125                        this->FreezeDof(1);
     
    122127                        this->FreezeDof(3);
    123128                }
    124                 else if (iomodel->gridonstokes[i]==0){
     129                else if (iomodel->gridonstokes[io_index]==0){
    125130                        for(k=1;k<=numdofs;k++){
    126131                                this->FreezeDof(k);
     
    133138                /*Spc all nodes that are not Hutter*/
    134139                if (!iomodel->gridonhutter) ISSMERROR("iomodel->gridonhutter is NULL");
    135                 if (!iomodel->gridonhutter[i]){
     140                if (!iomodel->gridonhutter[io_index]){
    136141                        for(k=1;k<=numdofs;k++){
    137142                                this->FreezeDof(k);
     
    151156                        /*On a 3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */
    152157                        if (!iomodel->gridonbed) ISSMERROR("iomodel->gridonbed is NULL");
    153                         if (!iomodel->gridonbed[i]){
     158                        if (!iomodel->gridonbed[io_index]){
    154159                                for(k=1;k<=numdofs;k++){
    155160                                        this->FreezeDof(k);
     
    158163                }
    159164        }
    160        
    161         //intialize inputs, and add as many inputs per element as requested:
    162         this->inputs=new Inputs();
    163         if (iomodel->gridonbed)      this->inputs->AddInput(new BoolInput(NodeOnBedEnum,(IssmBool)iomodel->gridonbed[i]));
    164         if (iomodel->gridonsurface)  this->inputs->AddInput(new BoolInput(NodeOnSurfaceEnum,(IssmBool)iomodel->gridonsurface[i]));
    165         if (iomodel->gridoniceshelf) this->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,(IssmBool)iomodel->gridoniceshelf[i]));
    166         if (iomodel->gridonicesheet) this->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,(IssmBool)iomodel->gridonicesheet[i]));
    167         if (iomodel->numbernodetoelementconnectivity) this->inputs->AddInput(new IntInput(NumberNodeToElementConnectivityEnum,iomodel->numbernodetoelementconnectivity[i]));
    168 
    169 }
    170 /*}}}*/
    171 /*FUNCTION Node::Node(int id, int i, int j, IoModel* iomodel,int analysis_type)   -> Discontinuous Galerkin{{{2*/
    172 Node::Node(int node_id,int i,int j,IoModel* iomodel,int analysis_type){
    173         /* i -> index of the vertex in C indexing
    174          * j -> index of the node in C indexing*/
    175 
    176         int numdofs;
    177         int vertex_id;
    178         int upper_node_id;
    179 
    180         /*id: */
    181         this->id=node_id; //matlab indexing
    182         this->analysis_type=analysis_type;
    183 
    184         /*indexing:*/
    185         DistributeNumDofs(&numdofs,analysis_type); //number of dofs per node
    186 
    187         this->indexing.Init(numdofs);
    188 
    189        
    190         /*hooks: */
    191         vertex_id=i+1; //matlab indexing
    192 
    193         if (iomodel->dim==3){
    194                 if (isnan(iomodel->uppernodes[i])){
    195                         upper_node_id=this->id; //nodes on surface do not have upper nodes, only themselves.
    196                 }
    197                 else{
    198                         upper_node_id=(int)iomodel->uppernodes[i];
    199                 }
    200         }
    201         else{
    202                 /*If we are running 2d, upper_node does not mean much. Just point towards itself!:*/
    203                 upper_node_id=this->id;
    204         }
    205 
    206         this->hvertex.Init(&vertex_id,1);
    207         this->hupper_node.Init(&upper_node_id,1);
    208        
    209         //intialize inputs, and add as many inputs per element as requested:
    210         this->inputs=new Inputs();
    211         if (iomodel->gridonbed) this->inputs->AddInput(new BoolInput(NodeOnBedEnum,(IssmBool)iomodel->gridonbed[i]));
    212         if (iomodel->gridonsurface) this->inputs->AddInput(new BoolInput(NodeOnSurfaceEnum,(IssmBool)iomodel->gridonsurface[i]));
    213         if (iomodel->gridoniceshelf) this->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,(IssmBool)iomodel->gridoniceshelf[i]));
    214         if (iomodel->gridonicesheet) this->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,(IssmBool)iomodel->gridonicesheet[i]));
    215 
    216165
    217166}
     
    420369}
    421370/*}}}*/
    422 /*FUNCTION Node::InAnalysis(int analysis_type){{{1*/
     371/*FUNCTION Node::InAnalysis(int analysis_type){{{2*/
    423372bool Node::InAnalysis(int in_analysis_type){
    424373        if (in_analysis_type=this->analysis_type)return true;
    425374        else return false;
    426375}
     376/*}}}*/
    427377/*}}}*/
    428378/*Object numerics: {{{1*/
  • issm/trunk/src/c/objects/Node.h

    r4091 r4117  
    3636                Node(int id,int vertex_id, int upper_node_id, int numberofdofs);
    3737                Node(int id,DofIndexing* indexing, Hook* vertex, Hook* upper_node, Inputs* inputs,int analysis_type);
    38                 Node(int id, int i, IoModel* iomodel,int analysis_type);
    39                 Node(int id, int i,int j,IoModel* iomodel,int analysis_type);
     38                Node(int node_id,int vertex_id,int io_index, IoModel* iomodel,int analysis_type);
    4039                ~Node();
    4140                /*}}}*/
Note: See TracChangeset for help on using the changeset viewer.