Changeset 3451


Ignore:
Timestamp:
04/08/10 08:03:47 (15 years ago)
Author:
Mathieu Morlighem
Message:

fixed Node constructor

Location:
issm/trunk/src/c/objects
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Node.cpp

    r3446 r3451  
    6767        /*indexing:*/
    6868        DistributeNumDofs(&numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); //number of dofs per node
    69         if(iomodel->my_bordervertices[i])partitionborder=1; else partitionborder=0;//is this node on a partition border?
     69        if(iomodel->my_bordervertices[i]) partitionborder=1; else partitionborder=0;//is this node on a partition border?
    7070
    7171        this->indexing.Init(numdofs,partitionborder);
    7272
    7373        /*properties: */
    74         this->properties.Init(
    75                         (int)iomodel->gridonbed[i],
    76                         (int)iomodel->gridonsurface[i],
    77                         (int)iomodel->gridoniceshelf[i],
    78                         (int)iomodel->gridonicesheet[i]);
     74        this->properties.Init(i,iomodel);
    7975
    8076        /*hooks: */
     
    9793        this->hupper_node.Init(&upper_node_id,1);
    9894
    99         /*set single point constraints.: */
    100         /*FROM DIAGNOSTICHORIZ*/
    101         if (strcmp(iomodel->meshtype,"3d")==0){
    102                 /*We have a  3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */
    103                 if (iomodel->deadgrids[i]){
     95        /*set single point constraints: */
     96
     97        /*Diagnostic Horiz*/
     98        if (iomodel->analysis_type==DiagnosticAnalysisEnum() && iomodel->sub_analysis_type==HorizAnalysisEnum()){
     99                if (strcmp(iomodel->meshtype,"3d")==0){
     100                        /*We have a  3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */
     101                        if (!iomodel->deadgrids) ISSMERROR("iomodel->deadgrids is NULL");
     102                        if (iomodel->deadgrids[i]){
     103                                for(k=1;k<=numdofs;k++){
     104                                        this->FreezeDof(k);
     105                                }
     106                        }
     107                }
     108                /*spc all nodes on hutter*/
     109                if (!iomodel->gridonhutter) ISSMERROR("iomodel->gridonhutter is NULL");
     110                if (iomodel->gridonhutter[i]){
    104111                        for(k=1;k<=numdofs;k++){
    105112                                this->FreezeDof(k);
     
    107114                }
    108115        }
    109         if (iomodel->gridonhutter[i]){
    110                 for(k=1;k<=numdofs;k++){
    111                         this->FreezeDof(k);
    112                 }
    113         }
    114         /*FROM DIAGNOSTICSTOKES*/
    115         /*On a 3d mesh, in stokes formualtions, only stokes grids are free, the others are frozen: */
    116         if (iomodel->borderstokes[i]){
    117                 //freeze everything except pressure
    118                 this->FreezeDof(1);
    119                 this->FreezeDof(2);
    120                 this->FreezeDof(3);
    121         }
    122         else if (iomodel->gridonstokes[i]==0){
    123                 for(k=1;k<=numdofs;k++){
    124                         this->FreezeDof(k);
    125                 }
    126         }
    127         /*FROM DIAGNOSTICHUTTER*/
    128         if (!iomodel->gridonhutter[i]){
    129                 for(k=1;k<=numdofs;k++){
    130                         this->FreezeDof(k);
    131                 }
    132         }
    133         /*FROM PROGNOSTIC/BALANCESVEL/BALANCEDTHICK*/
    134         if (strcmp(iomodel->meshtype,"3d")==0){
    135                 /*On a 3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */
    136                 if (!iomodel->gridonbed[i]){
     116
     117        /*Diagnostic Stokes*/
     118        if (iomodel->analysis_type==DiagnosticAnalysisEnum() && iomodel->sub_analysis_type==StokesAnalysisEnum()){
     119                /*On a 3d mesh, in stokes formualtions, only stokes grids are free, the others are frozen: */
     120                if (!iomodel->borderstokes) ISSMERROR("iomodel->borderstokes is NULL");
     121                if (iomodel->borderstokes[i]){
     122                        //freeze everything except pressure
     123                        this->FreezeDof(1);
     124                        this->FreezeDof(2);
     125                        this->FreezeDof(3);
     126                }
     127                else if (iomodel->gridonstokes[i]==0){
    137128                        for(k=1;k<=numdofs;k++){
    138129                                this->FreezeDof(k);
     130                        }
     131                }
     132        }
     133
     134        /*Diagnostic Hutter*/
     135        if (iomodel->analysis_type==DiagnosticAnalysisEnum() && iomodel->sub_analysis_type==HutterAnalysisEnum()){
     136                /*Spc all nodes that are not Hutter*/
     137                if (!iomodel->gridonhutter) ISSMERROR("iomodel->gridonhutter is NULL");
     138                if (!iomodel->gridonhutter[i]){
     139                        for(k=1;k<=numdofs;k++){
     140                                this->FreezeDof(k);
     141                        }
     142                }
     143        }
     144
     145        /*Prognostic/ Balancedvelocities/ Balancedthickness*/
     146        if (iomodel->analysis_type==PrognosticAnalysisEnum() || iomodel->analysis_type==BalancedvelocitiesAnalysisEnum() || iomodel->analysis_type==BalancedthicknessAnalysisEnum()){
     147                if (strcmp(iomodel->meshtype,"3d")==0){
     148                        /*On a 3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */
     149                        if (!iomodel->gridonbed) ISSMERROR("iomodel->gridonbed is NULL");
     150                        if (!iomodel->gridonbed[i]){
     151                                for(k=1;k<=numdofs;k++){
     152                                        this->FreezeDof(k);
     153                                }
    139154                        }
    140155                }
  • issm/trunk/src/c/objects/Node.h

    r3446 r3451  
    55#ifndef _NODE_H_
    66#define _NODE_H_
    7 
    87
    98/*indefinitions: */
  • issm/trunk/src/c/objects/NodeProperties.cpp

    r3420 r3451  
    3535}
    3636/*}}}*/
    37 /*FUNCTION NodeProperties init: used by constructor {{{1*/
     37/*FUNCTION NodeProperties Init: used by constructor {{{1*/
    3838void NodeProperties::Init(int nodeproperties_onbed, int nodeproperties_onsurface, int nodeproperties_onshelf, int nodeproperties_onsheet){
    3939
     
    4242        this->onshelf=nodeproperties_onshelf;
    4343        this->onsheet=nodeproperties_onsheet;
     44
     45}
     46/*}}}*/
     47/*FUNCTION NodeProperties Init from iomodel: used by constructor {{{1*/
     48void NodeProperties::Init(int i, IoModel* iomodel){ //i is the node index
     49
     50        if (iomodel->gridonbed)      this->onbed=(int)iomodel->gridonbed[i];
     51        if (iomodel->gridonsurface)  this->onsurface=(int)iomodel->gridonsurface[i];
     52        if (iomodel->gridoniceshelf) this->onshelf=(int)iomodel->gridoniceshelf[i];
     53        if (iomodel->gridonicesheet) this->onsheet=(int)iomodel->gridonicesheet[i];
    4454
    4555}
  • issm/trunk/src/c/objects/NodeProperties.h

    r3420 r3451  
    55#ifndef _NODEPROPERTIES_H_
    66#define  _NODEPROPERTIES_H_
     7
     8/*indefinitions: */
     9struct IoModel;
    710
    811class NodeProperties{
     
    1821                NodeProperties(int onbed, int onsurface, int onshelf, int onsheet);
    1922                void Init(int onbed, int onsurface, int onshelf, int onsheet);
     23                void Init(int i, IoModel* iomodel);
    2024                NodeProperties(NodeProperties* properties);
    2125                ~NodeProperties();
Note: See TracChangeset for help on using the changeset viewer.