Changeset 3984


Ignore:
Timestamp:
06/01/10 14:51:09 (15 years ago)
Author:
Eric.Larour
Message:

First attempt at fusioning all models together

Location:
issm/trunk
Files:
4 added
3 deleted
44 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/etc/environment_variables.sh

    r3676 r3984  
    77#MATLAB
    88MATLAB_DIR="$ISSM_DIR/externalpackages/matlab/install"
    9 MATLAB_VERSION=
     9MATLAB_VERSION=R2008a
    1010
    1111#MPI
  • issm/trunk/externalpackages/matlab/install.sh

    r3700 r3984  
    88
    99# MAC symlink matlab to root matlab
    10 #ln -s /Applications/MATLAB_R2008a/ install
     10ln -s /Applications/MATLAB_R2008a/ install
    1111#export MATLAB_VERSION=R2008a
    1212# LINUX symlink matlab to root matlab
    13 ln -s /usr/local/pkgs/matlab-7.6/ install
     13#ln -s /usr/local/pkgs/matlab-7.6/ install
    1414
    1515
    1616#initialize MATLAB_VERSION in etc/environment_variables
    17 cat $ISSM_DIR/etc/environment_variables.sh | sed -e "/MATLAB_VERSION/d" | sed "/^MATLAB_DIR.*$/a\MATLAB_VERSION=$MATLAB_VERSION" >  $ISSM_DIR/etc/environment_variables.sh.bak
    18 mv $ISSM_DIR/etc/environment_variables.sh.bak $ISSM_DIR/etc/environment_variables.sh
    19 cat $ISSM_DIR/etc/environment_variables.csh | sed -e "/MATLAB_VERSION/d" | sed "/^set MATLAB_DIR.*$/a\set MATLAB_VERSION=$MATLAB_VERSION" >  $ISSM_DIR/etc/environment_variables.csh.bak
    20 mv $ISSM_DIR/etc/environment_variables.csh.bak $ISSM_DIR/etc/environment_variables.csh
     17#cat $ISSM_DIR/etc/environment_variables.sh | sed -e "/MATLAB_VERSION/d" | sed "/^MATLAB_DIR.*$/a\MATLAB_VERSION=$MATLAB_VERSION" >  $ISSM_DIR/etc/environment_variables.sh.bak
     18#mv $ISSM_DIR/etc/environment_variables.sh.bak $ISSM_DIR/etc/environment_variables.sh
     19#cat $ISSM_DIR/etc/environment_variables.csh | sed -e "/MATLAB_VERSION/d" | sed "/^set MATLAB_DIR.*$/a\set MATLAB_VERSION=$MATLAB_VERSION" >  $ISSM_DIR/etc/environment_variables.csh.bak
     20#mv $ISSM_DIR/etc/environment_variables.csh.bak $ISSM_DIR/etc/environment_variables.csh
  • issm/trunk/externalpackages/metis/configs/macosx64/Makefile.in.patch

    r3318 r3984  
    88< OPTFLAGS = -DLINUX
    99---
    10 > OPTFLAGS = -O2
     10> OPTFLAGS = -O2  -m64
  • issm/trunk/externalpackages/triangle/configs/macosx64/configure.make

    r3319 r3984  
    1 CC=gcc
     1CC=gcc -m64
    22CSWITCHES = $(CFLAGS)  -I/usr/X11R6/include -L/usr/X11R6/lib -I$(MATLAB_DIR)/extern/include -fPIC -I$(MATLAB_DIR)/include
    33TRILIBDEFS = -DTRILIBRARY
  • issm/trunk/m4/matlab.m4

    r3754 r3984  
    312312    MATLAB_MINOR=`echo $MATLAB_VERSION | sed -e 's/^@<:@0-9@:>@*\.\(@<:@0-9@:>@*\).*/\1/'`
    313313    ;;
     314        R2010a)
     315        MATLAB_VERSION=R2010a
     316    MATLAB_MAJOR=7
     317    MATLAB_MINOR=8
     318        ;;
     319
    314320  R2009a)
    315321        MATLAB_VERSION=R2009a
  • issm/trunk/src/c/Makefile.am

    r3982 r3984  
    298298                                        ./EnumDefinitions/StringAsEnum.cpp\
    299299                                        ./modules/ModelProcessorx/ModelProcessorx.h\
     300                                        ./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
     301                                        ./modules/ModelProcessorx/NodesPartitioning.cpp
    300302                                        ./modules/ModelProcessorx/Partitioning.cpp\
    301303                                        ./modules/ModelProcessorx/CreateDataSets.cpp\
     
    748750                                        ./EnumDefinitions/StringAsEnum.cpp\
    749751                                        ./modules/ModelProcessorx/ModelProcessorx.h\
     752                                        ./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
     753                                        ./modules/ModelProcessorx/NodesPartitioning.cpp
    750754                                        ./modules/ModelProcessorx/Partitioning.cpp\
    751755                                        ./modules/ModelProcessorx/CreateDataSets.cpp\
  • issm/trunk/src/c/modules/ModelProcessorx/Balancedthickness/CreateElementsNodesAndMaterialsBalancedthickness.cpp

    r3913 r3984  
    3434
    3535        /*2d mesh: */
    36         if (strcmp(iomodel->meshtype,"2d")==0){
     36        if (iomodel->dim==2){
    3737
    3838                /*Fetch data needed: */
     
    7575
    7676        }
    77         else{ //        if (strcmp(meshtype,"2d")==0)
     77        else{ //        if (dim==2)
    7878
    7979                /*Fetch data needed: */
     
    122122
    123123
    124         } //if (strcmp(meshtype,"2d")==0)
     124        } //if (dim==2)
    125125
    126126        /*Add new constrant material property to materials, at the end: */
     
    128128
    129129        /*First fetch data: */
    130         if (strcmp(iomodel->meshtype,"3d")==0){
     130        if (iomodel->dim==3){
    131131                IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids");
    132132                IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids");
  • issm/trunk/src/c/modules/ModelProcessorx/Balancedthickness2/CreateElementsNodesAndMaterialsBalancedthickness2.cpp

    r3913 r3984  
    3737        /*elements created vary if we are dealing with a 2d mesh, or a 3d mesh: */
    3838        /*2d mesh: */
    39         if (strcmp(iomodel->meshtype,"2d")==0){
     39        if (iomodel->dim==2){
    4040
    4141                /*Fetch data needed: */
     
    7777
    7878        }
    79         else{ //        if (strcmp(meshtype,"2d")==0)
     79        else{ //        if (dim==2)
    8080                ISSMERROR("not implemented yet");
    81         } //if (strcmp(meshtype,"2d")==0)
     81        } //if (dim==2)
    8282
    8383        /*Add new constrant material property tgo materials, at the end: */
     
    9595        IoModelFetchData(&iomodel->gridonicesheet,NULL,NULL,iomodel_handle,"gridonicesheet");
    9696        IoModelFetchData(&iomodel->gridoniceshelf,NULL,NULL,iomodel_handle,"gridoniceshelf");
    97         if (strcmp(iomodel->meshtype,"3d")==0){
     97        if (iomodel->dim==3){
    9898                IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids");
    9999                IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids");
  • issm/trunk/src/c/modules/ModelProcessorx/Balancedvelocities/CreateElementsNodesAndMaterialsBalancedvelocities.cpp

    r3913 r3984  
    3434
    3535        /*2d mesh: */
    36         if (strcmp(iomodel->meshtype,"2d")==0){
     36        if (iomodel->dim==2){
    3737
    3838                /*Fetch data needed: */
     
    7575
    7676        }
    77         else{ //        if (strcmp(meshtype,"2d")==0)
     77        else{ //        if (dim==2)
    7878
    7979                /*Fetch data needed: */
     
    122122
    123123
    124         } //if (strcmp(meshtype,"2d")==0)
     124        } //if (dim==2)
    125125
    126126        /*Add new constrant material property to materials, at the end: */
     
    128128               
    129129        /*First fetch data: */
    130         if (strcmp(iomodel->meshtype,"3d")==0){
     130        if (iomodel->dim==3){
    131131                IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids");
    132132                IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids");
  • issm/trunk/src/c/modules/ModelProcessorx/CreateDataSets.cpp

    r3982 r3984  
    1616
    1717
    18 void CreateDataSets(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle,int analysis_type){
     18void CreateDataSets(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle,int analysis_type,int nummodels,int analysis_counter){
    1919
    20         /*First, partition elements and vertices. Nodes will partitioned on a per analysis_type basis: */
    21         VerticesPartitioning(&iomodel->my_elements, &iomodel->my_vertices, &iomodel->my_bordervertices, iomodel, iomodel_handle);
     20        bool continuous=true;
     21        DataSet* elements=NULL;
     22                       
     23        /*Create elements, vertices and materials, independent of analysis_type: */
     24        CreateElementsVerticesAndMaterials(pelements, pvertices, pmaterials, iomodel,iomodel_handle,nummodels);
    2225
    23         /*create parameters common to all solutions: */
     26        /*Recover elements, for future update: */
     27        elements=*pelements;
     28
     29        /*Now, branch onto analysis dependent model generation: */
     30        switch(analysis_type){
     31                case  DiagnosticHorizAnalysisEnum:
     32                        CreateNodesDiagnosticHoriz(pnodes, iomodel,iomodel_handle);
     33                        CreateConstraintsDiagnosticHoriz(pconstraints,iomodel,iomodel_handle);
     34                        CreateLoadsDiagnosticHoriz(ploads,iomodel,iomodel_handle);
     35                        UpdateElementsDiagnosticHoriz(elements,iomodel,iomodel_handle,analysis_counter);
     36                        break;
     37               
     38                case  DiagnosticVertAnalysisEnum:
     39                        CreateNodesDiagnosticVert(pnodes, iomodel,iomodel_handle);
     40                        CreateConstraintsDiagnosticVert(pconstraints,iomodel,iomodel_handle);
     41                        CreateLoadsDiagnosticVert(ploads,iomodel,iomodel_handle);
     42                        UpdateElementsDiagnosticVert(elements,iomodel,iomodel_handle,analysis_counter);
     43                        break;
     44       
     45                case DiagnosticStokesAnalysisEnum:
     46                        CreateNodesDiagnosticStokes(pnodes, iomodel,iomodel_handle);
     47                        CreateConstraintsDiagnosticStokes(pconstraints,iomodel,iomodel_handle);
     48                        CreateLoadsDiagnosticStokes(ploads,iomodel,iomodel_handle);
     49                        UpdateElementsDiagnosticStokes(elements,iomodel,iomodel_handle,analysis_counter);
     50                        break;
     51       
     52                case DiagnosticHutterAnalysisEnum:
     53                        CreateNodesDiagnosticHutter(pnodes, iomodel,iomodel_handle);
     54                        CreateConstraintsDiagnosticHutter(pconstraints,iomodel,iomodel_handle);
     55                        CreateLoadsDiagnosticHutter(ploads,iomodel,iomodel_handle);
     56                        UpdateElementsDiagnosticHutter(elements,iomodel,iomodel_handle,analysis_counter);
     57                        break;
     58
     59                case SlopecomputeAnalysisEnum:
     60                        CreateNodesSlopeCompute(pnodes, iomodel,iomodel_handle);
     61                        CreateConstraintsSlopeCompute(pconstraints,iomodel,iomodel_handle);
     62                        CreateLoadsSlopeCompute(ploads,iomodel,iomodel_handle);
     63                        UpdateElementsSlopeCompute(elements,iomodel,iomodel_handle,analysis_counter);
     64                        break;
     65
     66                case ThermalAnalysisEnum:
     67                        CreateNodesThermal(pnodes, iomodel,iomodel_handle);
     68                        CreateConstraintsThermal(pconstraints,iomodel,iomodel_handle);
     69                        CreateLoadsThermal(ploads,iomodel,iomodel_handle);
     70                        UpdateElementsThermal(elements,iomodel,iomodel_handle,analysis_counter);
     71                        break;
     72
     73                case MeltingAnalysisEnum:
     74                        CreateNodesMelting(pnodes, iomodel,iomodel_handle);
     75                        CreateConstraintsMelting(pconstraints,iomodel,iomodel_handle);
     76                        CreateLoadsMelting(ploads,iomodel,iomodel_handle);
     77                        UpdateElementsMelting(elements,iomodel,iomodel_handle,analysis_counter);
     78                        break;
     79
     80                case PrognosticAnalysisEnum:
     81                        CreateNodesPrognostic(pnodes, iomodel,iomodel_handle);
     82                        CreateConstraintsPrognostic(pconstraints,iomodel,iomodel_handle);
     83                        CreateLoadsPrognostic(ploads,iomodel,iomodel_handle);
     84                        UpdateElementsPrognostic(elements,iomodel,iomodel_handle,analysis_counter);
     85                        break;
     86
     87                case Prognostic2AnalysisEnum:
     88                        CreateNodesPrognostic2(pnodes, iomodel,iomodel_handle);
     89                        CreateConstraintsPrognostic2(pconstraints,iomodel,iomodel_handle);
     90                        CreateLoadsPrognostic2(ploads,iomodel,iomodel_handle);
     91                        UpdateElementsPrognostic2(elements,iomodel,iomodel_handle,analysis_counter);
     92                        break;
     93
     94                case BalancedthicknessAnalysisEnum:
     95                        CreateNodesBalancedthickness(pnodes, iomodel,iomodel_handle);
     96                        CreateConstraintsBalancedthickness(pconstraints,iomodel,iomodel_handle);
     97                        CreateLoadsBalancedthickness(ploads,iomodel,iomodel_handle);
     98                        UpdateElementsBalancedthickness(elements,iomodel,iomodel_handle,analysis_counter);
     99                        break;
     100
     101                case Balancedthickness2AnalysisEnum:
     102                        CreateNodesBalancedthickness2(pnodes, iomodel,iomodel_handle);
     103                        CreateConstraintsBalancedthickness2(pconstraints,iomodel,iomodel_handle);
     104                        CreateLoadsBalancedthickness2(ploads,iomodel,iomodel_handle);
     105                        UpdateElementsBalancedthickness2(elements,iomodel,iomodel_handle,analysis_counter);
     106                        break;
     107                case BalancedvelocitiesAnalysisEnum:
     108                        CreateNodesBalancedvelocities(pnodes, iomodel,iomodel_handle);
     109                        CreateConstraintsBalancedvelocities(pconstraints,iomodel,iomodel_handle);
     110                        CreateLoadsBalancedvelocities(ploads,iomodel,iomodel_handle);
     111                        UpdateElementsBalancedvelocities(elements,iomodel,iomodel_handle,analysis_counter);
     112                        break;
     113                default:
     114                        ISSMERROR("%s%s%s"," analysis_type: ",EnumAsString(analysis_type)," not supported yet!");
     115        }
     116       
     117        /*Generate objects that are not dependent on any analysis_type: */
    24118        CreateParameters(pparameters,iomodel,iomodel_handle);
    25        
    26119        CreateParametersControl(pparameters,iomodel,iomodel_handle);
    27 
    28         /*This is just a high level driver: */
    29         if (analysis_type==DiagnosticHorizAnalysisEnum){
    30                 CreateElementsNodesAndMaterialsDiagnosticHoriz(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
    31                 CreateConstraintsDiagnosticHoriz(pconstraints,iomodel,iomodel_handle);
    32                 CreateLoadsDiagnosticHoriz(ploads,iomodel,iomodel_handle);
    33         }
    34         else if (analysis_type==DiagnosticVertAnalysisEnum){
    35 
    36                 CreateElementsNodesAndMaterialsDiagnosticVert(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
    37                 CreateConstraintsDiagnosticVert(pconstraints,iomodel,iomodel_handle);
    38                 CreateLoadsDiagnosticVert(ploads,iomodel,iomodel_handle);
    39         }
    40         else if (analysis_type==DiagnosticStokesAnalysisEnum){
    41 
    42                 CreateElementsNodesAndMaterialsDiagnosticStokes(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
    43                 CreateConstraintsDiagnosticStokes(pconstraints,iomodel,iomodel_handle);
    44                 CreateLoadsDiagnosticStokes(ploads,iomodel,iomodel_handle);
    45         }
    46         else if (analysis_type==DiagnosticHutterAnalysisEnum){
    47 
    48                 CreateElementsNodesAndMaterialsDiagnosticHutter(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    49                 CreateConstraintsDiagnosticHutter(pconstraints,iomodel,iomodel_handle);
    50                 CreateLoadsDiagnosticHutter(ploads,iomodel,iomodel_handle);
    51         }
    52         else if (analysis_type==SlopecomputeAnalysisEnum){
    53 
    54                 CreateElementsNodesAndMaterialsSlopeCompute(pelements,pnodes, pvertices,pmaterials, iomodel,iomodel_handle);
    55                 CreateConstraintsSlopeCompute(pconstraints,iomodel,iomodel_handle);
    56                 CreateLoadsSlopeCompute(ploads,iomodel,iomodel_handle);
    57         }
    58         else if (analysis_type==ThermalAnalysisEnum){
    59 
    60                 CreateElementsNodesAndMaterialsThermal(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    61                 CreateConstraintsThermal(pconstraints,iomodel,iomodel_handle);
    62                 CreateLoadsThermal(ploads,iomodel,iomodel_handle);
    63 
    64         }
    65         else if (analysis_type==MeltingAnalysisEnum){
    66 
    67                 CreateElementsNodesAndMaterialsMelting(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    68                 CreateConstraintsMelting(pconstraints,iomodel,iomodel_handle);
    69                 CreateLoadsMelting(ploads,iomodel,iomodel_handle);
    70         }
    71         else if (analysis_type==PrognosticAnalysisEnum){
    72 
    73                 CreateElementsNodesAndMaterialsPrognostic(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    74                 CreateConstraintsPrognostic(pconstraints,iomodel,iomodel_handle);
    75                 CreateLoadsPrognostic(ploads,iomodel,iomodel_handle);
    76         }
    77         else if (analysis_type==Prognostic2AnalysisEnum){
    78 
    79                 CreateElementsNodesAndMaterialsPrognostic2(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    80                 CreateConstraintsPrognostic2(pconstraints,iomodel,iomodel_handle);
    81                 CreateLoadsPrognostic2(ploads,iomodel,iomodel_handle);
    82         }
    83         else if (analysis_type==BalancedthicknessAnalysisEnum){
    84 
    85                 CreateElementsNodesAndMaterialsBalancedthickness(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    86                 CreateConstraintsBalancedthickness(pconstraints,iomodel,iomodel_handle);
    87                 CreateLoadsBalancedthickness(ploads,iomodel,iomodel_handle);
    88         }
    89         else if (analysis_type==Balancedthickness2AnalysisEnum){
    90 
    91                 CreateElementsNodesAndMaterialsBalancedthickness2(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    92                 CreateConstraintsBalancedthickness2(pconstraints,iomodel,iomodel_handle);
    93                 CreateLoadsBalancedthickness2(ploads,iomodel,iomodel_handle);
    94         }
    95         else if (analysis_type==BalancedvelocitiesAnalysisEnum){
    96 
    97                 CreateElementsNodesAndMaterialsBalancedvelocities(pelements,pnodes,pvertices,pmaterials, iomodel,iomodel_handle);
    98                 CreateConstraintsBalancedvelocities(pconstraints,iomodel,iomodel_handle);
    99                 CreateLoadsBalancedvelocities(ploads,iomodel,iomodel_handle);
    100         }
    101         else{
    102                 ISSMERROR("%s%i%s%i%s"," analysis_type: ",analysis_type," analysis_type: ",analysis_type," not supported yet!");
    103 
    104         }
    105120        CreateParametersQmu(pparameters,iomodel,iomodel_handle);
    106 
    107121}
  • issm/trunk/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp

    r3931 r3984  
    3333
    3434        /*Get element width (3 or 6)*/
    35         if (strcmp(iomodel->meshtype,"2d")==0){
     35        if (iomodel->dim==2){
    3636                elementswidth=3;
    3737        }
  • issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp

    r3913 r3984  
    2828        parameters = new Parameters(ParametersEnum);
    2929
    30         if (strcmp(iomodel->meshtype,"2d")==0) parameters->AddObject(new IntParam(DimEnum,2));
     30        if (iomodel->dim==2) parameters->AddObject(new IntParam(DimEnum,2));
    3131        else parameters->AddObject(new IntParam(DimEnum,3));
    3232        parameters->AddObject(new    IntParam(AnalysisTypeEnum,iomodel->analysis_type));
  • issm/trunk/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp

    r3913 r3984  
    3434
    3535        /*Get element width (3 or 6)*/
    36         if (strcmp(iomodel->meshtype,"2d")==0){
     36        if (iomodel->dim==2){
    3737                elementswidth=3;
    3838        }
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp

    r3913 r3984  
    3939               
    4040                /*Retrieve element to which this icefront belongs: */
    41                 if (strcmp(iomodel->meshtype,"2d")==0) segment_width=4;
     41                if (iomodel->dim==2) segment_width=4;
    4242                else segment_width=6;
    4343                element=(int)(*(iomodel->pressureload+segment_width*i+segment_width-2)-1); //element is in the penultimate column (grid1 grid2 ... elem fill)
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateElementsNodesAndMaterialsDiagnosticHutter.cpp

    r3947 r3984  
    5959
    6060        /*2d mesh: */
    61         if (strcmp(iomodel->meshtype,"2d")==0){
     61        if (iomodel->dim==2){
    6262
    6363                for (i=0;i<iomodel->numberofelements;i++){
     
    7575                        }
    7676                } //for (i=0;i<iomodel->numberofvertices;i++)
    77         } //if (strcmp(iomodel->meshtype,"2d")==0)
     77        } //if (iomodel->dim==2)
    7878        else{
    7979
     
    9696                } //for (i=0;i<iomodel->numberofelements;i++)
    9797
    98         } //if (strcmp(iomodel->meshtype,"2d")==0)
     98        } //if (iomodel->dim==2)
    9999       
    100100        /*Free data: */
     
    117117
    118118        /*Add new constrant material property to materials, at the end: */
    119         if (strcmp(iomodel->meshtype,"2d")==0){
     119        if (iomodel->dim==2){
    120120                materials->AddObject(new Matpar(iomodel->numberofelements+1,iomodel));                          //put it at the end of the materials
    121121        }
     
    125125               
    126126        /*First fetch data: */
    127         if (strcmp(iomodel->meshtype,"3d")==0){
     127        if (iomodel->dim==3){
    128128                IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids");
    129129                IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids");
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticStokes/CreateElementsNodesAndMaterialsDiagnosticStokes.cpp

    r3913 r3984  
    3131
    3232        /*Now, do we have Stokes elements?*/
    33         if (strcmp(iomodel->meshtype,"2d")==0) goto cleanup_and_return;
     33        if (iomodel->dim==2) goto cleanup_and_return;
    3434        if (!iomodel->isstokes)                goto cleanup_and_return;
    3535
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp

    r3913 r3984  
    2121
    2222        /*return if 2d mesh*/
    23         if (strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;
     23        if (iomodel->dim==2)goto cleanup_and_return;
    2424
    2525        /*Fetch data: */
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp

    r3913 r3984  
    3131
    3232        /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */
    33         if (strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;
     33        if (iomodel->dim==2)goto cleanup_and_return;
    3434
    3535        /*Partition elements and vertices and nodes: */
  • issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateElementsNodesAndMaterialsMelting.cpp

    r3913 r3984  
    9292
    9393        /*First fetch data: */
    94         if (strcmp(iomodel->meshtype,"3d")==0){
     94        if (iomodel->dim==3){
    9595                IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids");
    9696                IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids");
  • issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp

    r3913 r3984  
    1818
    1919        /*if 2d: return*/
    20         if (strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;
     20        if (iomodel->dim==2)goto cleanup_and_return;
    2121
    2222        /*Create loads: */
  • issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.h

    r3982 r3984  
    1313#include "../../io/io.h"
    1414
     15/*Creation of fem datasets: general drivers*/
     16void    CreateDataSets(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle,int analysis_type,int nummodels,int analysis_counter);
     17void    CreateElementsVerticesAndMaterials(DataSet** pelements,DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle,int nummodels);
     18void    CreateParameters(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
     19void    CreateParametersControl(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
     20void    CreateParametersQmu(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
    1521
    16 /*Creation of fem datasets: general drivers*/
    17 void  CreateDataSets(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle,int analysis_type);
    18 void  CreateParameters(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
    19 
    20 /*Create of fem datasets: specialised drivers: */
     22/*Creation of fem datasets: specialised drivers: */
    2123
    2224/*diagnostic horizontal*/
    23 void    CreateElementsNodesAndMaterialsDiagnosticHoriz(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     25void    CreateNodesDiagnosticHoriz(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    2426void    CreateConstraintsDiagnosticHoriz(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    25 void  CreateLoadsDiagnosticHoriz(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     27void    CreateLoadsDiagnosticHoriz(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     28void    UpdateElementsDiagnosticHoriz(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    2629
    2730/*diagnostic vertical*/
    28 void    CreateElementsNodesAndMaterialsDiagnosticVert(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     31void    CreateNodesDiagnosticVert(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    2932void    CreateConstraintsDiagnosticVert(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    30 void  CreateLoadsDiagnosticVert(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     33void    CreateLoadsDiagnosticVert(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     34void    UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    3135
    3236/*diagnostic hutter*/
    33 void    CreateElementsNodesAndMaterialsDiagnosticHutter(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     37void    CreateNodesDiagnosticHutter(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    3438void    CreateConstraintsDiagnosticHutter(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    35 void  CreateLoadsDiagnosticHutter(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     39void    CreateLoadsDiagnosticHutter(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     40void    UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    3641
    3742/*diagnostic stokes*/
    38 void    CreateElementsNodesAndMaterialsDiagnosticStokes(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     43void    CreateNodesDiagnosticStokes(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    3944void    CreateConstraintsDiagnosticStokes(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    40 void  CreateLoadsDiagnosticStokes(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     45void    CreateLoadsDiagnosticStokes(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     46void    UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    4147
    4248/*slope compute*/
    43 void    CreateElementsNodesAndMaterialsSlopeCompute(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     49void    CreateNodesSlopeCompute(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    4450void    CreateConstraintsSlopeCompute(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    45 void  CreateLoadsSlopeCompute(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
    46 
    47 /*control:*/
    48 void  CreateParametersControl(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
     51void    CreateLoadsSlopeCompute(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     52void    UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    4953
    5054/*thermal:*/
    51 void    CreateElementsNodesAndMaterialsThermal(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     55void    CreateNodesThermal(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    5256void    CreateConstraintsThermal(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    53 void  CreateLoadsThermal(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     57void    CreateLoadsThermal(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     58void    UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    5459
    5560/*melting:*/
    56 void    CreateElementsNodesAndMaterialsMelting(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     61void    CreateNodesMelting(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    5762void    CreateConstraintsMelting(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    58 void  CreateLoadsMelting(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     63void    CreateLoadsMelting(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     64void    UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    5965
    6066/*prognostic:*/
    61 void    CreateElementsNodesAndMaterialsPrognostic(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     67void    CreateNodesPrognostic(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    6268void    CreateConstraintsPrognostic(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    63 void  CreateLoadsPrognostic(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     69void    CreateLoadsPrognostic(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     70void    UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    6471
    6572/*prognostic2:*/
    66 void    CreateElementsNodesAndMaterialsPrognostic2(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     73void    CreateNodesPrognostic2(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    6774void    CreateConstraintsPrognostic2(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    68 void  CreateLoadsPrognostic2(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     75void    CreateLoadsPrognostic2(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     76void    UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    6977
    7078/*balancedthickness:*/
    71 void    CreateElementsNodesAndMaterialsBalancedthickness(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     79void    CreateNodesBalancedthickness(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    7280void    CreateConstraintsBalancedthickness(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    73 void  CreateLoadsBalancedthickness(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     81void    CreateLoadsBalancedthickness(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     82void    UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    7483
    75 void    CreateElementsNodesAndMaterialsBalancedthickness2(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     84void    CreateNodesBalancedthickness2(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    7685void    CreateConstraintsBalancedthickness2(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    77 void  CreateLoadsBalancedthickness2(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
    78 
     86void    CreateLoadsBalancedthickness2(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     87void    UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    7988
    8089/*balancedvelocities:*/
    81 void    CreateElementsNodesAndMaterialsBalancedvelocities(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     90void    CreateNodesBalancedvelocities(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    8291void    CreateConstraintsBalancedvelocities(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    83 void  CreateLoadsBalancedvelocities(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
    84 
    85 /*qmu: */
    86 void CreateParametersQmu(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
     92void    CreateLoadsBalancedvelocities(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     93void    UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle);
    8794
    8895/*partitioning: */
    89 void  VerticesPartitioning(bool** pmy_elements, bool** pmy_vertices, bool** pmy_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle);
    90 void  NodesPartitioning(bool** pmy_nodes,bool* my_elements, bool* my_vertices, bool* my_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle,bool continuous);
     96void    ElementsAndVerticesPartitioning(bool** pmy_elements, bool** pmy_vertices, bool** pmy_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle);
     97void    NodesPartitioning(bool** pmy_nodes,bool* my_elements, bool* my_vertices, bool* my_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle,bool continuous);
    9198
    92 /*Conectivity*/
    93 void CreateSingleNodeToElementConnectivity(IoModel* iomodel);
    94 void CreateNumberNodeToElementConnectivity(IoModel* iomodel);
     99/*Connectivity*/
     100void    CreateSingleNodeToElementConnectivity(IoModel* iomodel);
     101void    CreateNumberNodeToElementConnectivity(IoModel* iomodel);
    95102
    96103#endif
  • issm/trunk/src/c/modules/ModelProcessorx/NodesPartitioning.cpp

    r3982 r3984  
    2323void  NodesPartitioning(bool** pmy_nodes,bool* my_elements, bool* my_vertices, bool* my_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle,bool continuous){
    2424       
     25        /*First thing, this is a new partition for a new analysis_type, therefore, to avoid a leak, erase the nodes partition that might come through pmy_nodes: */
     26        xfree((void**)pmy_nodes);
     27
     28        /*Now, depending on whether we are running galerkin discontinous or continuous elements, carry out a different partition of the nodes: */
    2529        if(continuous==true){
    2630                ContinuousGalerkinNodesPartitioning(pmy_nodes,my_elements, my_vertices, my_bordervertices, iomodel, iomodel_handle);
     
    7377
    7478        /*First: add all the nodes of all the elements belonging to this cpu*/
    75         if (strcmp(iomodel->meshtype,"2d")==0){
     79        if (iomodel->dim==2){
    7680                for (i=0;i<iomodel->numberofelements;i++){
    7781                        if (my_elements[i]){
  • issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateElementsNodesAndMaterialsPrognostic.cpp

    r3913 r3984  
    3434
    3535        /*2d mesh: */
    36         if (strcmp(iomodel->meshtype,"2d")==0){
     36        if (iomodel->dim==2){
    3737
    3838                /*Fetch data needed: */
     
    7474
    7575        }
    76         else{ //        if (strcmp(meshtype,"2d")==0)
     76        else{ //        if (dim==2)
    7777
    7878                /*Fetch data needed: */
     
    123123
    124124
    125         } //if (strcmp(meshtype,"2d")==0)
     125        } //if (dim==2)
    126126
    127127        /*Add new constrant material property to materials, at the end: */
     
    129129
    130130        /*First fetch data: */
    131         if (strcmp(iomodel->meshtype,"3d")==0){
     131        if (iomodel->dim==3){
    132132                IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids");
    133133                IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids");
  • issm/trunk/src/c/modules/ModelProcessorx/Prognostic2/CreateElementsNodesAndMaterialsPrognostic2.cpp

    r3913 r3984  
    3737        /*elements created vary if we are dealing with a 2d mesh, or a 3d mesh: */
    3838        /*2d mesh: */
    39         if (strcmp(iomodel->meshtype,"2d")==0){
     39        if (iomodel->dim==2){
    4040
    4141                /*Fetch data needed: */
     
    7575
    7676        }
    77         else{ //        if (strcmp(meshtype,"2d")==0)
     77        else{ //        if (dim==2)
    7878                ISSMERROR("not implemented yet");
    79         } //if (strcmp(meshtype,"2d")==0)
     79        } //if (dim==2)
    8080
    8181        /*Add new constrant material property tgo materials, at the end: */
     
    9393        IoModelFetchData(&iomodel->gridonicesheet,NULL,NULL,iomodel_handle,"gridonicesheet");
    9494        IoModelFetchData(&iomodel->gridoniceshelf,NULL,NULL,iomodel_handle,"gridoniceshelf");
    95         if (strcmp(iomodel->meshtype,"3d")==0){
     95        if (iomodel->dim==3){
    9696                IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids");
    9797                IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids");
  • issm/trunk/src/c/modules/ModelProcessorx/SlopeCompute/CreateElementsNodesAndMaterialsSlopeCompute.cpp

    r3913 r3984  
    3434
    3535        /*2d mesh: */
    36         if (strcmp(iomodel->meshtype,"2d")==0){
     36        if (iomodel->dim==2){
    3737
    3838                /*Fetch data needed: */
     
    6363
    6464        }
    65         else{ //        if (strcmp(meshtype,"2d")==0)
     65        else{ //        if (dim==2)
    6666
    6767                /*Fetch data needed: */
     
    9494                xfree((void**)&iomodel->lowerelements);
    9595
    96         } //if (strcmp(meshtype,"2d")==0)
     96        } //if (dim==2)
    9797
    9898        /*Add new constrant material property tgo materials, at the end: */
     
    100100       
    101101        /*First fetch data: */
    102         if (strcmp(iomodel->meshtype,"3d")==0){
     102        if (iomodel->dim==3){
    103103                IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids");
    104104                IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids");
  • issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp

    r3913 r3984  
    2323
    2424        /*return if 2d mesh*/
    25         if (strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;
     25        if (iomodel->dim==2)goto cleanup_and_return;
    2626
    2727        /*Fetch data: */
  • issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateElementsNodesAndMaterialsThermal.cpp

    r3955 r3984  
    9696       
    9797        /*Create nodes and vertices: */
    98         if (strcmp(iomodel->meshtype,"3d")==0){
     98        if (iomodel->dim==3){
    9999                IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids");
    100100                IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids");
  • issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp

    r3913 r3984  
    1919
    2020        /*return if 2d mesh*/
    21         if (strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;
     21        if (iomodel->dim==2)goto cleanup_and_return;
    2222
    2323        /*Create loads: */
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r3977 r3984  
    2727        this->matpar=NULL;
    2828        this->neighbors=NULL;
     29        this->collapse=NULL;
    2930       
    3031        this->inputs=NULL;
     
    3637        delete inputs;
    3738        this->parameters=NULL;
    38 }
    39 /*}}}*/
    40 /*FUNCTION Penta::Penta(int id, int index, IoModel* iomodel) {{{1*/
    41 Penta::Penta(int penta_id, int index, IoModel* iomodel){ //i is the element index
     39        xfree((void**)&collapse);
     40}
     41/*}}}*/
     42/*FUNCTION Penta::Penta(int id, int index, IoModel* iomodel,int nummodels) {{{1*/
     43Penta::Penta(int penta_id, int index, IoModel* iomodel,int nummodels){ //i is the element index
    4244
    4345        IssmInt i;
    44         int penta_node_ids[6];
    4546        int penta_matice_id;
    4647        int penta_matpar_id;
    4748        int penta_elements_ids[2];
    48         double nodeinputs[6];
    4949        bool collapse;
    5050
     
    5353
    5454        /*hooks: */
    55         ISSMASSERT(iomodel->elements);
    56         for(i=0;i<6;i++){ //go recover node ids, needed to initialize the node hook.
    57                 penta_node_ids[i]=(int)*(iomodel->elements+6*index+i); //ids for vertices are in the elements array from Matlab
    58         }
    5955        penta_matice_id=index+1; //refers to the corresponding ice material object
    6056        penta_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object
    6157
    62         ISSMASSERT(iomodel->upperelements);
    6358        if isnan(iomodel->upperelements[index]){
    6459                penta_elements_ids[0]=this->id; //upper penta is the same penta
     
    6762                penta_elements_ids[0]=(int)(iomodel->upperelements[index]);
    6863        }
    69         ISSMASSERT(iomodel->lowerelements);
     64       
    7065        if isnan(iomodel->lowerelements[index]){
    7166                penta_elements_ids[1]=this->id; //lower penta is the same penta
     
    7469                penta_elements_ids[1]=(int)(iomodel->lowerelements[index]);
    7570        }
    76         this->InitHookNodes(penta_node_ids); this->nodes=NULL;
     71        this->InitHookNodes(nummodels);this->nodes=NULL;
    7772        this->InitHookMatice(penta_matice_id);this->matice=NULL;
    7873        this->InitHookMatpar(penta_matpar_id);this->matpar=NULL;
    7974        this->InitHookNeighbors(penta_elements_ids);this->neighbors=NULL;
     75
     76        //this->parameters: we still can't point to it, it may not even exist. Configure will handle this.
     77        this->parameters=NULL;
     78
     79        //collpase flags
     80        collapse=(bool*)xcalloc(nummodels*sizeof(bool));
     81
     82}
     83/*}}}*/
     84/*FUNCTION Penta::Update(IoModel* iomodel,int analysis_counter) {{{1*/
     85Penta::Update(IoModel* iomodel,int analysis_counter){
     86
     87        IssmInt i;
     88        int penta_node_ids[6];
     89        double nodeinputs[6];
     90
     91        /*hooks: */
     92        for(i=0;i<6;i++){ //go recover node ids, needed to initialize the node hook.
     93                penta_node_ids[i]=(int)*(iomodel->elements+6*index+i); //ids for vertices are in the elements array from Matlab
     94        }
     95
     96        this->SettHookNodes(penta_node_ids,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type
    8097
    8198        //intialize inputs, and add as many inputs per element as requested:
     
    186203        if(iomodel->elements_type){
    187204                if (*(iomodel->elements_type+2*i+0)==MacAyealFormulationEnum){
    188                         collapse=1;
     205                        collapse[analysis_counter]=true;
    189206                }
    190207                else{
    191                         collapse=0;
     208                        collapse[analysis_counter]=false;
    192209                }
    193210        }
    194         this->inputs->AddInput(new BoolInput(CollapseEnum,(IssmBool)collapse));
    195 
    196211}
    197212/*}}}*/
     
    215230
    216231        /*now deal with hooks and objects: */
     232        penta->InitHookNodes(this->nummodels);
     233        for(i=0;i<this->nummodels;i++)penta->hnodes[i].copy(&this->hnodes[i]);
    217234        penta->hnodes.copy(&this->hnodes);
    218235        penta->hmatice.copy(&this->hmatice);
     
    221238
    222239        /*recover objects: */
    223         penta->nodes=(Node**)penta->hnodes.deliverp();
     240        penta->nodes=(Node**)xmalloc(6*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
     241        for(i=0;i<6;i++)penta->nodes[i]=this->nodes[i];
    224242        penta->matice=(Matice*)penta->hmatice.delivers();
    225243        penta->matpar=(Matpar*)penta->hmatpar.delivers();
     
    232250/*Object management: */
    233251/*FUNCTION Penta::Configure {{{1*/
    234 void  Penta::Configure(DataSet* elementsin, DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin){
     252void  Penta::Configure(DataSet* elementsin, DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin,int analysis_counter){
    235253
    236254        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    237255         * datasets, using internal ids and offsets hidden in hooks: */
    238         this->hnodes.configure(nodesin);
     256        this->hnodes[analysis_counter].configure(nodesin);
    239257        this->hmatice.configure(materialsin);
    240258        this->hmatpar.configure(materialsin);
     
    242260
    243261        /*Now, go pick up the objects inside the hooks: */
    244         this->nodes=(Node**)this->hnodes.deliverp();
     262        this->nodes=(Node**)this->hnodes[analysis_counter].deliverp();
    245263        this->matice=(Matice*)this->hmatice.delivers();
    246264        this->matpar=(Matpar*)this->hmatpar.delivers();
     
    264282
    265283        memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
     284        memcpy(&nummodels,marshalled_dataset,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);
     285
     286        /*allocate dynamic memory: */
     287        collapse=(bool*)xmalloc(nummodels*sizeof(bool));
     288        InitHookNodes(nummodels);
    266289
    267290        /*demarshall hooks: */
    268         hnodes.Demarshall(&marshalled_dataset);
     291        for(i=0;i<nummodels;i++)hnodes[i].Demarshall(&marshalled_dataset);
    269292        hmatice.Demarshall(&marshalled_dataset);
    270293        hmatpar.Demarshall(&marshalled_dataset);
    271294        hneighbors.Demarshall(&marshalled_dataset);
    272295
    273         /*pointers are garbabe, until configuration is carried out: */
     296        /*pointers are garbage, until configuration is carried out: */
    274297        nodes=NULL;
    275298        matice=NULL;
     
    280303        inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
    281304
     305        /*demarshall internal parameters: */
     306        memcpy(collapse,marshalled_dataset,nummodels*sizeof(bool));marshalled_dataset+=nummodels*sizeof(bool);
     307
    282308        /*parameters: may not exist even yet, so let Configure handle it: */
    283309        this->parameters=NULL;
     
    291317void Penta::DeepEcho(void){
    292318
     319        int i;
     320       
    293321        printf("Penta:\n");
    294322        printf("   id: %i\n",id);
     
    306334        printf("   inputs\n");
    307335        inputs->DeepEcho();
    308        
     336        printf("   collapse: \n   ");
     337        for(i=0;i<nummodels;i++)printf("%s|",value?"true":"false");
    309338        return;
    310339}
     
    323352}
    324353/*}}}*/
    325 /*FUNCTION Penta::IsInput{{{1*/
    326 bool Penta::IsInput(int name){
    327         if (name==ThicknessEnum ||
    328                                 name==SurfaceEnum ||
    329                                 name==BedEnum ||
    330                                 name==SurfaceSlopexEnum ||
    331                                 name==SurfaceSlopeyEnum ||
    332                                 name==MeltingRateEnum ||
    333                                 name==AccumulationRateEnum ||
    334                                 name==GeothermalFluxEnum ||
    335                                 name==PressureEnum ||
    336                                 name==VxEnum ||
    337                                 name==VyEnum ||
    338                                 name==VzEnum ||
    339                                 name==TemperatureEnum ||
    340                                 name==TemperatureAverageEnum ||
    341                                 name==RheologyBEnum ||
    342                                 name==RheologyNEnum) {
    343                 return true;
    344         }
    345         else return false;
    346 }
    347 /*}}}*/
    348 /*FUNCTION Penta::IsOnSurface{{{1*/
    349 bool Penta::IsOnSurface(void){
    350 
    351         bool onsurface;
    352         inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
    353         return onsurface;
    354 
    355 }
    356 /*}}}*/
    357 /*FUNCTION Penta::GetUpperElement{{{1*/
    358 Penta* Penta::GetUpperElement(void){
    359 
    360         Penta* upper_penta=NULL;
    361         upper_penta=(Penta*)neighbors[1]; //first one under, second one above
    362         return upper_penta;
    363 
    364 }
    365 /*}}}*/
    366354/*FUNCTION Penta::Marshall {{{1*/
    367355void  Penta::Marshall(char** pmarshalled_dataset){
    368356
     357        int   i;
    369358        char* marshalled_dataset=NULL;
    370359        int   enum_type=0;
     
    383372        /*marshall Penta data: */
    384373        memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
     374        memcpy(marshalled_dataset,&nummodels,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);
    385375
    386376        /*Marshall hooks: */
    387         hnodes.Marshall(&marshalled_dataset);
     377        for(i=0;i<nummodels;i++)hnodes[i].Marshall(&marshalled_dataset);
    388378        hmatice.Marshall(&marshalled_dataset);
    389379        hmatpar.Marshall(&marshalled_dataset);
     
    396386        marshalled_dataset+=marshalled_inputs_size;
    397387
     388        /*marshall internal parameters: */
     389        memcpy(marshalled_dataset,collapse,nummodels*sizeof(bool));marshalled_dataset+=nummodels*sizeof(bool);
     390
    398391        /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/
    399392
     
    406399/*FUNCTION Penta::MarshallSize {{{1*/
    407400int   Penta::MarshallSize(){
    408        
     401
     402        int i;
     403        int hnodes_size=0;;
     404
     405        for(i=0;i<nummodels;i++)hnodes_size+=hnodes[i].MarshallSize;
     406
    409407        return sizeof(id)
    410                 +hnodes.MarshallSize()
     408                +hnodes_size
    411409                +hmatice.MarshallSize()
    412410                +hmatpar.MarshallSize()
    413411                +hneighbors.MarshallSize()
    414412                +inputs->MarshallSize()
     413                +nummodels*sizeof(bool)
    415414                +sizeof(int); //sizeof(int) for enum type
    416415}
     
    423422        int indices[3];
    424423        int zero=0;
    425         Hook* tria_hnodes=NULL;
    426         Hook* tria_hmatice=NULL;
    427         Hook* tria_hmatpar=NULL;
    428424        Parameters* tria_parameters=NULL;
    429425        Inputs* tria_inputs=NULL;
     
    433429        indices[2]=g2;
    434430
    435         tria_hnodes =this->hnodes.Spawn(indices,3);
    436         tria_hmatice=this->hmatice.Spawn(&zero,1);
    437         tria_hmatpar=this->hmatpar.Spawn(&zero,1);
    438431        tria_parameters=this->parameters;
    439432        tria_inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices);
     
    444437        tria->parameters=tria_parameters;
    445438
    446         /*now deal with hooks and objects: */
    447         tria->hnodes.copy(tria_hnodes);
    448         tria->hmatice.copy(tria_hmatice);
    449         tria->hmatpar.copy(tria_hmatpar);
    450 
    451         /*recover objects: */
    452         tria->nodes=(Node**)tria->hnodes.deliverp();
    453         tria->matice=(Matice*)tria->hmatice.delivers();
    454         tria->matpar=(Matpar*)tria->hmatpar.delivers();
    455 
    456         delete tria_hnodes;
    457         delete tria_hmatice;
    458         delete tria_hmatpar;
     439        /*now deal with nodes, matice and matpar: */
     440        tria->nodes=(Node**)xmalloc(3*sizeof(Node*));
     441        for(i=0;i<3;i++)tria->nodes[i]=this->nodes[indices[i]];
     442        tria->matice=this->matice;
     443        tria->matpar=this->matpar;
    459444
    460445        return tria;
     
    468453        int indices[2];
    469454        int zero=0;
    470         Hook       *beam_hnodes     = NULL;
    471         Hook       *beam_hmatice    = NULL;
    472         Hook       *beam_hmatpar    = NULL;
    473455        Parameters *beam_parameters = NULL;
    474456        Inputs     *beam_inputs     = NULL;
     
    477459        indices[1]=g1;
    478460
    479         beam_hnodes =this->hnodes.Spawn(indices,2);
    480         beam_hmatice=this->hmatice.Spawn(&zero,1);
    481         beam_hmatpar=this->hmatpar.Spawn(&zero,1);
    482461        beam_parameters=this->parameters;
    483462        beam_inputs=(Inputs*)this->inputs->SpawnBeamInputs(indices);
     
    488467        beam->parameters=beam_parameters;
    489468
    490         /*now deal with hooks and objects: */
    491         beam->hnodes.copy(beam_hnodes);
    492         beam->hmatice.copy(beam_hmatice);
    493         beam->hmatpar.copy(beam_hmatpar);
    494 
    495         /*recover objects: */
    496         //beam->nodes=(Node**)beam->hnodes.deliverp();
    497         //beam->matice=(Matice*)beam->hmatice.delivers();
    498         //beam->matpar=(Matpar*)beam->hmatpar.delivers();
    499 
    500         delete beam_hnodes;
    501         delete beam_hmatice;
    502         delete beam_hmatpar;
     469        /*now deal with ndoes,matice and matpar: */
     470        beam->nodes=(Node**)xmalloc(2*sizeof(Node*));
     471        for(i=0;i<2;i++)beam->nodes[i]=this->nodes[indices[i]];
     472        beam->matice=this->matice;
     473        beam->matpar=this->matpar;
    503474
    504475        return beam;
     
    510481        Sing* sing=NULL;
    511482        int zero=0;
    512         Hook       *sing_hnodes     = NULL;
    513         Hook       *sing_hmatice    = NULL;
    514         Hook       *sing_hmatpar    = NULL;
    515483        Parameters *sing_parameters = NULL;
    516484        Inputs     *sing_inputs     = NULL;
    517485
    518         sing_hnodes =this->hnodes.Spawn(&index,1);
    519         sing_hmatice=this->hmatice.Spawn(&zero,1);
    520         sing_hmatpar=this->hmatpar.Spawn(&zero,1);
    521486        sing_parameters=this->parameters;
    522487        sing_inputs=(Inputs*)this->inputs->SpawnSingInputs(index);
     
    527492        sing->parameters=sing_parameters;
    528493
    529         /*now deal with hooks and objects: */
    530         sing->hnodes.copy(sing_hnodes);
    531         sing->hmatice.copy(sing_hmatice);
    532         sing->hmatpar.copy(sing_hmatpar);
    533 
    534         /*recover objects: */
    535         //sing->nodes=(Node**)sing->hnodes.deliverp();
    536         //sing->matice=(Matice*)sing->hmatice.delivers();
    537         //sing->matpar=(Matpar*)sing->hmatpar.delivers();
    538 
    539         delete sing_hnodes;
    540         delete sing_hmatice;
    541         delete sing_hmatpar;
    542 
     494        /*now deal with nodes,matice and matpar: */
     495        sing->node=this->nodes[index];
     496        sing->matice=this->matice;
     497        sing->matpar=this->matpar;
     498       
    543499        return sing;
    544500}
     
    840796
    841797/*Object functions*/
     798/*FUNCTION Penta::IsInput{{{1*/
     799bool Penta::IsInput(int name){
     800        if (name==ThicknessEnum ||
     801                                name==SurfaceEnum ||
     802                                name==BedEnum ||
     803                                name==SurfaceSlopexEnum ||
     804                                name==SurfaceSlopeyEnum ||
     805                                name==MeltingRateEnum ||
     806                                name==AccumulationRateEnum ||
     807                                name==GeothermalFluxEnum ||
     808                                name==PressureEnum ||
     809                                name==VxEnum ||
     810                                name==VyEnum ||
     811                                name==VzEnum ||
     812                                name==TemperatureEnum ||
     813                                name==TemperatureAverageEnum ||
     814                                name==RheologyBEnum ||
     815                                name==RheologyNEnum) {
     816                return true;
     817        }
     818        else return false;
     819}
     820/*}}}*/
     821/*FUNCTION Penta::IsOnSurface{{{1*/
     822bool Penta::IsOnSurface(void){
     823
     824        bool onsurface;
     825        inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
     826        return onsurface;
     827
     828}
     829/*}}}*/
     830/*FUNCTION Penta::GetUpperElement{{{1*/
     831Penta* Penta::GetUpperElement(void){
     832
     833        Penta* upper_penta=NULL;
     834        upper_penta=(Penta*)neighbors[1]; //first one under, second one above
     835        return upper_penta;
     836
     837}
     838/*}}}*/
    842839/*FUNCTION Penta::ComputeBasalStress {{{1*/
    843840void  Penta::ComputeBasalStress(Vec sigma_b,int analysis_type,int sub_analysis_type){
  • issm/trunk/src/c/objects/Elements/Penta.h

    r3956 r3984  
    3737                Inputs      *inputs;
    3838
     39                /*internal parameters: */
     40                bool        *collapse; //collapse elements, depending on analysis_type
     41
    3942                /*FUNCTION constructors, destructors {{{1*/
    4043                Penta();
    41                 Penta(int penta_id,int i, IoModel* iomodel);
     44                Penta(int penta_id,int i, IoModel* iomodel,int nummodels);
     45                Update(IoModel* iomodel,int analysis_counter,int analysis_type);
    4246                ~Penta();
    4347                /*}}}*/
    4448                /*FUNCTION object management {{{1*/
    45                 void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters);
     49                void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter);
    4650                Object* copy();
    4751                void  DeepEcho();
  • issm/trunk/src/c/objects/Elements/PentaHook.cpp

    r3822 r3984  
    2323/*FUNCTION PentaHook::PentaHook(){{{1*/
    2424PentaHook::PentaHook(){
     25        numanalyses=UNDEF;
     26        this->hooks=NULL;
    2527}
    2628/*}}}*/
    2729/*FUNCTION PentaHook::~PentaHook(){{{1*/
    2830PentaHook::~PentaHook(){
     31        xfree((void**)&hnodes);
    2932}
    3033/*}}}*/
    31 /*FUNCTION PentaHook::InitHookNodes(int* node_ids){{{1*/
    32 void PentaHook::InitHookNodes(int* node_ids){
    33         this->hnodes.Init(node_ids,6);
     34/*FUNCTION PentaHook::InitHookNodes(int numanalyses){{{1*/
     35void PentaHook::InitHookNodes(int numanalyses){
     36        this->hnodes=(Hook*)xmalloc(numanalyses*sizeof(Hook));
     37}
     38/*}}}*/
     39/*FUNCTION PentaHook::SetHookNodes(int* node_ids,int analysis_counter){{{1*/
     40void PentaHook::SetHookNodes(int* node_ids,int analysis_counter){
     41        this->hnodes[analysis_counter].Init(node_ids,6);
    3442
    3543}
  • issm/trunk/src/c/objects/Elements/PentaHook.h

    r3822 r3984  
    1111
    1212        public:
    13                 Hook hnodes; // 6 nodes
     13                int   numanalyses; //number of analysis types
     14                Hook* hnodes; // 6 nodes for each analysis type
    1415                Hook hmatice; // 1 ice material
    1516                Hook hmatpar; // 1 material parameter
     
    2021                PentaHook();
    2122                ~PentaHook();
    22                 void InitHookNodes(int* node_ids);
     23                void InitHookNodes(int numanalyses);
     24                void SetHookNodes(int* node_ids,int analysis_counter);
    2325                void InitHookMatice(int matice_id);
    2426                void InitHookMatpar(int matpar_id);
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r3977 r3984  
    2828        this->inputs=NULL;
    2929        this->parameters=NULL;
     30        this->collapse=NULL;
    3031}
    3132/*}}}*/
     
    3435        delete inputs;
    3536        this->parameters=NULL;
    36 }
    37 /*}}}*/
    38 /*FUNCTION Tria::Tria(int id, int index, IoModel* iomodel){{{1*/
    39 Tria::Tria(int tria_id, int index, IoModel* iomodel){ //i is the element index
     37        xfree((void**)&collapse);
     38}
     39/*}}}*/
     40/*FUNCTION Tria::Tria(int id, int index, IoModel* iomodel,int nummodels){{{1*/
     41Tria::Tria(int tria_id, int index, IoModel* iomodel,int nummodels){ //i is the element index
    4042
    4143        int    i;
    42         int    j;
    43         int    tria_node_ids[3];
    4444        int    tria_matice_id;
    4545        int    tria_matpar_id;
    46         double nodeinputs[3];
    4746
    4847        /*id: */
     
    5251        this->InitInterpolationType(P1Enum);
    5352       
     53        /*hooks: */
     54        tria_matice_id=index+1; //refers to the corresponding ice material object
     55        tria_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object
     56
     57        this->InitHookNodes(nummodels);this->nodes=NULL;
     58        this->InitHookNodes(tria_node_ids); this->nodes=NULL;
     59        this->InitHookMatice(tria_matice_id);this->matice=NULL;
     60        this->InitHookMatpar(tria_matpar_id);this->matpar=NULL;
     61
     62        //this->parameters: we still can't point to it, it may not even exist. Configure will handle this.
     63        this->parameters=NULL;
     64
     65}
     66/*}}}*/
     67/*FUNCTION Tria::Update(IoModel* iomodel,int analysis_counter,int analysis_type){{{1*/
     68Tria::Update(IoModel* iomodel,int analysis_counter,int analysis_type){ //i is the element index
     69
     70        int    i;
     71        int    tria_node_ids[3];
     72        double nodeinputs[3];
     73
    5474        /*hooks: */
    5575        //go recover node ids, needed to initialize the node hook.
     
    6787                }
    6888        }
    69         tria_matice_id=index+1; //refers to the corresponding ice material object
    70         tria_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object
    71 
    72         this->InitHookNodes(tria_node_ids); this->nodes=NULL;
    73         this->InitHookMatice(tria_matice_id);this->matice=NULL;
    74         this->InitHookMatpar(tria_matpar_id);this->matpar=NULL;
     89       
     90        this->SetHookNodes(tria_node_ids,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type
    7591
    7692        //intialize inputs, and add as many inputs per element as requested:
     
    204220
    205221        /*now deal with hooks and objects: */
     222        tria->InitHookNodes(this->nummodels);
     223        for(i=0;i<this->nummodels;i++)tria->hnodes[i].copy(&this->hnodes[i]);
    206224        tria->hnodes.copy(&this->hnodes);
    207225        tria->hmatice.copy(&this->hmatice);
     
    209227
    210228        /*recover objects: */
     229        tria->nodes=(Node**)xmalloc(3*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
     230        for(i=0;i<3;i++)tria->nodes[i]=this->nodes[i];
    211231        tria->nodes=(Node**)tria->hnodes.deliverp();
    212232        tria->matice=(Matice*)tria->hmatice.delivers();
     
    219239/*Object management: */
    220240/*FUNCTION Tria::Configure {{{1*/
    221 void  Tria::Configure(DataSet* elementsin, DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin){
     241void  Tria::Configure(DataSet* elementsin, DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin,int analysis_counter){
    222242
    223243        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    224244         * datasets, using internal ids and offsets hidden in hooks: */
    225         this->hnodes.configure(nodesin);
     245        this->hnodes[analysis_counter].configure(nodesin);
    226246        this->hmatice.configure(materialsin);
    227247        this->hmatpar.configure(materialsin);
    228248
    229249        /*Now, go pick up the objects inside the hooks: */
    230         this->nodes=(Node**)this->hnodes.deliverp();
     250        this->nodes=(Node**)this->hnodes[analysis_counter].deliverp();
    231251        this->matice=(Matice*)this->hmatice.delivers();
    232252        this->matpar=(Matpar*)this->hmatpar.delivers();
     
    241261
    242262        char* marshalled_dataset=NULL;
     263        int i;
    243264
    244265        /*recover marshalled_dataset: */
     
    249270        memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    250271        memcpy(&interpolation_type,marshalled_dataset,sizeof(interpolation_type));marshalled_dataset+=sizeof(interpolation_type);
     272        memcpy(&nummodels,marshalled_dataset,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);
     273
     274        /*allocate dynamic memory: */
     275        InitHookNodes(nummodels);
    251276
    252277        /*demarshall hooks: */
    253         hnodes.Demarshall(&marshalled_dataset);
     278        for(i=0;i<nummodels;i++)hnodes[i].Demarshall(&marshalled_dataset);
    254279        hmatice.Demarshall(&marshalled_dataset);
    255280        hmatpar.Demarshall(&marshalled_dataset);
     
    307332}
    308333/*}}}*/
    309 /*FUNCTION Tria::IsInput{{{1*/
    310 bool Tria::IsInput(int name){
    311         if (name==SurfaceSlopexEnum ||
    312                                 name==SurfaceSlopeyEnum){
    313                 return true;
    314         }
    315         else return false;
    316 }
    317 /*}}}*/
    318334/*FUNCTION Tria::Marshall {{{1*/
    319335void  Tria::Marshall(char** pmarshalled_dataset){
    320336
     337        int   i;
    321338        char* marshalled_dataset=NULL;
    322339        int   enum_type=0;
     
    336353        memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    337354        memcpy(marshalled_dataset,&interpolation_type,sizeof(interpolation_type));marshalled_dataset+=sizeof(interpolation_type);
     355        memcpy(marshalled_dataset,&nummodels,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);
    338356
    339357        /*Marshall hooks: */
    340         hnodes.Marshall(&marshalled_dataset);
     358        for(i=0;i<nummodels;i++)hnodes[i].Marshall(&marshalled_dataset);
    341359        hmatice.Marshall(&marshalled_dataset);
    342360        hmatpar.Marshall(&marshalled_dataset);
     
    358376/*FUNCTION Tria::MarshallSize {{{1*/
    359377int   Tria::MarshallSize(){
     378
     379        int i;
     380        int hnodes_size=0;;
     381
     382        for(i=0;i<nummodels;i++)hnodes_size+=hnodes[i].MarshallSize;
     383
    360384       
    361385        return sizeof(id)
     386                +hnodes_size
    362387                +sizeof(interpolation_type)
    363                 +hnodes.MarshallSize()
    364388                +hmatice.MarshallSize()
    365389                +hmatpar.MarshallSize()
     
    375399        int indices[2];
    376400        int zero=0;
    377         Hook       *beam_hnodes     = NULL;
    378         Hook       *beam_hmatice    = NULL;
    379         Hook       *beam_hmatpar    = NULL;
    380401        Parameters *beam_parameters = NULL;
    381402        Inputs     *beam_inputs     = NULL;
     
    384405        indices[1]=g1;
    385406
    386         beam_hnodes =this->hnodes.Spawn(indices,2);
    387         beam_hmatice=this->hmatice.Spawn(&zero,1);
    388         beam_hmatpar=this->hmatpar.Spawn(&zero,1);
    389407        beam_parameters=this->parameters;
    390408        beam_inputs=(Inputs*)this->inputs->SpawnBeamInputs(indices);
     
    395413        beam->parameters=beam_parameters;
    396414
    397         /*now deal with hooks and objects: */
    398         beam->hnodes.copy(beam_hnodes);
    399         beam->hmatice.copy(beam_hmatice);
    400         beam->hmatpar.copy(beam_hmatpar);
    401 
    402         /*recover objects: */
    403         //beam->nodes=(Node**)beam->hnodes.deliverp();
    404         //beam->matice=(Matice*)beam->hmatice.delivers();
    405         //beam->matpar=(Matpar*)beam->hmatpar.delivers();
    406 
    407         delete beam_hnodes;
    408         delete beam_hmatice;
    409         delete beam_hmatpar;
     415        /*now deal with nodes, matice and matpar: */
     416        beam->nodes=(Node**)xmalloc(2*sizeof(Node*));
     417        for(i=0;i<2;i++)beam->nodes[i]=this->nodes[indices[i]];
     418        beam->matice=this->matice;
     419        beam->matpar=this->matpar;
     420
    410421
    411422        return beam;
     
    417428        Sing* sing=NULL;
    418429        int zero=0;
    419         Hook       *sing_hnodes     = NULL;
    420         Hook       *sing_hmatice    = NULL;
    421         Hook       *sing_hmatpar    = NULL;
    422430        Parameters *sing_parameters = NULL;
    423431        Inputs     *sing_inputs     = NULL;
    424432
    425         sing_hnodes =this->hnodes.Spawn(&index,1);
    426         sing_hmatice=this->hmatice.Spawn(&zero,1);
    427         sing_hmatpar=this->hmatpar.Spawn(&zero,1);
    428433        sing_parameters=this->parameters;
    429434        sing_inputs=(Inputs*)this->inputs->SpawnSingInputs(index);
     
    434439        sing->parameters=sing_parameters;
    435440
    436         /*now deal with hooks and objects: */
    437         sing->hnodes.copy(sing_hnodes);
    438         sing->hmatice.copy(sing_hmatice);
    439         sing->hmatpar.copy(sing_hmatpar);
    440 
    441         /*recover objects: */
    442         //sing->nodes=(Node**)sing->hnodes.deliverp();
    443         //sing->matice=(Matice*)sing->hmatice.delivers();
    444         //sing->matpar=(Matpar*)sing->hmatpar.delivers();
    445 
    446         delete sing_hnodes;
    447         delete sing_hmatice;
    448         delete sing_hmatpar;
    449 
     441        /*now deal with node,matice and matpar: */
     442        sing->node=this->nodes[index];
     443        sing->matice=this->matice;
     444        sing->matpar=this->matpar;
     445       
    450446        return sing;
    451447}
     
    686682
    687683/*Object functions*/
     684/*FUNCTION Tria::IsInput{{{1*/
     685bool Tria::IsInput(int name){
     686        if (name==SurfaceSlopexEnum ||
     687                                name==SurfaceSlopeyEnum){
     688                return true;
     689        }
     690        else return false;
     691}
     692/*}}}*/
    688693/*FUNCTION Tria::ComputeBasalStress {{{1*/
    689694void  Tria::ComputeBasalStress(Vec eps,int analysis_type,int sub_analysis_type){
  • issm/trunk/src/c/objects/Elements/Tria.h

    r3965 r3984  
    3838                Tria();
    3939                Tria(int tria_id,int i, IoModel* iomodel);
     40                Update(IoModel* iomodel,int analysis_counter,int analysis_type);
    4041                ~Tria();
    4142                /*}}}*/
  • issm/trunk/src/c/objects/Elements/TriaHook.cpp

    r3791 r3984  
    2323/*FUNCTION TriaHook::TriaHook(){{{1*/
    2424TriaHook::TriaHook(){
     25        numanalyses=UNDEF;
     26        this->hooks=NULL;
    2527}
    2628/*}}}*/
    2729/*FUNCTION TriaHook::~TriaHook(){{{1*/
    2830TriaHook::~TriaHook(){
     31        xfree((void**)&hnodes);
    2932}
    3033/*}}}*/
    31 /*FUNCTION TriaHook::InitHookNodes(int* node_ids){{{1*/
    32 void TriaHook::InitHookNodes(int* node_ids){
    33         this->hnodes.Init(node_ids,3);
     34/*FU/*FUNCTION TriaHook::InitHookNodes(int numanalyses){{{1*/
     35void TriaHook::InitHookNodes(int numanalyses){
     36        this->hnodes=(Hook*)xmalloc(numanalyses*sizeof(Hook));
     37}
     38/*}}}*/
     39/*FUNCTION TriaHook::SetHookNodes(int* node_ids,int analysis_counter){{{1*/
     40void TriaHook::SetHookNodes(int* node_ids,int analysis_counter){
     41        this->hnodes[analysis_counter].Init(node_ids,3);
    3442
    3543}
  • issm/trunk/src/c/objects/Elements/TriaHook.h

    r3805 r3984  
    1111
    1212        public:
    13                 Hook hnodes; // 3 nodes
     13                int   numanalyses; //number of analysis types
     14                Hook* hnodes; // 3 nodes for each analysis type
    1415                Hook hmatice; // 1 ice material
    1516                Hook hmatpar; // 1 material parameter
     
    1920                TriaHook();
    2021                ~TriaHook();
    21                 void InitHookNodes(int* node_ids);
     22                void InitHookNodes(int numanalyses);
     23                void SetHookNodes(int* node_ids,int analysis_counter);
    2224                void InitHookMatice(int matice_id);
    2325                void InitHookMatpar(int matpar_id);
     26                void InitHookNeighbors(int* element_ids);
     27
    2428                /*}}}*/
    2529
  • issm/trunk/src/c/objects/FemModel.cpp

    r3982 r3984  
    2424
    2525        nummodels=in_nummodels;
    26         current_analysis_type=-1;
     26        analysis_counter=-1;
    2727       
    2828        /*Dynamically allocate whatever is a list of length nummodels: */
     
    9797        for(i=0;i<nummodels;i++)printf("     %i: %s\n",i,EnumAsString(analysis_type_list[i]));
    9898        printf("   current analysis_type: \n");
    99         printf("     %i: %s\n",i,EnumAsString(analysis_type_list[current_analysis_type]));
     99        printf("     %i: %s\n",i,EnumAsString(analysis_type_list[analysis_counter]));
    100100
    101101
     
    107107void  FemModel::AddAnalysis(ConstDataHandle IOMODEL, int analysis_type){
    108108
    109 
    110         int i; //practical counter
    111 
    112109        /*Set counter: */
    113         if (current_analysis_type==-1)current_analysis_type=0;
    114         else current_analysis_type++;
    115 
    116         i=current_analysis_type;
     110        if (analysis_counter==-1)analysis_counter=0;
     111        else analysis_counter++;
    117112
    118113        /*intermediary: */
     
    123118
    124119        _printf_("   create datasets:\n");
    125         CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,&parameters,iomodel,IOMODEL,analysis_type);
     120        CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,&parameters,iomodel,IOMODEL,analysis_type,nummodels,analysis_counter);
    126121
    127122        _printf_("   create degrees of freedom: \n");
     
    129124       
    130125        _printf_("   create single point constraints: \n");
    131         SpcNodesx( &yg[i], nodes,constraints);
     126        SpcNodesx( &yg[analysis_counter], nodes,constraints);
    132127       
    133128        _printf_("   create rigid body constraints:\n");
    134         MpcNodesx( &Rmg[i], nodes,constraints);
     129        MpcNodesx( &Rmg[analysis_counter], nodes,constraints);
    135130       
    136131        _printf_("   create node sets:\n");
    137         BuildNodeSetsx(&nodesets[i], nodes);
     132        BuildNodeSetsx(&nodesets[analysis_counter], nodes);
    138133
    139134        _printf_("   reducing single point constraints vector:\n");
    140         Reducevectorgtosx(&ys[i], yg[i]->vector,nodesets[i]);
     135        Reducevectorgtosx(&ys[analysis_counter], yg[analysis_counter]->vector,nodesets[analysis_counter]);
    141136       
    142137        _printf_("   normalizing rigid body constraints matrix:\n");
    143         NormalizeConstraintsx(&Gmn[i], Rmg[i],nodesets[i]);
     138        NormalizeConstraintsx(&Gmn[analysis_counter], Rmg[analysis_counter],nodesets[analysis_counter]);
    144139
    145140        _printf_("   configuring element and loads:\n");
     
    155150/*FUNCTION FemModel::GetCurrentAnalysis {{{1*/
    156151FemFemModel* FemModel::GetCurrentAnalysis(){
    157         return analysis_type_list[current_analysis_type];
     152        return analysis_type_list[analysis_counter];
    158153}
    159154/*}}}1*/
     
    167162                }
    168163        }
    169         if(found)current_analysis_type=i;
     164        if(found)analysis_counter=i;
    170165        else ISSMERRR("%s%s%s"," could not find analysis_type ",EnumAsString(analysis_type) " in list of FemModel analyses");
    171166}
  • issm/trunk/src/c/objects/FemModel.h

    r3982 r3984  
    2424
    2525                int                 nummodels;
    26                 int*                analysis_type_list; //list of analyses this femmodel is capable of.
    27                 int                 current_analysis_type; //counter to the current analysis being carried out
     26                int*                analysis_type_list; //list of analyses this femmodel is going to carry out
     27                int                 analysis_counter; //counter into analysis_type_list
    2828               
    2929                DataSet*            elements; //elements (one set for all analyses)
     
    3838                DofVec*             tpartition;
    3939               
    40                 //multiple  sets of vectors for each analysis_type
     40                //multiple  sets of matrices/vectors for each analysis_type
    4141                Mat*                 Rmg; //rigid body motions matrices
    4242                Mat*                 Gmn;
  • issm/trunk/src/c/objects/IoModel.cpp

    r3982 r3984  
    4141        xfree((void**)&this->gridonhutter);
    4242        xfree((void**)&this->gridonmacayeal);
    43         if (strcmp(this->meshtype,"3d")==0){
     43        if (this->dim==3){
    4444                xfree((void**)&this->elements2d);
    4545                xfree((void**)&this->deadgrids);
     
    9696        xfree((void**)&this->outputfilename);
    9797        xfree((void**)&this->repository);
    98         xfree((void**)&this->meshtype);
    9998        xfree((void**)&this->name);
    10099       
     
    132131        IoModelFetchData(&this->qmu_analysis,iomodel_handle,"qmu_analysis");
    133132        IoModelFetchData(&this->control_analysis,iomodel_handle,"control_analysis");
    134         IoModelFetchData(&this->meshtype,iomodel_handle,"type");
     133        IoModelFetchData(&this->dim,iomodel_handle,"dim");
    135134        /*!Get numberofelements and numberofvertices: */
    136135        IoModelFetchData(&this->numberofvertices,iomodel_handle,"numberofgrids");
    137136        IoModelFetchData(&this->numberofelements,iomodel_handle,"numberofelements");
    138137        /*!In case we are running 3d, we are going to need the collapsed and non-collapsed 2d meshes, from which the 3d mesh was extruded: */
    139         if (strcmp(this->meshtype,"3d")==0){
     138        if (this->dim==3){
    140139       
    141140                /*!Deal with 2d mesh: */
     
    229228        this->outputfilename=NULL;
    230229        this->repository=NULL;
    231         this->meshtype=NULL;
    232230        this->qmu_analysis=0;
    233231        this->control_analysis=0;
     
    392390        int i,j;
    393391
    394         if(which_part==1 && my_rank==rank && (strcmp(this->meshtype,"3d")==0)){
     392        if(which_part==1 && my_rank==rank && this->dim==3){
    395393                printf("IoModel penalties: \n");
    396394                printf("   number of penalties: %i\n",this->numpenalties);
  • issm/trunk/src/c/objects/IoModel.h

    r3982 r3984  
    1919                char*     outputfilename;
    2020                char*   repository;
    21                 char*   meshtype;
     21                int     dim;
    2222                int     qmu_analysis;
    2323                int     control_analysis;
  • issm/trunk/src/c/objects/Materials/Matice.cpp

    r3863 r3984  
    3535/*}}}*/
    3636/*FUNCTION Matice::Matice(int id, int i, IoModel* iomodel, int num_vertices){{{1*/
    37 Matice::Matice(int matice_mid,int i, IoModel* iomodel, int num_vertices){
     37Matice::Matice(int matice_mid,int i, IoModel* iomodel){
    3838
    3939        int j;
     
    4545        /*intermediary: */
    4646        double B_avg;
    47  
     47
     48        /*2d or 3d? */
     49        if(strcmp(iomodel->meshtype,"2d")==0){
     50                num_vertices=3; //tria elements
     51        }
     52        else if(strcmp(iomodel->meshtype,"3d")==0){
     53                num_vertices=6; //penta elements
     54        }
     55        else ISSMERROR(" Mesh type not supported yet!");
     56
    4857        /*Compute B on the element if provided*/
    49         if (num_vertices==3 || num_vertices==6){
    50                 if (iomodel->rheology_B){
    51                         B_avg=0;
    52                         for(j=0;j<num_vertices;j++){
    53                                 B_avg+=*(iomodel->rheology_B+((int)*(iomodel->elements+num_vertices*i+j)-1));
    54                         }
    55                         B_avg=B_avg/num_vertices;
    56                 }
    57         }
    58         else if (num_vertices==1 || num_vertices==2){
    59                 if (iomodel->rheology_B){
    60                         B_avg=*(iomodel->rheology_B+i);
    61                 }
    62         }
    63         else ISSMERROR("num_vertices = %i not supported yet",num_vertices);
    64        
    65         if (iomodel->rheology_B) matice_B=B_avg;
    66         else            matice_B=UNDEF;
    67         if (iomodel->rheology_n){
    68                 if (num_vertices==3 || num_vertices==6){
    69                         matice_n=(double)*(iomodel->rheology_n+i);
    70                 }
    71                 else if (num_vertices==1 || num_vertices==2){
    72                         /*n is on the elements for now, so just take the first one*/
    73                         matice_n=(double)*(iomodel->rheology_n);
    74                 }
    75                 else ISSMERROR("num_vertices = %i not supported yet",num_vertices);
    76         }
    77         else            matice_n=UNDEF;
     58        if (iomodel->rheology_B){
     59                B_avg=0;
     60                for(j=0;j<num_vertices;j++){
     61                        B_avg+=*(iomodel->rheology_B+((int)*(iomodel->elements+num_vertices*i+j)-1));
     62                }
     63                B_avg=B_avg/num_vertices;
     64                matice_B=B_avg;
     65        }
     66        else matice_B=UNDEF;
     67       
     68        if (iomodel->rheology_n) matice_n=(double)*(iomodel->rheology_n+i);
     69        else matice_n=UNDEF;
    7870
    7971        this->Init(matice_mid,matice_B,matice_n);
  • issm/trunk/src/c/objects/Materials/Matice.h

    r3863 r3984  
    2323                Matice();
    2424                Matice(int mid,double B,double n);
    25                 Matice(int mid,int i, IoModel* iomodel, int num_vertices);
     25                Matice(int mid,int i, IoModel* iomodel);
    2626                void Init(int mid,double B,double n);
    2727                ~Matice();
  • issm/trunk/src/c/objects/Node.cpp

    r3956 r3984  
    3636}
    3737/*}}}*/
    38 /*FUNCTION Node::Node(int id, DofIndexing* indexing, Hook* vertex, Hook* uppernode,Inputs* inputs){{{2*/
    39 Node::Node(int node_id,DofIndexing* node_indexing, Hook* node_vertex, Hook* node_upper_node,Inputs* node_inputs):
     38/*FUNCTION Node::Node(int id, DofIndexing* indexing, Hook* vertex, Hook* uppernode,Inputs* inputs,int analysis_type){{{2*/
     39Node::Node(int node_id,DofIndexing* node_indexing, Hook* node_vertex, Hook* node_upper_node,Inputs* node_inputs,int analysis_type):
    4040            indexing(node_indexing),
    4141                hvertex(node_vertex),
     
    4444            /*all the initialization has been done by the initializer, just fill in the id: */
    4545            this->id=node_id;
     46                this->analysis_type=analysis_type;
    4647
    4748                if(node_inputs){
     
    5354}
    5455/*}}}*/
    55 /*FUNCTION Node::Node(int id, int i, IoModel* iomodel)          -> Continuous Galerkin{{{2*/
    56 Node::Node(int node_id, int i, IoModel* iomodel){ //i is the node index
     56/*FUNCTION Node::Node(int id, int i, IoModel* iomodel,int analysis_type)          -> Continuous Galerkin{{{2*/
     57Node::Node(int node_id, int i, IoModel* iomodel,int analysis_type){ //i is the node index
    5758
    5859        int k;
     
    6364        /*id: */
    6465        this->id=node_id; //matlab indexing
     66        this->analysis_type=analysis_type;
    6567
    6668        /*indexing:*/
     
    167169}
    168170/*}}}*/
    169 /*FUNCTION Node::Node(int id, int i, int j, IoModel* iomodel)   -> Discontinuous Galerkin{{{2*/
    170 Node::Node(int node_id,int i,int j,IoModel* iomodel){
     171/*FUNCTION Node::Node(int id, int i, int j, IoModel* iomodel,int analysis_type)   -> Discontinuous Galerkin{{{2*/
     172Node::Node(int node_id,int i,int j,IoModel* iomodel,int analysis_type){
    171173        /* i -> index of the vertex in C indexing
    172174         * j -> index of the node in C indexing*/
     
    178180        /*id: */
    179181        this->id=node_id; //matlab indexing
     182        this->analysis_type=analysis_type;
    180183
    181184        /*indexing:*/
     
    236239Object* Node::copy() {
    237240               
    238         return new Node(this->id,&this->indexing, &this->hvertex,&this->hupper_node,this->inputs);
     241        return new Node(this->id,&this->indexing, &this->hvertex,&this->hupper_node,this->inputs,this->analysis_type);
    239242
    240243}
     
    246249        printf("Node:\n");
    247250        printf("   id: %i\n",id);
     251        printf("   analysis_type: %s\n",EnumAsString(analysis_type));
    248252        indexing.DeepEcho();
    249253        printf("Vertex:\n");
     
    269273
    270274        memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
     275        memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    271276       
    272277        /*demarshall objects: */
     
    288293        printf("Node:\n");
    289294        printf("   id: %i\n",id);
     295        printf("   analysis_type: %s\n",EnumAsString(analysis_type));
    290296        indexing.Echo();
    291297        hvertex.Echo();
     
    372378        /*marshall Node data: */
    373379        memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
     380        memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    374381       
    375382        /*marshall objects: */
     
    399406                hupper_node.MarshallSize()+
    400407                inputs->MarshallSize()+
     408                sizeof(analysis_type)+
    401409                sizeof(int); //sizeof(int) for enum type
    402410}
  • issm/trunk/src/c/objects/Node.h

    r3969 r3984  
    2727                Hook           hvertex;
    2828                Hook           hupper_node;
    29                 Inputs*  inputs; //properties of this node
     29                Inputs*        inputs; //properties of this node
     30                int            analysis_type;
    3031               
    3132        public:
     
    3435                Node();
    3536                Node(int id,int vertex_id, int upper_node_id, int numberofdofs);
    36                 Node(int id,DofIndexing* indexing, Hook* vertex, Hook* upper_node, Inputs* inputs);
    37                 Node(int id, int i, IoModel* iomodel);
    38                 Node(int id, int i,int j,IoModel* iomodel);
     37                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);
    3940                ~Node();
    4041                /*}}}*/
Note: See TracChangeset for help on using the changeset viewer.