Changeset 3383


Ignore:
Timestamp:
04/04/10 23:08:44 (15 years ago)
Author:
Eric.Larour
Message:

New Hook and Element Properties, to simplify element framework. This is a massive commit

Location:
issm/trunk
Files:
6 added
21 edited

Legend:

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

    r3366 r3383  
    126126#AUTOMAKE
    127127export AUTOMAKE_DIR
    128 PATH="$PATH:$AUTOMAKE_DIR/bin"
     128PATH="$AUTOMAKE_DIR/bin:$PATH"
    129129
    130130#BORLAND
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.cpp

    r3362 r3383  
    6868int ObjectEnum(void){                       return          400; }
    6969/*Elements: */
     70int HookEnum(void){                         return          409; }
    7071int ElementEnum(void){                      return          410; }
    7172int TriaEnum(void){                         return          411; }
    72 int PentaEnum(void){                        return          412; }
     73int ElementPropertiesEnum(void){               return          412; }
     74int PentaEnum(void){                        return          413; }
    7375int SingEnum(void){                         return          414; }
    7476int BeamEnum(void){                         return          415; }
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h

    r3362 r3383  
    6969int ObjectEnum(void);
    7070/*Elements: */
     71int HookEnum(void);
    7172int ElementEnum(void);
    7273int TriaEnum(void);
     74int ElementPropertiesEnum(void);
    7375int PentaEnum(void);
    7476int SingEnum(void);
  • issm/trunk/src/c/Makefile.am

    r3373 r3383  
    3131                                        ./objects/Element.h\
    3232                                        ./objects/Element.cpp\
     33                                        ./objects/ElementProperties.h\
     34                                        ./objects/ElementProperties.cpp\
    3335                                        ./objects/Model.h\
    3436                                        ./objects/Model.cpp\
     
    5254                                        ./objects/Node.h\
    5355                                        ./objects/Node.cpp\
     56                                        ./objects/Hook.h\
     57                                        ./objects/Hook.cpp\
    5458                                        ./objects/Result.h\
    5559                                        ./objects/Result.cpp\
     
    419423                                        ./objects/Element.h\
    420424                                        ./objects/Element.cpp\
     425                                        ./objects/ElementProperties.h\
     426                                        ./objects/ElementProperties.cpp\
    421427                                        ./objects/Model.h\
    422428                                        ./objects/Model.cpp\
     
    440446                                        ./objects/Node.h\
    441447                                        ./objects/Node.cpp\
     448                                        ./objects/Hook.h\
     449                                        ./objects/Hook.cpp\
    442450                                        ./objects/Result.h\
    443451                                        ./objects/Result.cpp\
  • issm/trunk/src/c/ModelProcessorx/Balancedthickness/CreateElementsNodesAndMaterialsBalancedthickness.cpp

    r3332 r3383  
    88#include "../../objects/objects.h"
    99#include "../../shared/shared.h"
     10#include "../../include/typedefs.h"
    1011#include "../../MeshPartitionx/MeshPartitionx.h"
    1112#include "../IoModel.h"
     
    3334        Matice*     matice  = NULL;
    3435        Matpar*     matpar  = NULL;
     36        ElementProperties* tria_properties=NULL;
     37        ElementProperties* penta_properties=NULL;
    3538
    3639        /*output: */
     
    4750        /*tria constructor input: */
    4851        int tria_id;
    49         int tria_mid;
    50         int tria_mparid;
    51         int tria_numparid;
    52         int tria_g[3];
     52        int tria_matice_id;
     53        int tria_matpar_id;
     54        int tria_numpar_id;
     55        int tria_node_ids[3];
    5356        double tria_h[3];
    5457        double tria_s[3];
    5558        double tria_b[3];
    56         double tria_k[3];
    57         double tria_melting[3];
    58         double tria_accumulation[3];
    59         double tria_geothermalflux[3];
    60         int    tria_friction_type;
    61         double tria_p;
    62         double tria_q;
    6359        int    tria_shelf;
    6460        bool   tria_onwater;
     
    7268
    7369        int penta_id;
    74         int penta_mid;
    75         int penta_mparid;
    76         int penta_numparid;
    77         int penta_g[6];
     70        int penta_matice_id;
     71        int penta_matpar_id;
     72        int penta_numpar_id;
     73        int penta_node_ids[6];
    7874        double penta_h[6];
    7975        double penta_s[6];
    8076        double penta_b[6];
    81         double penta_k[6];
    82         int penta_friction_type;
    83         double penta_p;
    84         double penta_q;
    8577        int penta_shelf;
    8678        int penta_onbed;
    8779        int penta_onsurface;
    8880        int penta_collapse;
    89         double penta_melting[6];
    90         double penta_accumulation[6];
    91         double penta_geothermalflux[6];
    92         int penta_thermal_steadystate;
    9381        bool   penta_onwater;
    9482
     
    190178                        /*ids: */
    191179                        tria_id=i+1; //matlab indexing.
    192                         tria_mid=-1; //no need for materials
    193                         tria_mparid=-1; //no need for materials
    194                         tria_numparid=1;
     180                        tria_matice_id=-1; //no need for materials
     181                        tria_matpar_id=-1; //no need for materials
     182                        tria_numpar_id=1;
    195183
    196184                        /*vertices offsets: */
    197                         tria_g[0]=(int)*(iomodel->elements+elements_width*i+0);
    198                         tria_g[1]=(int)*(iomodel->elements+elements_width*i+1);
    199                         tria_g[2]=(int)*(iomodel->elements+elements_width*i+2);
     185                        tria_node_ids[0]=(int)*(iomodel->elements+elements_width*i+0);
     186                        tria_node_ids[1]=(int)*(iomodel->elements+elements_width*i+1);
     187                        tria_node_ids[2]=(int)*(iomodel->elements+elements_width*i+2);
    200188
    201189                        /*thickness,surface and bed:*/
     
    216204                        tria_onwater=(bool)*(iomodel->elementonwater+i);
    217205
     206                        /*Create properties: */
     207                        tria_properties=new ElementProperties(3,tria_h, tria_s, tria_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, tria_shelf, UNDEF, tria_onwater, UNDEF, UNDEF, UNDEF);
     208
    218209                        /*Create tria element using its constructor:*/
    219                         tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater);
     210                        tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties);
     211
     212                        /*Delete properties: */
     213                        delete tria_properties;
    220214
    221215                        /*Add tria element to elements dataset: */
     
    269263                        /*name and id: */
    270264                        penta_id=i+1; //matlab indexing.
    271                         penta_mid=-1;
    272                         penta_mparid=-1; //no need for materials
    273                         penta_numparid=1;
     265                        penta_matice_id=-1;
     266                        penta_matpar_id=-1; //no need for materials
     267                        penta_numpar_id=1;
    274268
    275269                        /*vertices,thickness,surface,bed and drag: */
    276270                        for(j=0;j<6;j++){
    277                                 penta_g[j]=(int)*(iomodel->elements+elements_width*i+j);
     271                                penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j);
    278272                                penta_h[j]=*(iomodel->thickness+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    279273                                penta_s[j]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+j)-1));
     
    289283       
    290284
     285                        /*Create properties: */
     286                        penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF);
     287
    291288                        /*Create Penta using its constructor:*/
    292                         penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,
    293                                         penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface,
    294                                         penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,
    295                                         penta_thermal_steadystate,penta_onwater);
     289                        penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties);
     290
     291                        /*Delete properties: */
     292                        delete penta_properties;
    296293
    297294                        /*Add penta element to elements dataset: */
  • issm/trunk/src/c/ModelProcessorx/Balancedvelocities/CreateElementsNodesAndMaterialsBalancedvelocities.cpp

    r3332 r3383  
    99#include "../../shared/shared.h"
    1010#include "../../MeshPartitionx/MeshPartitionx.h"
     11#include "../../include/typedefs.h"
    1112#include "../IoModel.h"
    1213
     
    2627        DataSet*    nodes = NULL;
    2728        DataSet*    materials = NULL;
     29        ElementProperties* tria_properties=NULL;
     30        ElementProperties* penta_properties=NULL;
    2831       
    2932        /*Objects: */
     
    4750        /*tria constructor input: */
    4851        int tria_id;
    49         int tria_mid;
    50         int tria_mparid;
    51         int tria_numparid;
    52         int tria_g[3];
     52        int tria_matice_id;
     53        int tria_matpar_id;
     54        int tria_numpar_id;
     55        int tria_node_ids[3];
    5356        double tria_h[3];
    5457        double tria_s[3];
    5558        double tria_b[3];
    56         double tria_k[3];
    57         double tria_melting[3];
    58         double tria_accumulation[3];
    59         double tria_geothermalflux[3];
    60         int    tria_friction_type;
    61         double tria_p;
    62         double tria_q;
    6359        int    tria_shelf;
    6460        bool   tria_onwater;
     
    7268
    7369        int penta_id;
    74         int penta_mid;
    75         int penta_mparid;
    76         int penta_numparid;
    77         int penta_g[6];
     70        int penta_matice_id;
     71        int penta_matpar_id;
     72        int penta_numpar_id;
     73        int penta_node_ids[6];
    7874        double penta_h[6];
    7975        double penta_s[6];
    8076        double penta_b[6];
    81         double penta_k[6];
    82         int penta_friction_type;
    83         double penta_p;
    84         double penta_q;
    8577        int penta_shelf;
    8678        int penta_onbed;
    8779        int penta_onsurface;
    8880        int penta_collapse;
    89         double penta_melting[6];
    90         double penta_accumulation[6];
    91         double penta_geothermalflux[6];
    92         int penta_thermal_steadystate;
    9381        bool   penta_onwater;
    9482
     
    190178                        /*ids: */
    191179                        tria_id=i+1; //matlab indexing.
    192                         tria_mid=-1; //no need for materials
    193                         tria_mparid=-1; //no need for materials
    194                         tria_numparid=1;
     180                        tria_matice_id=-1; //no need for materials
     181                        tria_matpar_id=-1; //no need for materials
     182                        tria_numpar_id=1;
    195183
    196184                        /*vertices offsets: */
    197                         tria_g[0]=(int)*(iomodel->elements+elements_width*i+0);
    198                         tria_g[1]=(int)*(iomodel->elements+elements_width*i+1);
    199                         tria_g[2]=(int)*(iomodel->elements+elements_width*i+2);
     185                        tria_node_ids[0]=(int)*(iomodel->elements+elements_width*i+0);
     186                        tria_node_ids[1]=(int)*(iomodel->elements+elements_width*i+1);
     187                        tria_node_ids[2]=(int)*(iomodel->elements+elements_width*i+2);
    200188
    201189                        /*thickness,surface and bed:*/
     
    216204                        tria_onwater=(bool)*(iomodel->elementonwater+i);
    217205
     206                        /*Create properties: */
     207                        tria_properties=new ElementProperties(3,tria_h, tria_s, tria_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, tria_shelf, UNDEF, tria_onwater, UNDEF, UNDEF, UNDEF);
     208
    218209                        /*Create tria element using its constructor:*/
    219                         tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater);
     210                        tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties);
     211
     212                        /*Delete properties: */
     213                        delete tria_properties;
    220214
    221215                        /*Add tria element to elements dataset: */
     
    269263                        /*name and id: */
    270264                        penta_id=i+1; //matlab indexing.
    271                         penta_mid=-1;
    272                         penta_mparid=-1; //no need for materials
    273                         penta_numparid=1;
     265                        penta_matice_id=-1;
     266                        penta_matpar_id=-1; //no need for materials
     267                        penta_numpar_id=1;
    274268
    275269                        /*vertices,thickness,surface,bed and drag: */
    276270                        for(j=0;j<6;j++){
    277                                 penta_g[j]=(int)*(iomodel->elements+elements_width*i+j);
     271                                penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j);
    278272                                penta_h[j]=*(iomodel->thickness+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    279273                                penta_s[j]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+j)-1));
     
    288282                        penta_onwater=(bool)*(iomodel->elementonwater+i);
    289283       
     284                        /*Create properties: */
     285                        penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF);
    290286
    291287                        /*Create Penta using its constructor:*/
    292                         penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,
    293                                         penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface,
    294                                         penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,
    295                                         penta_thermal_steadystate,penta_onwater);
     288                        penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties);
     289
     290                        /*Delete properties: */
     291                        delete penta_properties;
    296292
    297293                        /*Add penta element to elements dataset: */
  • issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateElementsNodesAndMaterialsDiagnosticHoriz.cpp

    r3332 r3383  
    99#include "../../shared/shared.h"
    1010#include "../../MeshPartitionx/MeshPartitionx.h"
     11#include "../../include/typedefs.h"
    1112#include "../IoModel.h"
    1213
     
    3334        Matice*     matice  = NULL;
    3435        Matpar*     matpar  = NULL;
     36        ElementProperties* tria_properties=NULL;
     37        ElementProperties* penta_properties=NULL;
    3538
    3639        /*output: */
     
    4750        /*tria constructor input: */
    4851        int tria_id;
    49         int tria_mid;
    50         int tria_mparid;
    51         int tria_numparid;
    52         int tria_g[3];
     52        int tria_matice_id;
     53        int tria_matpar_id;
     54        int tria_numpar_id;
     55        int tria_node_ids[3];
    5356        double tria_h[3];
    5457        double tria_s[3];
     
    5760        double tria_melting[3];
    5861        double tria_accumulation[3];
    59         double tria_geothermalflux[3];
    6062        int    tria_friction_type;
    6163        double tria_p;
     
    7173        /*penta constructor input: */
    7274        int penta_id;
    73         int penta_mid;
    74         int penta_mparid;
    75         int penta_numparid;
    76         int penta_g[6];
     75        int penta_matice_id;
     76        int penta_matpar_id;
     77        int penta_numpar_id;
     78        int penta_node_ids[6];
    7779        double penta_h[6];
    7880        double penta_s[6];
     
    8890        double penta_melting[6];
    8991        double penta_accumulation[6];
    90         double penta_geothermalflux[6];
    91         int penta_thermal_steadystate;
    9292        bool   penta_onwater;
    9393
     
    218218                                /*ids: */
    219219                                tria_id=i+1; //matlab indexing.
    220                                 tria_mid=i+1; //refers to the corresponding material property card
    221                                 tria_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card
    222                                 tria_numparid=1;
    223 
    224                                 /*vertices offsets: */
    225                                 tria_g[0]=(int)*(iomodel->elements+elements_width*i+0);
    226                                 tria_g[1]=(int)*(iomodel->elements+elements_width*i+1);
    227                                 tria_g[2]=(int)*(iomodel->elements+elements_width*i+2);
     220                                tria_matice_id=i+1; //refers to the corresponding material property card
     221                                tria_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card
     222                                tria_numpar_id=1;
     223
     224                                /*vertices ids: */
     225                                tria_node_ids[0]=(int)*(iomodel->elements+elements_width*i+0);
     226                                tria_node_ids[1]=(int)*(iomodel->elements+elements_width*i+1);
     227                                tria_node_ids[2]=(int)*(iomodel->elements+elements_width*i+2);
    228228
    229229                                /*thickness,surface and bed:*/
     
    263263                                tria_onwater=(bool)*(iomodel->elementonwater+i);
    264264
     265                                /*Create properties: */
     266                                tria_properties=new ElementProperties(3,tria_h, tria_s, tria_b, tria_k, tria_melting, tria_accumulation, NULL,
     267                                                tria_friction_type, tria_p, tria_q, tria_shelf, UNDEF,tria_onwater, UNDEF,UNDEF,UNDEF);
     268
    265269                                /*Create tria element using its constructor:*/
    266                                 tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater);
     270                                tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties);
     271
     272                                /*delete properties: */
     273                                delete tria_properties;
    267274
    268275                                /*Add tria element to elements dataset: */
     
    351358                                /*name and id: */
    352359                                penta_id=i+1; //matlab indexing.
    353                                 penta_mid=i+1; //refers to the corresponding material property card
    354                                 penta_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card
    355                                 penta_numparid=1;
     360                                penta_matice_id=i+1; //refers to the corresponding material property card
     361                                penta_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card
     362                                penta_numpar_id=1;
    356363
    357364                                /*vertices,thickness,surface,bed and drag: */
    358365                                for(j=0;j<6;j++){
    359                                         penta_g[j]=(int)*(iomodel->elements+elements_width*i+j);
     366                                        penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j);
    360367                                        penta_h[j]=*(iomodel->thickness+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    361368                                        penta_s[j]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+j)-1));
     
    385392                                }
    386393
     394                                /*Create element properties: */
     395                                penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, penta_k, penta_melting, penta_accumulation, NULL, penta_friction_type, penta_p, penta_q, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF);
    387396
    388397                                /*Create Penta using its constructor:*/
    389                                 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,
    390                                                 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface,
    391                                                 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,
    392                                                 penta_thermal_steadystate,penta_onwater);
     398                                penta= new Penta(penta_id,penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties);
     399
     400                                /*delete properties: */
     401                                delete penta_properties;
    393402
    394403                                /*Add penta element to elements dataset: */
  • issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateElementsNodesAndMaterialsDiagnosticStokes.cpp

    r3332 r3383  
    99#include "../../shared/shared.h"
    1010#include "../../include/macros.h"
     11#include "../../include/typedefs.h"
    1112#include "../../MeshPartitionx/MeshPartitionx.h"
    1213#include "../IoModel.h"
     
    3233        Matice*     matice  = NULL;
    3334        Matpar*     matpar  = NULL;
     35        ElementProperties* penta_properties=NULL;
    3436
    3537        /*output: */
     
    5254
    5355        int penta_id;
    54         int penta_mid;
    55         int penta_mparid;
    56         int penta_numparid;
    57         int penta_g[6];
     56        int penta_matice_id;
     57        int penta_matpar_id;
     58        int penta_numpar_id;
     59        int penta_node_ids[6];
    5860        double penta_h[6];
    5961        double penta_s[6];
     
    6971        double penta_melting[6];
    7072        double penta_accumulation[6];
    71         double penta_geothermalflux[6];
    72         int penta_thermal_steadystate;
    7373        bool   penta_onwater;
    7474
     
    185185                        /*name and id: */
    186186                        penta_id=i+1; //matlab indexing.
    187                         penta_mid=i+1; //refers to the corresponding material property card
    188                         penta_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card
    189                         penta_numparid=1;
     187                        penta_matice_id=i+1; //refers to the corresponding material property card
     188                        penta_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card
     189                        penta_numpar_id=1;
    190190
    191191                        /*vertices,thickness,surface,bed and drag: */
    192192                        for(j=0;j<6;j++){
    193                                 penta_g[j]=(int)*(iomodel->elements+elements_width*i+j);
     193                                penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j);
    194194                                penta_h[j]=*(iomodel->thickness+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    195195                                penta_s[j]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+j)-1));
     
    211211                        penta_onsurface=(int)*(iomodel->elementonsurface+i);
    212212                        penta_onwater=(bool)*(iomodel->elementonwater+i);
     213                        penta_collapse=0;
    213214       
    214215                        if (*(iomodel->elements_type+2*i+1)==StokesFormulationEnum()){
    215                        
     216               
     217                                /*Create properties: */
     218                                penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, penta_k, penta_melting, penta_accumulation, NULL, penta_friction_type, penta_p, penta_q, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF); 
     219                               
    216220                                /*Create Penta using its constructor:*/
    217                                 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,
    218                                                 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface,
    219                                                 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,
    220                                                 penta_thermal_steadystate,penta_onwater);
     221                                penta=new Penta(penta_id,penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties);
     222
     223                                /*Delete properties: */
     224                                delete penta_properties;
    221225
    222226                                /*Add penta element to elements dataset: */
  • issm/trunk/src/c/ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp

    r3332 r3383  
    1010#include "../../shared/shared.h"
    1111#include "../../MeshPartitionx/MeshPartitionx.h"
     12#include "../../include/typedefs.h"
    1213#include "../IoModel.h"
    1314
     
    3334        Matice*     matice  = NULL;
    3435        Matpar*     matpar  = NULL;
     36        ElementProperties* penta_properties=NULL;
    3537
    3638        /*output: */
     
    5355
    5456        int penta_id;
    55         int penta_mid;
    56         int penta_mparid;
    57         int penta_numparid;
    58         int penta_g[6];
     57        int penta_matice_id;
     58        int penta_matpar_id;
     59        int penta_numpar_id;
     60        int penta_node_ids[6];
    5961        double penta_h[6];
    6062        double penta_s[6];
    6163        double penta_b[6];
    62         double penta_k[6];
    63         int penta_friction_type;
    64         double penta_p;
    65         double penta_q;
    6664        int penta_shelf;
    6765        int penta_onbed;
     
    7068        double penta_melting[6];
    7169        double penta_accumulation[6];
    72         double penta_geothermalflux[6];
    7370        int penta_artdiff;
    74         int penta_thermal_steadystate;
    7571        double penta_viscosity_overshoot;
    7672        double penta_stokesreconditioning;
     
    177173                /*name and id: */
    178174                penta_id=i+1; //matlab indexing.
    179                 penta_mid=i+1; //refers to the corresponding material property card
    180                 penta_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card
    181                 penta_numparid=1;
     175                penta_matice_id=i+1; //refers to the corresponding material property card
     176                penta_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card
     177                penta_numpar_id=1;
    182178
    183179                /*vertices,thickness,surface,bed and drag: */
    184180                for(j=0;j<6;j++){
    185                         penta_g[j]=(int)*(iomodel->elements+elements_width*i+j);
     181                        penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j);
    186182                        penta_h[j]=*(iomodel->thickness+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    187183                        penta_s[j]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+j)-1));
     
    198194                penta_onwater=(bool)*(iomodel->elementonwater+i);
    199195
     196                /*Create properties: */
     197                penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, NULL, penta_melting, penta_accumulation, NULL, UNDEF,UNDEF,UNDEF, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF);
     198
    200199                /*Create Penta using its constructor:*/
    201                 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,
    202                                 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface,
    203                                 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,
    204                                 penta_thermal_steadystate,penta_onwater);
     200                penta=new Penta(penta_id,penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties);
     201
     202                /*delete properties: */
     203                delete penta_properties;
    205204
    206205                /*Add penta element to elements dataset: */
  • issm/trunk/src/c/ModelProcessorx/Melting/CreateElementsNodesAndMaterialsMelting.cpp

    r3332 r3383  
    66#include "../../toolkits/toolkits.h"
    77#include "../../EnumDefinitions/EnumDefinitions.h"
     8#include "../../include/typedefs.h"
    89#include "../../objects/objects.h"
    910#include "../../shared/shared.h"
     
    3233        Matice*     matice  = NULL;
    3334        Matpar*     matpar  = NULL;
     35        ElementProperties* penta_properties=NULL;
    3436       
    3537        /*output: */
     
    5254
    5355        int penta_id;
    54         int penta_mid;
    55         int penta_mparid;
    56         int penta_numparid;
    57         int penta_g[6];
     56        int penta_matice_id;
     57        int penta_matpar_id;
     58        int penta_numpar_id;
     59        int penta_node_ids[6];
    5860        double penta_h[6];
    5961        double penta_s[6];
     
    6971        double penta_melting[6];
    7072        double penta_accumulation[6];
    71         double penta_geothermalflux[6];
    72         int penta_thermal_steadystate;
    7373        bool   penta_onwater;
    7474
     
    165165                /*name and id: */
    166166                penta_id=i+1; //matlab indexing.
    167                 penta_mid=i+1; //refers to the corresponding material property card
    168                 penta_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card
    169                 penta_numparid=1;
     167                penta_matice_id=i+1; //refers to the corresponding material property card
     168                penta_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card
     169                penta_numpar_id=1;
    170170
    171171                /*vertices,thickness,surface,bed and drag: */
    172172                for(j=0;j<6;j++){
    173                         penta_g[j]=(int)*(iomodel->elements+elements_width*i+j);
     173                        penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j);
    174174                        penta_h[j]=*(iomodel->thickness+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    175175                        penta_s[j]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+j)-1));
     
    193193                penta_collapse=1;
    194194
     195                /*Create properties: */
     196                penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, penta_k, penta_melting, penta_accumulation, NULL, penta_friction_type, penta_p, penta_q, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF);
     197
    195198                /*Create Penta using its constructor:*/
    196                 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,
    197                                 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface,
    198                                 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,
    199                                 penta_thermal_steadystate,penta_onwater);
     199                penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties);
     200
     201                /*Delete properties: */
     202                delete penta_properties;
    200203
    201204                /*Add penta element to elements dataset: */
  • issm/trunk/src/c/ModelProcessorx/Prognostic/CreateElementsNodesAndMaterialsPrognostic.cpp

    r3332 r3383  
    1010#include "../../shared/shared.h"
    1111#include "../../MeshPartitionx/MeshPartitionx.h"
     12#include "../../include/typedefs.h"
    1213#include "../IoModel.h"
    1314
     
    3435        Matice*     matice  = NULL;
    3536        Matpar*     matpar  = NULL;
     37        ElementProperties* tria_properties=NULL;
     38        ElementProperties* penta_properties=NULL;
    3639
    3740        /*output: */
     
    4851        /*tria constructor input: */
    4952        int tria_id;
    50         int tria_mid;
    51         int tria_mparid;
    52         int tria_numparid;
    53         int tria_g[3];
     53        int tria_matice_id;
     54        int tria_matpar_id;
     55        int tria_numpar_id;
     56        int tria_node_ids[3];
    5457        double tria_h[3];
    5558        double tria_s[3];
    5659        double tria_b[3];
    57         double tria_k[3];
    58         double tria_melting[3];
    59         double tria_accumulation[3];
    60         double tria_geothermalflux[3];
    61         int    tria_friction_type;
    62         double tria_p;
    63         double tria_q;
    6460        int    tria_shelf;
    6561        bool   tria_onwater;
     
    7369
    7470        int penta_id;
    75         int penta_mid;
    76         int penta_mparid;
    77         int penta_numparid;
    78         int penta_g[6];
     71        int penta_matice_id;
     72        int penta_matpar_id;
     73        int penta_numpar_id;
     74        int penta_node_ids[6];
    7975        double penta_h[6];
    8076        double penta_s[6];
    8177        double penta_b[6];
    82         double penta_k[6];
    83         int penta_friction_type;
    84         double penta_p;
    85         double penta_q;
    8678        int penta_shelf;
    8779        int penta_onbed;
    8880        int penta_onsurface;
    8981        int penta_collapse;
    90         double penta_melting[6];
    91         double penta_accumulation[6];
    92         double penta_geothermalflux[6];
    93         int penta_thermal_steadystate;
    9482        bool   penta_onwater;
    9583
     
    191179                        /*ids: */
    192180                        tria_id=i+1; //matlab indexing.
    193                         tria_mid=-1; //no need for materials
    194                         tria_mparid=-1; //no need for materials
    195                         tria_numparid=1;
     181                        tria_matice_id=-1; //no need for materials
     182                        tria_matpar_id=-1; //no need for materials
     183                        tria_numpar_id=1;
    196184
    197185                        /*vertices offsets: */
    198                         tria_g[0]=(int)*(iomodel->elements+elements_width*i+0);
    199                         tria_g[1]=(int)*(iomodel->elements+elements_width*i+1);
    200                         tria_g[2]=(int)*(iomodel->elements+elements_width*i+2);
     186                        tria_node_ids[0]=(int)*(iomodel->elements+elements_width*i+0);
     187                        tria_node_ids[1]=(int)*(iomodel->elements+elements_width*i+1);
     188                        tria_node_ids[2]=(int)*(iomodel->elements+elements_width*i+2);
    201189
    202190                        /*thickness,surface and bed:*/
     
    217205                        tria_onwater=(bool)*(iomodel->elementonwater+i);
    218206
     207                        /*Create properties: */
     208                        tria_properties=new ElementProperties(3,tria_h, tria_s, tria_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, tria_shelf, UNDEF, tria_onwater, UNDEF, UNDEF, UNDEF);
     209
    219210                        /*Create tria element using its constructor:*/
    220                         tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater);
     211                        tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties);
     212
     213                        /*Delete properties: */
     214                        delete tria_properties;
    221215
    222216                        /*Add tria element to elements dataset: */
     
    270264                        /*name and id: */
    271265                        penta_id=i+1; //matlab indexing.
    272                         penta_mid=-1;
    273                         penta_mparid=-1; //no need for materials
    274                         penta_numparid=1;
     266                        penta_matice_id=-1;
     267                        penta_matpar_id=-1; //no need for materials
     268                        penta_numpar_id=1;
    275269
    276270                        /*vertices,thickness,surface,bed and drag: */
    277271                        for(j=0;j<6;j++){
    278                                 penta_g[j]=(int)*(iomodel->elements+elements_width*i+j);
     272                                penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j);
    279273                                penta_h[j]=*(iomodel->thickness+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    280274                                penta_s[j]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+j)-1));
     
    289283                        penta_onwater=(bool)*(iomodel->elementonwater+i);
    290284       
     285                        /*Create properties: */
     286                        penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF);
    291287
    292288                        /*Create Penta using its constructor:*/
    293                         penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,
    294                                         penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface,
    295                                         penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,
    296                                         penta_thermal_steadystate,penta_onwater);
     289                        penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties);
     290
     291                        /*Delete properties: */
     292                        delete penta_properties;
    297293
    298294                        /*Add penta element to elements dataset: */
  • issm/trunk/src/c/ModelProcessorx/Prognostic2/CreateElementsNodesAndMaterialsPrognostic2.cpp

    r3378 r3383  
    3030        Matice* matice  = NULL;
    3131        Matpar* matpar  = NULL;
     32        ElementProperties* tria_properties=NULL;
    3233
    3334        /*output: */
     
    4344        /*tria constructor input: */
    4445        int tria_id;
    45         int tria_mid;
    46         int tria_mparid;
    47         int tria_numparid;
    48         int tria_g[3];
     46        int tria_matice_id;
     47        int tria_matpar_id;
     48        int tria_numpar_id;
     49        int tria_node_ids[3];
    4950        double tria_h[3];
    5051        double tria_s[3];
    5152        double tria_b[3];
    52         double tria_k[3];
    53         double tria_melting[3];
    54         double tria_accumulation[3];
    55         double tria_geothermalflux[3];
    56         int    tria_friction_type;
    57         double tria_p;
    58         double tria_q;
    5953        int    tria_shelf;
    6054        bool   tria_onwater;
     
    7670        double penta_b[6];
    7771        double penta_k[6];
    78         int penta_friction_type;
    7972        double penta_p;
    8073        double penta_q;
     
    8578        double penta_melting[6];
    8679        double penta_accumulation[6];
    87         double penta_geothermalflux[6];
    8880        int penta_thermal_steadystate;
    8981        bool   penta_onwater;
     
    188180                        /*ids: */
    189181                        tria_id=i+1; //matlab indexing.
    190                         tria_mid=-1; //no need for materials
    191                         tria_mparid=-1; //no need for materials
    192                         tria_numparid=1;
     182                        tria_matice_id=-1; //no need for materials
     183                        tria_matpar_id=-1; //no need for materials
     184                        tria_numpar_id=1;
    193185
    194186                        /*vertices offsets: */
    195                         tria_g[0]=3*i+1;
    196                         tria_g[1]=3*i+2;
    197                         tria_g[2]=3*i+3;
     187                        tria_node_ids[0]=3*i+1;
     188                        tria_node_ids[1]=3*i+2;
     189                        tria_node_ids[2]=3*i+3;
    198190
    199191                        /*thickness,surface and bed:*/
     
    214206                        tria_onwater=(bool)*(iomodel->elementonwater+i);
    215207
     208                        /*Create properties: */
     209                        tria_properties=new ElementProperties(3,tria_h, tria_s, tria_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, tria_shelf, UNDEF, tria_onwater, UNDEF, UNDEF, UNDEF);
     210
    216211                        /*Create tria element using its constructor:*/
    217                         tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater);
     212                        tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties);
     213
     214                        /*Delete properties: */
     215                        delete tria_properties;
    218216
    219217                        /*Add tria element to elements dataset: */
  • issm/trunk/src/c/ModelProcessorx/SlopeCompute/CreateElementsNodesAndMaterialsSlopeCompute.cpp

    r3332 r3383  
    99#include "../../objects/objects.h"
    1010#include "../../shared/shared.h"
     11#include "../../include/typedefs.h"
    1112#include "../../MeshPartitionx/MeshPartitionx.h"
    1213#include "../IoModel.h"
    13 
    1414
    1515void    CreateElementsNodesAndMaterialsSlopeCompute(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
     
    3232        Tria*       tria = NULL;
    3333        Penta*      penta = NULL;
     34        ElementProperties* tria_properties=NULL;
     35        ElementProperties* penta_properties=NULL;
    3436
    3537        /*output: */
     
    4446        /*tria constructor input: */
    4547        int tria_id;
    46         int tria_mid;
    47         int tria_mparid;
    48         int tria_numparid;
    49         int tria_g[3];
    50         double tria_h[3];
     48        int tria_matice_id;
     49        int tria_matpar_id;
     50        int tria_numpar_id;
     51        int tria_node_ids[3];
    5152        double tria_s[3];
    5253        double tria_b[3];
    53         double tria_k[3];
    54         double tria_melting[3];
    55         double tria_accumulation[3];
    56         double tria_geothermalflux[3];
    57         int    tria_friction_type;
    58         double tria_p;
    59         double tria_q;
    60         int    tria_shelf;
    6154        bool   tria_onwater;
    6255
     
    6457
    6558        int penta_id;
    66         int penta_mid;
    67         int penta_mparid;
    68         int penta_numparid;
    69         int penta_g[6];
    70         double penta_h[6];
     59        int penta_matice_id;
     60        int penta_matpar_id;
     61        int penta_numpar_id;
     62        int penta_node_ids[6];
    7163        double penta_s[6];
    7264        double penta_b[6];
    73         double penta_k[6];
    74         int penta_friction_type;
    75         double penta_p;
    76         double penta_q;
    77         int penta_shelf;
    7865        int penta_onbed;
    79         int penta_onsurface;
    80         int penta_collapse;
    81         double penta_melting[6];
    82         double penta_accumulation[6];
    83         double penta_geothermalflux[6];
    84         int penta_thermal_steadystate;
    8566        bool   penta_onwater;
    8667
     
    171152                        /*ids: */
    172153                        tria_id=i+1; //matlab indexing.
    173                         tria_mid=-1; //no materials
    174                         tria_mparid=-1; //no materials
    175                         tria_numparid=1; //no materials
     154                        tria_matice_id=-1; //no materials
     155                        tria_matpar_id=-1; //no materials
     156                        tria_numpar_id=1; //no materials
    176157
    177158                        /*vertices offsets: */
    178                         tria_g[0]=(int)*(iomodel->elements+elements_width*i+0);
    179                         tria_g[1]=(int)*(iomodel->elements+elements_width*i+1);
    180                         tria_g[2]=(int)*(iomodel->elements+elements_width*i+2);
     159                        tria_node_ids[0]=(int)*(iomodel->elements+elements_width*i+0);
     160                        tria_node_ids[1]=(int)*(iomodel->elements+elements_width*i+1);
     161                        tria_node_ids[2]=(int)*(iomodel->elements+elements_width*i+2);
    181162
    182163                        /*surface and bed:*/
     
    192173                        tria_onwater=(bool)*(iomodel->elementonwater+i);
    193174
     175                        /*Create properties: */
     176                        tria_properties=new ElementProperties(3,NULL, tria_s, tria_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, tria_onwater, UNDEF, UNDEF, UNDEF);
     177
    194178                        /*Create tria element using its constructor:*/
    195                         tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater);
     179                        tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties);
     180
     181                        /*Delete properties: */
     182                        delete tria_properties;
    196183
    197184                        /*Add tria element to elements dataset: */
     
    240227                        /*name and id: */
    241228                        penta_id=i+1; //matlab indexing.
    242                         penta_mid=-1; //no materials
    243                         penta_mparid=-1; //no materials
    244                         penta_numparid=1; //no materials
     229                        penta_matice_id=-1; //no materials
     230                        penta_matpar_id=-1; //no materials
     231                        penta_numpar_id=1; //no materials
    245232                       
    246233
    247234                        /*vertices,thickness,surface,bed and drag: */
    248235                        for(j=0;j<6;j++){
    249                                 penta_g[j]=(int)*(iomodel->elements+elements_width*i+j);
     236                                penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j);
    250237                                penta_s[j]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    251238                                penta_b[j]=*(iomodel->bed+    ((int)*(iomodel->elements+elements_width*i+j)-1));
     
    256243                        penta_onwater=(bool)*(iomodel->elementonwater+i);
    257244
     245                        /*Create properties: */
     246                        penta_properties=new ElementProperties(6,NULL, penta_s, penta_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF,UNDEF,penta_onbed, penta_onwater, UNDEF, UNDEF, UNDEF);
     247                               
    258248                        /*Create Penta using its constructor:*/
    259                         penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,
    260                                         penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface,
    261                                         penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,
    262                                         penta_thermal_steadystate,penta_onwater);
     249                        penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties);
     250
     251                        /*Delete properties: */
     252                        delete penta_properties;
    263253
    264254                        /*Add penta element to elements dataset: */
    265255                        elements->AddObject(penta);
    266256       
    267 
    268257                        #ifdef _PARALLEL_
    269258                        /*Now that we are here, we can also start building the list of grids belonging to this node partition: we use
  • issm/trunk/src/c/ModelProcessorx/Thermal/CreateElementsNodesAndMaterialsThermal.cpp

    r3332 r3383  
    77#include "../../EnumDefinitions/EnumDefinitions.h"
    88#include "../../objects/objects.h"
     9#include "../../include/typedefs.h"
    910#include "../../shared/shared.h"
    1011#include "../../MeshPartitionx/MeshPartitionx.h"
     
    3132        Matice*     matice  = NULL;
    3233        Matpar*     matpar  = NULL;
     34        ElementProperties* penta_properties=NULL;
    3335
    3436        /*output: */
     
    5153
    5254        int penta_id;
    53         int penta_mid;
    54         int penta_mparid;
    55         int penta_numparid;
    56         int penta_g[6];
     55        int penta_matice_id;
     56        int penta_matpar_id;
     57        int penta_numpar_id;
     58        int penta_node_ids[6];
    5759        double penta_h[6];
    5860        double penta_s[6];
     
    6668        int penta_onsurface;
    6769        int penta_collapse;
    68         double penta_melting[6];
    69         double penta_accumulation[6];
    7070        double penta_geothermalflux[6];
    71         int penta_thermal_steadystate;
    7271        bool   penta_onwater;
    7372
     
    162161                /*name and id: */
    163162                penta_id=i+1; //matlab indexing.
    164                 penta_mid=i+1; //refers to the corresponding material property card
    165                 penta_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card
    166                 penta_numparid=1;
     163                penta_matice_id=i+1; //refers to the corresponding material property card
     164                penta_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card
     165                penta_numpar_id=1;
    167166
    168167                /*vertices,thickness,surface,bed and drag: */
    169168                for(j=0;j<6;j++){
    170                         penta_g[j]=(int)*(iomodel->elements+elements_width*i+j);
     169                        penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j);
    171170                        penta_h[j]=*(iomodel->thickness+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    172171                        penta_s[j]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+j)-1));
     
    196195                }
    197196
     197                /*Create properties: */
     198                penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, penta_k, NULL, NULL, penta_geothermalflux, penta_friction_type, penta_p, penta_q, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF);
    198199
    199200                /*Create Penta using its constructor:*/
    200                 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,
    201                                 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface,
    202                                 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,
    203                                 penta_thermal_steadystate,penta_onwater);
     201                penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties);
     202
     203                /*Delete properties: */
     204                delete penta_properties;
    204205
    205206                /*Add penta element to elements dataset: */
    206207                elements->AddObject(penta);
    207 
    208208
    209209                /*Deal with material:*/
  • issm/trunk/src/c/objects/Penta.cpp

    r3332 r3383  
    1818
    1919/*Object constructors and destructor*/
    20 /*FUNCTION Penta constructor {{{1*/
     20/*FUNCTION Penta default constructor {{{1*/
    2121Penta::Penta(){
    2222        return;
    2323}
    2424/*}}}*/
    25 /*FUNCTION Penta creation {{{1*/
    26 Penta::Penta( int penta_id, int penta_mid, int penta_mparid, int penta_numparid, int penta_node_ids[6], double penta_h[6], double penta_s[6], double penta_b[6], double penta_k[6], int penta_friction_type,
    27                         double penta_p, double penta_q, int penta_shelf, int penta_onbed, int penta_onsurface,  int penta_collapse, double penta_melting[6], double penta_accumulation[6], double penta_geothermalflux[6],
    28                         int penta_thermal_steadystate,bool penta_onwater){
    29 
    30         int i;
    31 
    32         id = penta_id;
    33         mid = penta_mid;
    34         mparid = penta_mparid;
    35         numparid=penta_numparid;
    36 
    37         for(i =0;i<6;i++){
    38                 node_ids[i] = penta_node_ids[i];
    39                 node_offsets[i]=UNDEF;
    40                 nodes[i]=NULL;
    41                 h[i] = penta_h[i];
    42                 s[i] = penta_s[i];
    43                 b[i] = penta_b[i];
    44                 k[i] = penta_k[i];
    45                 melting[i] = penta_melting[i];
    46                 accumulation[i] = penta_accumulation[i] ;
    47                 geothermalflux[i] = penta_geothermalflux[i];
    48         }
    49         matice=NULL;
    50         matice_offset=UNDEF;
    51         matpar=NULL;
    52         matpar_offset=UNDEF;
    53         numpar=NULL;
    54         numpar_offset=UNDEF;
    55 
    56         friction_type = penta_friction_type;
    57         p = penta_p;
    58         q = penta_q;
    59         shelf = penta_shelf;
    60         onbed = penta_onbed;
    61         onwater = penta_onwater;
    62         onsurface = penta_onsurface;
    63         collapse = penta_collapse;
    64         thermal_steadystate = penta_thermal_steadystate;
     25/*FUNCTION Penta constructor {{{1*/
     26Penta::Penta(int penta_id,int* penta_node_ids, int penta_matice_id, int penta_matpar_id, int penta_numpar_id, ElementProperties* pentaproperties):
     27        hnodes(penta_node_ids,3),
     28        hmatice(&penta_matice_id,1),
     29        hmatpar(&penta_matpar_id,1),
     30        hnumpar(&penta_numpar_id,1),
     31        properties(pentaproperties)
     32{
     33
     34        /*all the initialization has been done by the initializer, just fill in the id: */
     35        this->id=penta_id;
    6536
    6637        return;
     
    9162        /*marshall Penta data: */
    9263        memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    93         memcpy(marshalled_dataset,&mid,sizeof(mid));marshalled_dataset+=sizeof(mid);
    94         memcpy(marshalled_dataset,&mparid,sizeof(mparid));marshalled_dataset+=sizeof(mparid);
    95         memcpy(marshalled_dataset,&node_ids,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids);
    96         memcpy(marshalled_dataset,&nodes,sizeof(nodes));marshalled_dataset+=sizeof(nodes);
    97         memcpy(marshalled_dataset,&node_offsets,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets);
    98         memcpy(marshalled_dataset,&matice,sizeof(matice));marshalled_dataset+=sizeof(matice);
    99         memcpy(marshalled_dataset,&matice_offset,sizeof(matice_offset));marshalled_dataset+=sizeof(matice_offset);
    100         memcpy(marshalled_dataset,&matpar,sizeof(matpar));marshalled_dataset+=sizeof(matpar);
    101         memcpy(marshalled_dataset,&matpar_offset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset);
    102         memcpy(marshalled_dataset,&numparid,sizeof(numparid));marshalled_dataset+=sizeof(numparid);
    103         memcpy(marshalled_dataset,&numpar,sizeof(numpar));marshalled_dataset+=sizeof(numpar);
    104         memcpy(marshalled_dataset,&numpar_offset,sizeof(numpar_offset));marshalled_dataset+=sizeof(numpar_offset);
    105         memcpy(marshalled_dataset,&h,sizeof(h));marshalled_dataset+=sizeof(h);
    106         memcpy(marshalled_dataset,&s,sizeof(s));marshalled_dataset+=sizeof(s);
    107         memcpy(marshalled_dataset,&b,sizeof(b));marshalled_dataset+=sizeof(b);
    108         memcpy(marshalled_dataset,&k,sizeof(k));marshalled_dataset+=sizeof(k);
    109         memcpy(marshalled_dataset,&friction_type,sizeof(friction_type));marshalled_dataset+=sizeof(friction_type);
    110         memcpy(marshalled_dataset,&p,sizeof(p));marshalled_dataset+=sizeof(p);
    111         memcpy(marshalled_dataset,&q,sizeof(q));marshalled_dataset+=sizeof(q);
    112         memcpy(marshalled_dataset,&shelf,sizeof(shelf));marshalled_dataset+=sizeof(shelf);
    113         memcpy(marshalled_dataset,&onbed,sizeof(onbed));marshalled_dataset+=sizeof(onbed);
    114         memcpy(marshalled_dataset,&onwater,sizeof(onwater));marshalled_dataset+=sizeof(onwater);
    115         memcpy(marshalled_dataset,&onsurface,sizeof(onsurface));marshalled_dataset+=sizeof(onsurface);
    116         memcpy(marshalled_dataset,&collapse,sizeof(collapse));marshalled_dataset+=sizeof(collapse);
    117         memcpy(marshalled_dataset,&melting,sizeof(melting));marshalled_dataset+=sizeof(melting);
    118         memcpy(marshalled_dataset,&accumulation,sizeof(accumulation));marshalled_dataset+=sizeof(accumulation);
    119         memcpy(marshalled_dataset,&geothermalflux,sizeof(geothermalflux));marshalled_dataset+=sizeof(geothermalflux);
    120         memcpy(marshalled_dataset,&thermal_steadystate,sizeof(thermal_steadystate));marshalled_dataset+=sizeof(thermal_steadystate);
     64
     65        /*Marshall hooks: */
     66        hnodes.Marshall(&marshalled_dataset);
     67        hmatice.Marshall(&marshalled_dataset);
     68        hmatpar.Marshall(&marshalled_dataset);
     69        hnumpar.Marshall(&marshalled_dataset);
     70
     71        /*Marshall properties: */
     72        properties.Marshall(&marshalled_dataset);
    12173
    12274        *pmarshalled_dataset=marshalled_dataset;
     
    12678/*FUNCTION MarshallSize {{{1*/
    12779int   Penta::MarshallSize(){
    128 
    129         return sizeof(id)+
    130           sizeof(mid)+
    131           sizeof(mparid)+
    132           sizeof(node_ids)+
    133           sizeof(nodes)+
    134           sizeof(node_offsets)+
    135           sizeof(matice)+
    136           sizeof(matice_offset)+
    137           sizeof(matpar)+
    138           sizeof(matpar_offset)+
    139           +sizeof(numparid)+
    140           +sizeof(numpar)+
    141           +sizeof(numpar_offset)+
    142           sizeof(h)+
    143           sizeof(s)+
    144           sizeof(b)+
    145           sizeof(k)+
    146           sizeof(friction_type)+
    147           sizeof(p)+
    148           sizeof(q)+
    149           sizeof(shelf)+
    150           sizeof(onbed)+
    151           sizeof(onwater)+
    152           sizeof(onsurface)+
    153           sizeof(collapse)+
    154           sizeof(melting)+
    155           sizeof(accumulation)+
    156           sizeof(geothermalflux)+
    157           sizeof(thermal_steadystate) +
    158           sizeof(int); //sizeof(int) for enum type
     80       
     81        return sizeof(id)
     82                +hnodes.MarshallSize()
     83                +hmatice.MarshallSize()
     84                +hmatpar.MarshallSize()
     85                +hnumpar.MarshallSize()
     86                +properties.MarshallSize()
     87                +sizeof(int); //sizeof(int) for enum type
    15988}
    16089/*}}}*/
     
    16291void  Penta::Demarshall(char** pmarshalled_dataset){
    16392
    164         int i;
    16593        char* marshalled_dataset=NULL;
     94        int   i;
    16695
    16796        /*recover marshalled_dataset: */
     
    172101
    173102        memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    174         memcpy(&mid,marshalled_dataset,sizeof(mid));marshalled_dataset+=sizeof(mid);
    175         memcpy(&mparid,marshalled_dataset,sizeof(mparid));marshalled_dataset+=sizeof(mparid);
    176         memcpy(&node_ids,marshalled_dataset,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids);
    177         memcpy(&nodes,marshalled_dataset,sizeof(nodes));marshalled_dataset+=sizeof(nodes);
    178         memcpy(&node_offsets,marshalled_dataset,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets);
    179         memcpy(&matice,marshalled_dataset,sizeof(matice));marshalled_dataset+=sizeof(matice);
    180         memcpy(&matice_offset,marshalled_dataset,sizeof(matice_offset));marshalled_dataset+=sizeof(matice_offset);
    181         memcpy(&matpar,marshalled_dataset,sizeof(matpar));marshalled_dataset+=sizeof(matpar);
    182         memcpy(&matpar_offset,marshalled_dataset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset);
    183         memcpy(&numparid,marshalled_dataset,sizeof(numparid));marshalled_dataset+=sizeof(numparid);
    184         memcpy(&numpar,marshalled_dataset,sizeof(numpar));marshalled_dataset+=sizeof(numpar);
    185         memcpy(&numpar_offset,marshalled_dataset,sizeof(numpar_offset));marshalled_dataset+=sizeof(numpar_offset);
    186         memcpy(&h,marshalled_dataset,sizeof(h));marshalled_dataset+=sizeof(h);
    187         memcpy(&s,marshalled_dataset,sizeof(s));marshalled_dataset+=sizeof(s);
    188         memcpy(&b,marshalled_dataset,sizeof(b));marshalled_dataset+=sizeof(b);
    189         memcpy(&k,marshalled_dataset,sizeof(k));marshalled_dataset+=sizeof(k);
    190         memcpy(&friction_type,marshalled_dataset,sizeof(friction_type));marshalled_dataset+=sizeof(friction_type);
    191         memcpy(&p,marshalled_dataset,sizeof(p));marshalled_dataset+=sizeof(p);
    192         memcpy(&q,marshalled_dataset,sizeof(q));marshalled_dataset+=sizeof(q);
    193         memcpy(&shelf,marshalled_dataset,sizeof(shelf));marshalled_dataset+=sizeof(shelf);
    194         memcpy(&onbed,marshalled_dataset,sizeof(onbed));marshalled_dataset+=sizeof(onbed);
    195         memcpy(&onwater,marshalled_dataset,sizeof(onwater));marshalled_dataset+=sizeof(onwater);
    196         memcpy(&onsurface,marshalled_dataset,sizeof(onsurface));marshalled_dataset+=sizeof(onsurface);
    197         memcpy(&collapse,marshalled_dataset,sizeof(collapse));marshalled_dataset+=sizeof(collapse);
    198         memcpy(&melting,marshalled_dataset,sizeof(melting));marshalled_dataset+=sizeof(melting);
    199         memcpy(&accumulation,marshalled_dataset,sizeof(accumulation));marshalled_dataset+=sizeof(accumulation);
    200         memcpy(&geothermalflux,marshalled_dataset,sizeof(geothermalflux));marshalled_dataset+=sizeof(geothermalflux);
    201         memcpy(&thermal_steadystate,marshalled_dataset,sizeof(thermal_steadystate));marshalled_dataset+=sizeof(thermal_steadystate);
    202 
    203         /*nodes and materials are not pointing to correct objects anymore:*/
    204         for(i=0;i<6;i++)nodes[i]=NULL;
    205         matice=NULL;
    206         matpar=NULL;
    207         numpar=NULL;
     103
     104        /*demarshall hooks: */
     105        hnodes.Demarshall(&marshalled_dataset);
     106        hmatice.Demarshall(&marshalled_dataset);
     107        hmatpar.Demarshall(&marshalled_dataset);
     108        hnumpar.Demarshall(&marshalled_dataset);
     109
     110        /*demarshall properties: */
     111        properties.Demarshall(&marshalled_dataset);
    208112
    209113        /*return: */
    210114        *pmarshalled_dataset=marshalled_dataset;
    211115        return;
     116}
     117/*}}}*/
     118
     119/*Object processing: */
     120/*FUNCTION Echo{{{1*/
     121
     122void Penta::Echo(void){
     123
     124        printf("Penta:\n");
     125        printf("   id: %i\n",id);
     126        hnodes.Echo();
     127        hmatice.Echo();
     128        hmatpar.Echo();
     129        hnumpar.Echo();
     130        properties.Echo();
     131
     132        return;
     133}
     134/*}}}*/
     135/*FUNCTION DeepEcho{{{1*/
     136
     137void Penta::DeepEcho(void){
     138
     139        printf("Penta:\n");
     140        printf("   id: %i\n",id);
     141        hnodes.DeepEcho();
     142        hmatice.DeepEcho();
     143        hmatpar.DeepEcho();
     144        hnumpar.DeepEcho();
     145        properties.DeepEcho();
     146
     147        return;
     148}
     149/*}}}*/
     150/*FUNCTION Configure {{{1*/
     151void  Penta::Configure(void* ploadsin,void* pnodesin,void* pmaterialsin,void* pparametersin){
     152
     153        int i;
     154
     155        DataSet* loadsin=NULL;
     156        DataSet* nodesin=NULL;
     157        DataSet* materialsin=NULL;
     158        DataSet* parametersin=NULL;
     159
     160        /*Recover pointers :*/
     161        loadsin=(DataSet*)ploadsin;
     162        nodesin=(DataSet*)pnodesin;
     163        materialsin=(DataSet*)pmaterialsin;
     164        parametersin=(DataSet*)pparametersin;
     165
     166        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
     167         * datasets, using internal ids and offsets hidden in hooks: */
     168        hnodes.configure(nodesin);
     169        hmatice.configure(materialsin);
     170        hmatpar.configure(materialsin);
     171        hnumpar.configure(parametersin);
     172
     173}
     174/*}}}*/
     175/*FUNCTION SpawnTria {{{1*/
     176void*  Penta::SpawnTria(int g0, int g1, int g2){
     177
     178        /*out of grids g0,g1 and g2 from Penta, build a tria element: */
     179        Tria* tria=NULL;
     180        int indices[3];
     181        Hook* tria_hnodes=NULL;
     182        Hook* tria_hmatice=NULL;
     183        Hook* tria_hmatpar=NULL;
     184        Hook* tria_hnumpar=NULL;
     185        ElementProperties* tria_properties=NULL;
     186
     187        indices[0]=g0;
     188        indices[1]=g1;
     189        indices[2]=g2;
     190
     191        tria_hnodes=this->hnodes.Spawn(indices,3);
     192        tria_hmatice=this->hmatice.Spawn(indices,3);
     193        tria_hmatpar=this->hmatpar.Spawn(indices,3);
     194        tria_hnumpar=this->hnumpar.Spawn(indices,3);
     195        tria_properties=(ElementProperties*)this->properties.Spawn(indices,3);
     196
     197        tria=new Tria(this->id,tria_hnodes,tria_hmatice,tria_hmatpar,tria_hnumpar,tria_properties);
     198
     199        delete tria_hnodes;
     200        delete tria_hmatice;
     201        delete tria_hmatpar;
     202        delete tria_hnumpar;
     203        delete tria_properties;
     204
     205        return tria;
    212206}
    213207/*}}}*/
     
    224218        double       xyz_list[numgrids][3];
    225219
     220        /*dynamic objects pointed to by hooks: */
     221        Node**  nodes=NULL;
     222        Matpar* matpar=NULL;
     223
     224        /*recover objects from hooks: */
     225        nodes=(Node**)hnodes.deliverp();
     226        matpar=(Matpar*)hmatpar.delivers();
     227
    226228        /*If on water, skip: */
    227         if(onwater)return;
     229        if(this->properties.onwater)return;
    228230
    229231        /*Get node data: */
     
    240242        g=matpar->GetG();
    241243        for(i=0;i<numgrids;i++){
    242                 pressure[i]=rho_ice*g*(s[i]-xyz_list[i][2]);
     244                pressure[i]=rho_ice*g*(this->properties.s[i]-xyz_list[i][2]);
    243245        }
    244246
    245247        /*plug local pressure values into global pressure vector: */
    246248        VecSetValues(pg,numgrids,doflist,(const double*)pressure,INSERT_VALUES);
    247 
    248 }
    249 /*}}}*/
    250 /*FUNCTION Configure {{{1*/
    251 void  Penta::Configure(void* ploadsin,void* pnodesin,void* pmaterialsin,void* pparametersin){
    252 
    253         int i;
    254 
    255         DataSet* loadsin=NULL;
    256         DataSet* nodesin=NULL;
    257         DataSet* materialsin=NULL;
    258         DataSet* parametersin=NULL;
    259 
    260         /*Recover pointers :*/
    261         loadsin=(DataSet*)ploadsin;
    262         nodesin=(DataSet*)pnodesin;
    263         materialsin=(DataSet*)pmaterialsin;
    264         parametersin=(DataSet*)pparametersin;
    265 
    266         /*Link this element with its nodes, ie find pointers to the nodes in the nodes dataset.: */
    267         ResolvePointers((Object**)nodes,node_ids,node_offsets,6,nodesin);
    268 
    269         /*Same for materials: */
    270         ResolvePointers((Object**)&matice,&mid,&matice_offset,1,materialsin);
    271         ResolvePointers((Object**)&matpar,&mparid,&matpar_offset,1,materialsin);
    272 
    273         /*Same for numpar: */
    274         ResolvePointers((Object**)&numpar,&numparid,&numpar_offset,1,parametersin);
    275249
    276250}
     
    288262
    289263        /*If on water, return 0: */
    290         if(onwater)return 0;
     264        if(this->properties.onwater)return 0;
    291265
    292266        /*Bail out if this element if:
    293267         * -> Non collapsed and not on the surface
    294268         * -> collapsed (2d model) and not on bed) */
    295         if ((!collapse && !onsurface) || (collapse && !onbed)){
     269        if ((!this->properties.collapse && !this->properties.onsurface) || (this->properties.collapse && !this->properties.onbed)){
    296270                return 0;
    297271        }
    298         else if (collapse){
     272        else if (this->properties.collapse){
    299273
    300274                /*This element should be collapsed into a tria element at its base. Create this tria element,
     
    379353
    380354        /*If on water, skip: */
    381         if(onwater)return;
     355        if(this->properties.onwater)return;
    382356
    383357        /*Is this element on the bed? :*/
    384         if(!onbed)return;
     358        if(!this->properties.onbed)return;
    385359
    386360        /*Spawn Tria element from the base of the Penta: */
     
    400374
    401375        /*If on water, skip: */
    402         if(onwater)return;
     376        if(this->properties.onwater)return;
    403377
    404378        /*Is this element on the bed? :*/
    405         if(!onbed)return;
     379        if(!this->properties.onbed)return;
    406380
    407381        /*Spawn Tria element from the base of the Penta: */
     
    498472        Tria*  tria=NULL;
    499473
     474        /*dynamic objects pointed to by hooks: */
     475        Node**  nodes=NULL;
     476        Matice* matice=NULL;
     477        Numpar* numpar=NULL;
     478
     479        /*recover objects from hooks: */
     480        nodes=(Node**)hnodes.deliverp();
     481        matice=(Matice*)hmatice.delivers();
     482        numpar=(Numpar*)hnumpar.delivers();
     483
    500484        /*If on water, skip stiffness: */
    501         if(onwater)return;
     485        if(this->properties.onwater)return;
    502486
    503487        /*recover pointers: */
     
    509493
    510494
    511         if ((collapse==1) && (onbed==0)){
     495        if ((this->properties.collapse==1) && (this->properties.onbed==0)){
    512496                /*This element should be collapsed, but this element is not on the bedrock, therefore all its
    513497                 * dofs have already been frozen! Do nothing: */
    514498                return;
    515499        }
    516         else if ((collapse==1) && (onbed==1)){
     500        else if ((this->properties.collapse==1) && (this->properties.onbed==1)){
    517501
    518502                /*This element should be collapsed into a tria element at its base. Create this tria element,
     
    643627
    644628                //Deal with 2d friction at the bedrock interface
    645                 if((onbed && !shelf)){
     629                if((this->properties.onbed && !this->properties.shelf)){
    646630
    647631                        /*Build a tria element using the 3 grids of the base of the penta. Then use
     
    744728        ParameterInputs* inputs=NULL;
    745729
     730        /*dynamic objects pointed to by hooks: */
     731        Node**  nodes=NULL;
     732        Matpar* matpar=NULL;
     733        Matice* matice=NULL;
     734        Numpar* numpar=NULL;
     735
    746736        /*If on water, skip stiffness: */
    747         if(onwater)return;
     737        if(this->properties.onwater)return;
     738
     739        /*recover objects from hooks: */
     740        nodes=(Node**)hnodes.deliverp();
     741        matpar=(Matpar*)hmatpar.delivers();
     742        matice=(Matice*)hmatice.delivers();
     743        numpar=(Numpar*)hnumpar.delivers();
    748744
    749745        /*recover pointers: */
     
    831827        }
    832828
    833         if((onbed==1) && (shelf==0)){
     829        if((this->properties.onbed==1) && (this->properties.shelf==0)){
    834830
    835831                /*Build alpha2_list used by drag stiffness matrix*/
     
    843839                friction->rho_ice=matpar->GetRhoIce();
    844840                friction->rho_water=matpar->GetRhoWater();
    845                 friction->K=&k[0];
    846                 friction->bed=&b[0];
    847                 friction->thickness=&h[0];
     841                friction->K=&this->properties.k[0];
     842                friction->bed=&this->properties.b[0];
     843                friction->thickness=&this->properties.h[0];
    848844                friction->velocities=&vxvyvz_list[0][0];
    849                 friction->p=p;
    850                 friction->q=q;
     845                friction->p=this->properties.p;
     846                friction->q=this->properties.q;
    851847                friction->analysis_type=analysis_type;
    852848
     
    926922                        }
    927923                }
    928         } //if ( (onbed==1) && (shelf==0))
     924        } //if ( (this->properties.onbed==1) && (shelf==0))
    929925
    930926        /*Reduce the matrix */
     
    990986        double  DL_scalar;
    991987
     988        /*dynamic objects pointed to by hooks: */
     989        Node**  nodes=NULL;
     990
     991        /*recover objects from hooks: */
     992        nodes=(Node**)hnodes.deliverp();
     993
    992994        ParameterInputs* inputs=NULL;
    993995
     
    996998
    997999        /*If on water, skip stiffness: */
    998         if(onwater)return;
     1000        if(this->properties.onwater)return;
    9991001
    10001002        /*recover pointers: */
     
    10041006        /*If this element  is on the surface, we have a dynamic boundary condition that applies, as a stiffness
    10051007         * matrix: */
    1006         if(onsurface){
     1008        if(this->properties.onsurface){
    10071009                tria=(Tria*)SpawnTria(3,4,5); //nodes 3,4 and 5 are on the surface
    10081010                tria->CreateKMatrixDiagnosticSurfaceVert(Kgg,inputs, analysis_type,sub_analysis_type);
     
    10961098
    10971099        /*If on water, skip: */
    1098         if(onwater)return;
    1099 
    1100         if (!onbed){
     1100        if(this->properties.onwater)return;
     1101
     1102        if (!this->properties.onbed){
    11011103                return;
    11021104        }
     
    11181120
    11191121        /*If on water, skip: */
    1120         if(onwater)return;
     1122        if(this->properties.onwater)return;
    11211123
    11221124        /*Is this element on the bed? :*/
    1123         if(!onbed)return;
     1125        if(!this->properties.onbed)return;
    11241126
    11251127        /*Spawn Tria element from the base of the Penta: */
     
    11391141
    11401142        /*If on water, skip: */
    1141         if(onwater)return;
     1143        if(this->properties.onwater)return;
    11421144
    11431145        /*Is this element on the bed? :*/
    1144         if(!onbed)return;
     1146        if(!this->properties.onbed)return;
    11451147
    11461148        /*Spawn Tria element from the base of the Penta: */
     
    12271229        double     mixed_layer_capacity,thermal_exchange_velocity;
    12281230
     1231        /*dynamic objects pointed to by hooks: */
     1232        Node**  nodes=NULL;
     1233        Matpar* matpar=NULL;
     1234        Numpar* numpar=NULL;
     1235
    12291236        /*Collapsed formulation: */
    12301237        Tria*  tria=NULL;
     
    12321239
    12331240        /*If on water, skip: */
    1234         if(onwater)return;
     1241        if(this->properties.onwater)return;
     1242
     1243        /*recover objects from hooks: */
     1244        nodes=(Node**)hnodes.deliverp();
     1245        matpar=(Matpar*)hmatpar.delivers();
     1246        numpar=(Numpar*)hnumpar.delivers();
    12351247
    12361248        /*recover pointers: */
     
    13971409
    13981410        //Ice/ocean heat exchange flux on ice shelf base
    1399         if(onbed && shelf){
     1411        if(this->properties.onbed && this->properties.shelf){
    14001412
    14011413                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
     
    14671479
    14681480        /*If on water, skip: */
    1469         if(onwater)return;
     1481        if(this->properties.onwater)return;
    14701482
    14711483        /*Is this element on the bed? :*/
    1472         if(!onbed)return;
     1484        if(!this->properties.onbed)return;
    14731485
    14741486        /*Spawn Tria element from the base of the Penta: */
     
    14871499
    14881500        /*If on water, skip: */
    1489         if(onwater)return;
     1501        if(this->properties.onwater)return;
    14901502
    14911503        /*Is this element on the bed? :*/
    1492         if(!onbed)return;
     1504        if(!this->properties.onbed)return;
    14931505
    14941506        /*Spawn Tria element from the base of the Penta: */
     
    15451557        ParameterInputs* inputs=NULL;
    15461558
     1559        /*dynamic objects pointed to by hooks: */
     1560        Node**  nodes=NULL;
     1561        Matpar* matpar=NULL;
     1562
    15471563        /*Spawning: */
    15481564        Tria* tria=NULL;
    15491565
    15501566        /*If on water, skip load: */
    1551         if(onwater)return;
     1567        if(this->properties.onwater)return;
    15521568
    15531569        /*recover pointers: */
    15541570        inputs=(ParameterInputs*)vinputs;
     1571
     1572        /*recover objects from hooks: */
     1573        nodes=(Node**)hnodes.deliverp();
     1574        matpar=(Matpar*)hmatpar.delivers();
    15551575
    15561576
     
    15591579          the load vector. */
    15601580
    1561         if ((collapse==1) && (onbed==0)){
     1581        if ((this->properties.collapse==1) && (this->properties.onbed==0)){
    15621582                /*This element should be collapsed, but this element is not on the bedrock, therefore all its
    15631583                 * dofs have already been frozen! Do nothing: */
    15641584                return;
    15651585        }
    1566         else if ((collapse==1) && (onbed==1)){
     1586        else if ((this->properties.collapse==1) && (this->properties.onbed==1)){
    15671587
    15681588                /*This element should be collapsed into a tria element at its base. Create this tria element,
     
    16131633
    16141634                                /*Compute thickness at gaussian point: */
    1615                                 GetParameterValue(&thickness, &h[0],gauss_coord);
     1635                                GetParameterValue(&thickness, &this->properties.h[0],gauss_coord);
    16161636
    16171637                                /*Compute slope at gaussian point: */
    1618                                 GetParameterDerivativeValue(&slope[0], &s[0],&xyz_list[0][0], gauss_coord);
     1638                                GetParameterDerivativeValue(&slope[0], &this->properties.s[0],&xyz_list[0][0], gauss_coord);
    16191639
    16201640                                /* Get Jacobian determinant: */
     
    16401660                } //for (ig1=0; ig1<num_area_gauss; ig1++)
    16411661
    1642         } //else if ((collapse==1) && (onbed==1))
     1662        } //else if ((collapse==1) && (this->properties.onbed==1))
    16431663
    16441664        /*Add pe_g to global vector pg: */
     
    17231743        Tria*            tria=NULL;
    17241744
     1745        /*dynamic objects pointed to by hooks: */
     1746        Node**  nodes=NULL;
     1747        Matpar* matpar=NULL;
     1748        Matice* matice=NULL;
     1749        Numpar* numpar=NULL;
     1750
    17251751        /*If on water, skip load: */
    1726         if(onwater)return;
     1752        if(this->properties.onwater)return;
    17271753
    17281754        /*recover pointers: */
    17291755        inputs=(ParameterInputs*)vinputs;
     1756
     1757        /*recover objects from hooks: */
     1758        nodes=(Node**)hnodes.deliverp();
     1759        matpar=(Matpar*)hmatpar.delivers();
     1760        matice=(Matice*)hmatice.delivers();
     1761        numpar=(Numpar*)hnumpar.delivers();
    17301762
    17311763        /* Set P_terms to 0: */
     
    18221854
    18231855        /*Deal with 2d friction at the bedrock interface: */
    1824         if ( (onbed==1) && (shelf==1)){
     1856        if ( (this->properties.onbed==1) && (this->properties.shelf==1)){
    18251857
    18261858                for(i=0;i<numgrids2d;i++){
     
    18491881
    18501882                        /* Get bed at gaussian point */
    1851                         GetParameterValue(&bed,&b[0],gauss_coord);
     1883                        GetParameterValue(&bed,&this->properties.b[0],gauss_coord);
    18521884
    18531885                        /*Get L matrix : */
     
    18701902                        }
    18711903                }
    1872         } //if ( (onbed==1) && (shelf==1))
     1904        } //if ( (this->properties.onbed==1) && (this->properties.shelf==1))
    18731905
    18741906        /*Reduce the matrix */
     
    19421974        int     dofs2[1]={1};
    19431975
     1976        /*dynamic objects pointed to by hooks: */
     1977        Node**  nodes=NULL;
     1978
    19441979        ParameterInputs* inputs=NULL;
     1980
     1981        /*recover objects from hooks: */
     1982        nodes=(Node**)hnodes.deliverp();
    19451983
    19461984        /*recover pointers: */
     
    19481986
    19491987        /*If on water, skip: */
    1950         if(onwater)return;
     1988        if(this->properties.onwater)return;
    19511989
    19521990        /*If we are on the bedrock, spawn a tria on the bedrock, and use it to build the
    19531991         *diagnostic base vertical stifness: */
    1954         if(onbed){
     1992        if(this->properties.onbed){
    19551993                tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 are on the bedrock
    19561994                tria->CreatePVectorDiagnosticBaseVert(pg,inputs, analysis_type,sub_analysis_type);
     
    20492087
    20502088        /*If on water, skip: */
    2051         if(onwater)return;
     2089        if(this->properties.onwater)return;
    20522090
    20532091        /*Is this element on the bed? :*/
    2054         if(!onbed)return;
     2092        if(!this->properties.onbed)return;
    20552093
    20562094        /*Spawn Tria element from the base of the Penta: */
     
    20692107
    20702108        /*If on water, skip: */
    2071         if(onwater)return;
     2109        if(this->properties.onwater)return;
    20722110
    20732111        /*Is this element on the bed? :*/
    2074         if(!onbed)return;
     2112        if(!this->properties.onbed)return;
    20752113
    20762114        /*Spawn Tria element from the base of the Penta: */
     
    21552193        ParameterInputs* inputs=NULL;
    21562194
     2195        /*dynamic objects pointed to by hooks: */
     2196        Node**  nodes=NULL;
     2197        Matpar* matpar=NULL;
     2198        Matice* matice=NULL;
     2199
    21572200        /*If on water, skip: */
    2158         if(onwater)return;
     2201        if(this->properties.onwater)return;
    21592202
    21602203        /*recover pointers: */
    21612204        inputs=(ParameterInputs*)vinputs;
     2205
     2206        /*recover objects from hooks: */
     2207        nodes=(Node**)hnodes.deliverp();
     2208        matpar=(Matpar*)hmatpar.delivers();
     2209        matice=(Matice*)hmatice.delivers();
    21622210
    21632211        /* Get node coordinates and dof list: */
     
    22492297
    22502298        /* Ice/ocean heat exchange flux on ice shelf base */
    2251         if(onbed && shelf){
     2299        if(this->properties.onbed && this->properties.shelf){
    22522300
    22532301                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
     
    22572305
    22582306        /* Geothermal flux on ice sheet base and basal friction */
    2259         if(onbed && !shelf){
     2307        if(this->properties.onbed && !this->properties.shelf){
    22602308
    22612309                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
     
    22742322}
    22752323/*}}}*/
    2276 /*FUNCTION DeepEcho {{{1*/
    2277 void Penta::DeepEcho(void){
    2278 
    2279         printf("Penta:\n");
    2280         printf("   id: %i\n",id);
    2281         printf("   mid: %i\n",mid);
    2282         printf("   mparid: %i\n",mparid);
    2283         printf("   numparid: %i\n",numparid);
    2284 
    2285         printf("   node_ids=[%i,%i,%i,%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2],node_ids[3],node_ids[4],node_ids[5]);
    2286         printf("   node_offsets=[%i,%i,%i,%i,%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2],node_offsets[3],node_offsets[4],node_offsets[5]);
    2287         printf("   matice_offset=%i\n",matice_offset);
    2288         printf("   matpar_offset=%i\n",matpar_offset);
    2289 
    2290         printf("   h=[%i,%i,%i,%i,%i,%i]\n",h[0],h[1],h[2],h[3],h[4],h[5]);
    2291         printf("   s=[%i,%i,%i,%i,%i,%i]\n",s[0],s[1],s[2],s[3],s[4],s[5]);
    2292         printf("   b=[%i,%i,%i,%i,%i,%i]\n",b[0],b[1],b[2],b[3],b[4],b[5]);
    2293         printf("   k=[%i,%i,%i,%i,%i,%i]\n",k[0],k[1],k[2],k[3],k[4],k[5]);
    2294 
    2295         printf("   friction_type: %i\n",friction_type);
    2296         printf("   p: %g\n",p);
    2297         printf("   q: %g\n",q);
    2298         printf("   shelf: %i\n",shelf);
    2299         printf("   onbed: %i\n",onbed);
    2300         printf("   onwater: %i\n",onwater);
    2301         printf("   onsurface: %i\n",onsurface);
    2302         printf("   collapse: %i\n",collapse);
    2303 
    2304         printf("   melting=[%i,%i,%i,%i,%i,%i]\n",melting[0],melting[1],melting[2],melting[3],melting[4],melting[5]);
    2305         printf("   accumulation=[%i,%i,%i,%i,%i,%i]\n",accumulation[0],accumulation[1],accumulation[2],accumulation[3],accumulation[4],accumulation[5]);
    2306         printf("   geothermalflux=[%i,%i,%i,%i,%i,%i]\n",geothermalflux[0],geothermalflux[1],geothermalflux[2],geothermalflux[3],geothermalflux[4],geothermalflux[5]);
    2307         printf("   thermal_steadystate: %i\n",thermal_steadystate);
    2308         return;
    2309 }
    2310 /*}}}*/
    23112324/*FUNCTION Du {{{1*/
    23122325void  Penta::Du(Vec du_g,void* inputs,int analysis_type,int sub_analysis_type){
     
    23162329
    23172330        /*If on water, skip: */
    2318         if(onwater)return;
     2331        if(this->properties.onwater)return;
    23192332
    23202333        /*Bail out if this element if:
    23212334         * -> Non collapsed and not on the surface
    23222335         * -> collapsed (2d model) and not on bed) */
    2323         if ((!collapse && !onsurface) || (collapse && !onbed)){
     2336        if ((!this->properties.collapse && !this->properties.onsurface) || (this->properties.collapse && !this->properties.onbed)){
    23242337                return;
    23252338        }
    2326         else if (collapse){
     2339        else if (this->properties.collapse){
    23272340
    23282341                /*This element should be collapsed into a tria element at its base. Create this tria element,
     
    23422355}
    23432356/*}}}*/
    2344 /*FUNCTION Echo {{{1*/
    2345 void Penta::Echo(void){
    2346 
    2347         printf("Penta:\n");
    2348         printf("   id: %i\n",id);
    2349         printf("   mid: %i\n",mid);
    2350         printf("   mparid: %i\n",mparid);
    2351         printf("   numparid: %i\n",numparid);
    2352 
    2353         printf("   node_ids=[%i,%i,%i,%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2],node_ids[3],node_ids[4],node_ids[5]);
    2354         printf("   node_offsets=[%i,%i,%i,%i,%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2],node_offsets[3],node_offsets[4],node_offsets[5]);
    2355         printf("   matice_offset=%i\n",matice_offset);
    2356         printf("   matpar_offset=%i\n",matpar_offset);
    2357 
    2358         printf("   h=[%g,%g,%g,%g,%g,%g]\n",h[0],h[1],h[2],h[3],h[4],h[5]);
    2359         printf("   s=[%g,%g,%g,%g,%g,%g]\n",s[0],s[1],s[2],s[3],s[4],s[5]);
    2360         printf("   b=[%g,%g,%g,%g,%g,%g]\n",b[0],b[1],b[2],b[3],b[4],b[5]);
    2361         printf("   k=[%g,%g,%g,%g,%g,%g]\n",k[0],k[1],k[2],k[3],k[4],k[5]);
    2362 
    2363         printf("   friction_type: %i\n",friction_type);
    2364         printf("   p: %g\n",p);
    2365         printf("   q: %g\n",q);
    2366         printf("   shelf: %i\n",shelf);
    2367         printf("   onbed: %i\n",onbed);
    2368         printf("   onwater: %i\n",onwater);
    2369         printf("   onsurface: %i\n",onsurface);
    2370         printf("   collapse: %i\n",collapse);
    2371 
    2372         printf("   melting=[%g,%g,%g,%g,%g,%g]\n",melting[0],melting[1],melting[2],melting[3],melting[4],melting[5]);
    2373         printf("   accumulation=[%g,%g,%g,%g,%g,%g]\n",accumulation[0],accumulation[1],accumulation[2],accumulation[3],accumulation[4],accumulation[5]);
    2374         printf("   geothermalflux=[%g,%g,%g,%g,%g,%g]\n",geothermalflux[0],geothermalflux[1],geothermalflux[2],geothermalflux[3],geothermalflux[4],geothermalflux[5]);
    2375         printf("   thermal_steadystate: %i\n",thermal_steadystate);
    2376         return;
    2377 }
    2378 /*}}}*/
    23792357/*FUNCTION Enum {{{1*/
    23802358int Penta::Enum(void){
     
    23942372        int   extrude=0;
    23952373
     2374        /*dynamic objects pointed to by hooks: */
     2375        Node**  nodes=NULL;
     2376
     2377        /*recover objects from hooks: */
     2378        nodes=(Node**)hnodes.deliverp();
     2379
    23962380        /*Figure out if we should extrude for this element: */
    23972381        if (iscollapsed){
    23982382                /*From higher level, we are told to extrude only elements that have the collapse flag on: */
    2399                 if (collapse)extrude=1;
     2383                if (this->properties.collapse)extrude=1;
    24002384                else extrude=0;
    24012385        }
     
    24072391        /*Now, extrusion starts from the bed on, so double check this element is on
    24082392         * the bedrock: */
    2409         if(onbed==0)extrude=0;
     2393        if(this->properties.onbed==0)extrude=0;
    24102394
    24112395        /*Go on and extrude field: */
     
    27042688
    27052689        int i;
    2706         for(i=0;i<6;i++)bed_list[i]=b[i];
     2690        for(i=0;i<6;i++)bed_list[i]=this->properties.b[i];
    27072691
    27082692}
     
    29702954        int numberofdofspernode;
    29712955
     2956        /*dynamic objects pointed to by hooks: */
     2957        Node**  nodes=NULL;
     2958
     2959        /*recover objects from hooks: */
     2960        nodes=(Node**)hnodes.deliverp();
     2961
    29722962        for(i=0;i<6;i++){
    29732963                nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode);
     
    29842974/*FUNCTION GetDofList1 {{{1*/
    29852975void  Penta::GetDofList1(int* doflist){
    2986 
     2976       
    29872977        int i;
     2978        /*dynamic objects pointed to by hooks: */
     2979        Node**  nodes=NULL;
     2980
     2981        /*recover objects from hooks: */
     2982        nodes=(Node**)hnodes.deliverp();
     2983
    29882984        for(i=0;i<6;i++){
    29892985                doflist[i]=nodes[i]->GetDofList1();
     
    33113307/*FUNCTION GetMatPar {{{1*/
    33123308void* Penta::GetMatPar(){
     3309
     3310        /*dynamic objects pointed to by hooks: */
     3311        Matpar* matpar=NULL;
     3312
     3313        /*recover objects from hooks: */
     3314        matpar=(Matpar*)hmatpar.delivers();
     3315
    33133316        return matpar;
    33143317}
     
    35643567/*FUNCTION GetNodes {{{1*/
    35653568void  Penta::GetNodes(void** vpnodes){
     3569
    35663570        int i;
    3567         Node** pnodes=(Node**)vpnodes;
     3571        Node** pnodes=NULL;
     3572        /*dynamic objects pointed to by hooks: */
     3573        Node**  nodes=NULL;
     3574       
     3575        /*recover objects from hooks: */
     3576        nodes=(Node**)hnodes.deliverp();
     3577       
     3578        /*virtual object: */
     3579        pnodes=(Node**)vpnodes;
    35683580
    35693581        for(i=0;i<6;i++){
     
    35743586/*FUNCTION GetOnBed {{{1*/
    35753587int Penta::GetOnBed(){
    3576         return onbed;
     3588        return this->properties.onbed;
    35773589}
    35783590/*}}}*/
     
    36503662/*FUNCTION GetShelf {{{1*/
    36513663int   Penta::GetShelf(){
    3652         return shelf;
     3664        return this->properties.shelf;
    36533665}
    36543666/*}}}*/
     
    37533765
    37543766        int i;
    3755         for(i=0;i<6;i++)thickness_list[i]=h[i];
     3767        for(i=0;i<6;i++)thickness_list[i]=this->properties.h[i];
    37563768}
    37573769/*}}}*/
     
    37603772
    37613773        /*If on water, skip grad (=0): */
    3762         if(onwater)return;
     3774        if(this->properties.onwater)return;
    37633775
    37643776        if (strcmp(control_type,"drag")==0){
     
    37773789
    37783790        /*If on water, skip: */
    3779         if(onwater)return;
     3791        if(this->properties.onwater)return;
    37803792
    37813793        /*If on shelf, skip: */
    3782         if(shelf)return;
     3794        if(this->properties.shelf)return;
    37833795
    37843796        /*Bail out if this element does not touch the bedrock: */
    3785         if (!onbed) return;
     3797        if (!this->properties.onbed) return;
    37863798
    37873799        if (sub_analysis_type==HorizAnalysisEnum()){
     
    38103822
    38113823        /*If on water, skip: */
    3812         if(onwater)return;
    3813 
    3814         if (collapse){
     3824        if(this->properties.onwater)return;
     3825
     3826        if (this->properties.collapse){
    38153827                /*Bail out element if collapsed (2d) and not on bed*/
    3816                 if (!onbed) return;
     3828                if (!this->properties.onbed) return;
    38173829
    38183830                /*This element should be collapsed into a tria element at its base. Create this tria element,
     
    38443856
    38453857        /*If on water, return 0: */
    3846         if(onwater)return 0;
     3858        if(this->properties.onwater)return 0;
    38473859
    38483860        /*Bail out if this element if:
    38493861         * -> Non collapsed and not on the surface
    38503862         * -> collapsed (2d model) and not on bed) */
    3851         if ((!collapse && !onsurface) || (collapse && !onbed)){
     3863        if ((!this->properties.collapse && !this->properties.onsurface) || (this->properties.collapse && !this->properties.onbed)){
    38523864                return 0;
    38533865        }
    3854         else if (collapse){
     3866        else if (this->properties.collapse){
    38553867
    38563868                /*This element should be collapsed into a tria element at its base. Create this tria element,
     
    39643976}
    39653977/*}}}*/
    3966 /*FUNCTION SpawnTria {{{1*/
    3967 void*  Penta::SpawnTria(int g0, int g1, int g2){
    3968 
    3969         /*out of grids g0,g1 and g2 from Penta, build a tria element: */
    3970         Tria* tria=NULL;
    3971         double   tria_h[3];
    3972         double   tria_s[3];
    3973         double   tria_b[3];
    3974         double   tria_c[3];
    3975         double   tria_k[3];
    3976         double   tria_melting[3];
    3977         double   tria_accumulation[3];
    3978         double   tria_geothermalflux[3];
    3979 
    3980         /*configuration: */
    3981         int tria_node_ids[3];
    3982         Node* tria_nodes[3];
    3983         int tria_node_offsets[3];
    3984 
    3985         tria_h[0]=h[g0];
    3986         tria_h[1]=h[g1];
    3987         tria_h[2]=h[g2];
    3988 
    3989         tria_s[0]=s[g0];
    3990         tria_s[1]=s[g1];
    3991         tria_s[2]=s[g2];
    3992 
    3993         tria_b[0]=b[g0];
    3994         tria_b[1]=b[g1];
    3995         tria_b[2]=b[g2];
    3996 
    3997         tria_k[0]=k[g0];
    3998         tria_k[1]=k[g1];
    3999         tria_k[2]=k[g2];
    4000 
    4001         tria_melting[0]=melting[g0];
    4002         tria_melting[1]=melting[g1];
    4003         tria_melting[2]=melting[g2];
    4004 
    4005         tria_accumulation[0]=accumulation[g0];
    4006         tria_accumulation[1]=accumulation[g1];
    4007         tria_accumulation[2]=accumulation[g2];
    4008 
    4009         tria_geothermalflux[0]=geothermalflux[g0];
    4010         tria_geothermalflux[1]=geothermalflux[g1];
    4011         tria_geothermalflux[2]=geothermalflux[g2];
    4012 
    4013         tria_node_ids[0]=node_ids[g0];
    4014         tria_node_ids[1]=node_ids[g1];
    4015         tria_node_ids[2]=node_ids[g2];
    4016 
    4017         tria_nodes[0]=nodes[g0];
    4018         tria_nodes[1]=nodes[g1];
    4019         tria_nodes[2]=nodes[g2];
    4020 
    4021         tria_node_offsets[0]=node_offsets[g0];
    4022         tria_node_offsets[1]=node_offsets[g1];
    4023         tria_node_offsets[2]=node_offsets[g2];
    4024 
    4025         tria= new Tria(id,mid,mparid,numparid,tria_node_ids,tria_h,tria_s,tria_b,tria_k, tria_melting, tria_accumulation, tria_geothermalflux,friction_type,p,q,shelf,onwater);
    4026 
    4027         tria->NodeConfiguration(tria_node_ids,tria_nodes,tria_node_offsets);
    4028         tria->MaticeConfiguration(matice,matice_offset);
    4029         tria->MatparConfiguration(matpar,matpar_offset);
    4030         tria->NumparConfiguration(numpar,numpar_offset);
    4031 
    4032         return tria;
    4033 
    4034 }
    4035 /*}}}*/
    40363978/*FUNCTION UpdateFromInputs {{{1*/
    40373979void  Penta::UpdateFromInputs(void* vinputs){
     
    40433985        double  B_average;
    40443986
     3987        /*dynamic objects pointed to by hooks: */
     3988        Node**  nodes=NULL;
     3989        Matice* matice=NULL;
     3990
    40453991        ParameterInputs* inputs=NULL;
    40463992
    40473993        /*If on water, skip: */
    4048         if(onwater)return;
     3994        if(this->properties.onwater)return;
     3995
     3996        /*recover objects from hooks: */
     3997        nodes=(Node**)hnodes.deliverp();
     3998        matice=(Matice*)hmatice.delivers();
    40493999
    40504000        /*recover pointers: */
     
    40524002
    40534003        /*Update internal data if inputs holds new values: */
    4054         inputs->Recover("thickness",&h[0],1,dofs,6,(void**)nodes);
    4055         inputs->Recover("surface",&s[0],1,dofs,6,(void**)nodes);
    4056         inputs->Recover("bed",&b[0],1,dofs,6,(void**)nodes);
    4057         inputs->Recover("drag",&k[0],1,dofs,6,(void**)nodes);
    4058         inputs->Recover("melting",&melting[0],1,dofs,6,(void**)nodes);
    4059         inputs->Recover("accumulation_param",&accumulation[0],1,dofs,6,(void**)nodes);
     4004        inputs->Recover("thickness",&this->properties.h[0],1,dofs,6,(void**)nodes);
     4005        inputs->Recover("surface",&this->properties.s[0],1,dofs,6,(void**)nodes);
     4006        inputs->Recover("bed",&this->properties.b[0],1,dofs,6,(void**)nodes);
     4007        inputs->Recover("drag",&this->properties.k[0],1,dofs,6,(void**)nodes);
     4008        inputs->Recover("melting",&this->properties.melting[0],1,dofs,6,(void**)nodes);
     4009        inputs->Recover("accumulation_param",&this->properties.accumulation[0],1,dofs,6,(void**)nodes);
    40604010
    40614011        //Update material if necessary
    40624012        if(inputs->Recover("temperature",&temperature_list[0],1,dofs,6,(void**)nodes)){
    4063                 if(matice && !collapse){
     4013                if(matice && !this->properties.collapse){
    40644014                        //B_average=(Paterson(temperature_list[0])+Paterson(temperature_list[1])+Paterson(temperature_list[2])
    40654015                        //                      +Paterson(temperature_list[3])+Paterson(temperature_list[4])+Paterson(temperature_list[5]))/6.0;
     
    40714021
    40724022        if(inputs->Recover("temperature_average",&temperature_list[0],1,dofs,6,(void**)nodes)){
    4073                 if(matice && collapse){
     4023                if(matice && this->properties.collapse){
    40744024                        temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2]+temperature_list[3]+temperature_list[4]+temperature_list[5])/6.0;
    40754025                        B_average=Paterson(temperature_average);
     
    40964046
    40974047        /*If on water, return 0: */
    4098         if(onwater)return 0;
     4048        if(this->properties.onwater)return 0;
    40994049
    41004050        /*Bail out if this element if:
    41014051         * -> Non collapsed and not on the surface
    41024052         * -> collapsed (2d model) and not on bed) */
    4103         if ((!collapse && !onsurface) || (collapse && !onbed)){
     4053        if ((!this->properties.collapse && !this->properties.onsurface) || (this->properties.collapse && !this->properties.onbed)){
    41044054                return 0;
    41054055        }
    4106         else if (collapse){
     4056        else if (this->properties.collapse){
    41074057
    41084058                /*This element should be collapsed into a tria element at its base. Create this tria element,
  • issm/trunk/src/c/objects/Penta.h

    r3180 r3383  
    99#include "./Element.h"
    1010#include "./Matpar.h"
     11#include "./Numpar.h"
    1112#include "./Matice.h"
    1213#include "./Node.h"
    1314#include "./Tria.h"
     15#include "./Hook.h"
     16#include "./ElementProperties.h"
    1417#include "./ParameterInputs.h"
     18
     19class Numpar;
     20class Node;
     21class Matice;
     22class Matpar;
     23class  ElementProperties;
    1524
    1625class Penta: public Element{
    1726
    1827        private:
     28
    1929                int id;
    20                
    21                 /*nodes: */
    22                 int   node_ids[6]; //node ids
    23                 Node* nodes[6]; //node pointers
    24                 int   node_offsets[6]; //node offsets in nodes dataset
     30                Hook hnodes;  //hook to 6 nodes
     31                Hook hmatice; //hook to 1 matice
     32                Hook hmatpar; //hook to 1 matpar
     33                Hook hnumpar; //hook to 1 numpar
    2534
    26                 /*materials: */
    27                 int   mid;
    28                 Matice* matice;
    29                 int   matice_offset;
    30                
    31                 int mparid;
    32                 Matpar* matpar;
    33                 int   matpar_offset;
     35                ElementProperties properties;
    3436
    35                 int numparid;
    36                 Numpar* numpar;
    37                 int   numpar_offset;
    38        
    39 
    40                 double h[6];
    41                 double s[6];
    42                 double b[6];
    43                 double k[6];
    44                 double melting[6];
    45                 double accumulation[6];
    46                 int    friction_type;
    47                 double p;
    48                 double q;
    49                 int    shelf;
    50                 int    onbed;
    51                 int    onsurface;
    52                 bool   onwater;
    53                 int    collapse;
    54                 double geothermalflux[6];
    55                 int    thermal_steadystate;
    56        
    5737        public:
    5838
     39                /*FUNCTION constructors, destructors {{{1*/
    5940                Penta();
    60                 Penta( int id, int mid, int mparid, int numparid, int node_ids[6], double h[6], double s[6], double b[6], double k[6], int    friction_type,
    61                                 double p, double q, int    shelf, int    onbed, int    onsurface,  int    collapse, double melting[6], double accumulation[6], double geothermalflux[6],
    62                                 int    thermal_steadystate,bool onwater);
     41                Penta(int penta_id,int* penta_node_ids, int penta_matice_id, int penta_matpar_id, int penta_numpar_id, ElementProperties* properties);
    6342                ~Penta();
    64 
     43                /*}}}*/
     44                /*FUNCTION object management {{{1*/
    6545                void  Echo();
    6646                void  DeepEcho();
     
    7353                int   MyRank();
    7454                void  Configure(void* loads,void* nodes,void* materials,void* parameters);
     55                /*}}}*/
     56                /*FUNCTION element numerical routines {{{1*/
    7557                void  CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type);
    7658                void  CreateKMatrixDiagnosticHoriz( Mat Kgg, void* inputs, int analysis_type,int sub_analysis_type);
     
    147129                void  GetPhi(double* phi, double*  epsilon, double viscosity);
    148130                double MassFlux(double* segment,double* ug);
     131                /*}}}*/
    149132
    150133
  • issm/trunk/src/c/objects/Tria.cpp

    r3359 r3383  
    1111#include "stdio.h"
    1212#include "./Tria.h"
     13#include "./Hook.h"
    1314#include <string.h>
    1415#include "../EnumDefinitions/EnumDefinitions.h"
     
    2526
    2627/*Object constructors and destructor*/
     28/*FUNCTION Tria default constructor {{{1*/
     29Tria::Tria(){
     30        return;
     31}
     32/*}}}*/
    2733/*FUNCTION Tria constructor {{{1*/
    28 Tria::Tria(){
     34Tria::Tria(int tria_id,int* tria_node_ids, int tria_matice_id, int tria_matpar_id, int tria_numpar_id, ElementProperties* triaproperties):
     35        hnodes(tria_node_ids,3),
     36        hmatice(&tria_matice_id,1),
     37        hmatpar(&tria_matpar_id,1),
     38        hnumpar(&tria_numpar_id,1),
     39        properties(triaproperties)
     40{
     41
     42        /*all the initialization has been done by the initializer, just fill in the id: */
     43        this->id=tria_id;
     44
     45        return;
     46}
     47/*}}}*/
     48/*FUNCTION Tria other constructor {{{1*/
     49Tria::Tria(int tria_id,Hook* tria_hnodes, Hook* tria_hmatice, Hook* tria_hmatpar, Hook* tria_hnumpar, ElementProperties* tria_properties):
     50        hnodes(tria_hnodes),
     51        hmatice(tria_hmatice),
     52        hmatpar(tria_hmatpar),
     53        hnumpar(tria_hnumpar),
     54        properties(tria_properties)
     55{
     56
     57        /*all the initialization has been done by the initializer, just fill in the id: */
     58        this->id=tria_id;
     59
    2960        return;
    3061}
     
    3566}
    3667/*}}}*/
    37 /*FUNCTION Tria creation {{{1*/
    38 Tria::Tria(int tria_id,int tria_mid,int tria_mparid,int tria_numparid,int tria_node_ids[3],double tria_h[3],double tria_s[3],double tria_b[3],double tria_k[3],double tria_melting[3],
    39                                 double tria_accumulation[3],double tria_geothermalflux[3],int tria_friction_type,double tria_p,double tria_q,int tria_shelf, bool tria_onwater){
    40        
    41         int i;
    42        
    43         id=tria_id;
    44         mid=tria_mid;
    45         mparid=tria_mparid;
    46         numparid=tria_numparid;
    47         for(i=0;i<3;i++){
    48                 node_ids[i]=tria_node_ids[i];
    49                 node_offsets[i]=UNDEF;
    50                 nodes[i]=NULL;
    51                 h[i]=tria_h[i];
    52                 s[i]=tria_s[i];
    53                 b[i]=tria_b[i];
    54                 k[i]=tria_k[i];
    55                 melting[i]=tria_melting[i];
    56                 accumulation[i]=tria_accumulation[i];
    57                 geothermalflux[i]=tria_geothermalflux[i];
    58         }
    59         matice=NULL;
    60         matice_offset=UNDEF;
    61         matpar=NULL;
    62         matpar_offset=UNDEF;
    63         numpar=NULL;
    64         numpar_offset=UNDEF;
    65         friction_type=tria_friction_type;
    66         p=tria_p;
    67         q=tria_q;
    68         shelf=tria_shelf;
    69         onbed=1;
    70         onwater=tria_onwater;
    71        
    72         return;
    73 }
    74 /*}}}*/
    75 
    76 /*Object marshall*/
     68
     69/*Object marshalling*/
    7770/*FUNCTION Marshall {{{1*/
    7871void  Tria::Marshall(char** pmarshalled_dataset){
     
    9285        /*marshall Tria data: */
    9386        memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    94         memcpy(marshalled_dataset,&mid,sizeof(mid));marshalled_dataset+=sizeof(mid);
    95         memcpy(marshalled_dataset,&mparid,sizeof(mparid));marshalled_dataset+=sizeof(mparid);
    96         memcpy(marshalled_dataset,&node_ids,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids);
    97         memcpy(marshalled_dataset,&nodes,sizeof(nodes));marshalled_dataset+=sizeof(nodes);
    98         memcpy(marshalled_dataset,&node_offsets,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets);
    99         memcpy(marshalled_dataset,&matice,sizeof(matice));marshalled_dataset+=sizeof(matice);
    100         memcpy(marshalled_dataset,&matice_offset,sizeof(matice_offset));marshalled_dataset+=sizeof(matice_offset);
    101         memcpy(marshalled_dataset,&matpar,sizeof(matpar));marshalled_dataset+=sizeof(matpar);
    102         memcpy(marshalled_dataset,&matpar_offset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset);
    103         memcpy(marshalled_dataset,&numparid,sizeof(numparid));marshalled_dataset+=sizeof(numparid);
    104         memcpy(marshalled_dataset,&numpar,sizeof(numpar));marshalled_dataset+=sizeof(numpar);
    105         memcpy(marshalled_dataset,&numpar_offset,sizeof(numpar_offset));marshalled_dataset+=sizeof(numpar_offset);
    106         memcpy(marshalled_dataset,&h,sizeof(h));marshalled_dataset+=sizeof(h);
    107         memcpy(marshalled_dataset,&s,sizeof(s));marshalled_dataset+=sizeof(s);
    108         memcpy(marshalled_dataset,&b,sizeof(b));marshalled_dataset+=sizeof(b);
    109         memcpy(marshalled_dataset,&k,sizeof(k));marshalled_dataset+=sizeof(k);
    110         memcpy(marshalled_dataset,&melting,sizeof(melting));marshalled_dataset+=sizeof(melting);
    111         memcpy(marshalled_dataset,&accumulation,sizeof(accumulation));marshalled_dataset+=sizeof(accumulation);
    112         memcpy(marshalled_dataset,&geothermalflux,sizeof(geothermalflux));marshalled_dataset+=sizeof(geothermalflux);
    113         memcpy(marshalled_dataset,&friction_type,sizeof(friction_type));marshalled_dataset+=sizeof(friction_type);
    114         memcpy(marshalled_dataset,&onbed,sizeof(onbed));marshalled_dataset+=sizeof(onbed);
    115         memcpy(marshalled_dataset,&onwater,sizeof(onwater));marshalled_dataset+=sizeof(onwater);
    116         memcpy(marshalled_dataset,&p,sizeof(p));marshalled_dataset+=sizeof(p);
    117         memcpy(marshalled_dataset,&q,sizeof(q));marshalled_dataset+=sizeof(q);
    118         memcpy(marshalled_dataset,&shelf,sizeof(shelf));marshalled_dataset+=sizeof(shelf);
     87
     88        /*Marshall hooks: */
     89        hnodes.Marshall(&marshalled_dataset);
     90        hmatice.Marshall(&marshalled_dataset);
     91        hmatpar.Marshall(&marshalled_dataset);
     92        hnumpar.Marshall(&marshalled_dataset);
     93
     94        /*Marshall properties: */
     95        properties.Marshall(&marshalled_dataset);
    11996
    12097        *pmarshalled_dataset=marshalled_dataset;
     
    124101/*FUNCTION MarshallSize {{{1*/
    125102int   Tria::MarshallSize(){
     103       
    126104        return sizeof(id)
    127           +sizeof(mid)
    128           +sizeof(mparid)
    129           +sizeof(node_ids)
    130           +sizeof(nodes)
    131           +sizeof(node_offsets)
    132           +sizeof(matice)
    133           +sizeof(matice_offset)
    134           +sizeof(matpar)
    135           +sizeof(matpar_offset)
    136           +sizeof(numparid)
    137           +sizeof(numpar)
    138           +sizeof(numpar_offset)
    139           +sizeof(h)
    140           +sizeof(s)
    141           +sizeof(b)
    142           +sizeof(k)
    143           +sizeof(melting)
    144           +sizeof(accumulation)
    145           +sizeof(geothermalflux)
    146           +sizeof(friction_type)
    147           +sizeof(onbed)
    148           +sizeof(onwater)
    149           +sizeof(p)
    150           +sizeof(q)
    151           +sizeof(shelf)
    152           +sizeof(int); //sizeof(int) for enum type
     105                +hnodes.MarshallSize()
     106                +hmatice.MarshallSize()
     107                +hmatpar.MarshallSize()
     108                +hnumpar.MarshallSize()
     109                +properties.MarshallSize()
     110                +sizeof(int); //sizeof(int) for enum type
    153111}
    154112/*}}}*/
     
    166124
    167125        memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    168         memcpy(&mid,marshalled_dataset,sizeof(mid));marshalled_dataset+=sizeof(mid);
    169         memcpy(&mparid,marshalled_dataset,sizeof(mparid));marshalled_dataset+=sizeof(mparid);
    170         memcpy(&node_ids,marshalled_dataset,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids);
    171         memcpy(&nodes,marshalled_dataset,sizeof(nodes));marshalled_dataset+=sizeof(nodes);
    172         memcpy(&node_offsets,marshalled_dataset,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets);
    173         memcpy(&matice,marshalled_dataset,sizeof(matice));marshalled_dataset+=sizeof(matice);
    174         memcpy(&matice_offset,marshalled_dataset,sizeof(matice_offset));marshalled_dataset+=sizeof(matice_offset);
    175         memcpy(&matpar,marshalled_dataset,sizeof(matpar));marshalled_dataset+=sizeof(matpar);
    176         memcpy(&matpar_offset,marshalled_dataset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset);
    177         memcpy(&numparid,marshalled_dataset,sizeof(numparid));marshalled_dataset+=sizeof(numparid);
    178         memcpy(&numpar,marshalled_dataset,sizeof(numpar));marshalled_dataset+=sizeof(numpar);
    179         memcpy(&numpar_offset,marshalled_dataset,sizeof(numpar_offset));marshalled_dataset+=sizeof(numpar_offset);
    180         memcpy(&h,marshalled_dataset,sizeof(h));marshalled_dataset+=sizeof(h);
    181         memcpy(&s,marshalled_dataset,sizeof(s));marshalled_dataset+=sizeof(s);
    182         memcpy(&b,marshalled_dataset,sizeof(b));marshalled_dataset+=sizeof(b);
    183         memcpy(&k,marshalled_dataset,sizeof(k));marshalled_dataset+=sizeof(k);
    184         memcpy(&melting,marshalled_dataset,sizeof(melting));marshalled_dataset+=sizeof(melting);
    185         memcpy(&accumulation,marshalled_dataset,sizeof(accumulation));marshalled_dataset+=sizeof(accumulation);
    186         memcpy(&geothermalflux,marshalled_dataset,sizeof(geothermalflux));marshalled_dataset+=sizeof(geothermalflux);
    187         memcpy(&friction_type,marshalled_dataset,sizeof(friction_type));marshalled_dataset+=sizeof(friction_type);
    188         memcpy(&onbed,marshalled_dataset,sizeof(onbed));marshalled_dataset+=sizeof(onbed);
    189         memcpy(&onwater,marshalled_dataset,sizeof(onwater));marshalled_dataset+=sizeof(onwater);
    190         memcpy(&p,marshalled_dataset,sizeof(p));marshalled_dataset+=sizeof(p);
    191         memcpy(&q,marshalled_dataset,sizeof(q));marshalled_dataset+=sizeof(q);
    192         memcpy(&shelf,marshalled_dataset,sizeof(shelf));marshalled_dataset+=sizeof(shelf);
    193 
    194         /*nodes and materials are not pointing to correct objects anymore:*/
    195         for(i=0;i<3;i++)nodes[i]=NULL;
    196         matice=NULL;
    197         matpar=NULL;
    198         numpar=NULL;
     126
     127        /*demarshall hooks: */
     128        hnodes.Demarshall(&marshalled_dataset);
     129        hmatice.Demarshall(&marshalled_dataset);
     130        hmatpar.Demarshall(&marshalled_dataset);
     131        hnumpar.Demarshall(&marshalled_dataset);
     132
     133        /*demarshall properties: */
     134        properties.Demarshall(&marshalled_dataset);
    199135
    200136        /*return: */
    201137        *pmarshalled_dataset=marshalled_dataset;
    202138        return;
     139}
     140/*}}}*/
     141
     142/*Object processing: */
     143/*FUNCTION Echo{{{1*/
     144
     145void Tria::Echo(void){
     146
     147        printf("Tria:\n");
     148        printf("   id: %i\n",id);
     149        hnodes.Echo();
     150        hmatice.Echo();
     151        hmatpar.Echo();
     152        hnumpar.Echo();
     153        properties.Echo();
     154
     155        return;
     156}
     157/*}}}*/
     158/*FUNCTION DeepEcho{{{1*/
     159
     160void Tria::DeepEcho(void){
     161
     162        printf("Tria:\n");
     163        printf("   id: %i\n",id);
     164        hnodes.DeepEcho();
     165        hmatice.DeepEcho();
     166        hmatpar.DeepEcho();
     167        hnumpar.DeepEcho();
     168        properties.DeepEcho();
     169
     170        return;
     171}
     172/*}}}*/
     173/*FUNCTION Configure {{{1*/
     174void  Tria::Configure(void* ploadsin,void* pnodesin,void* pmaterialsin,void* pparametersin){
     175
     176        int i;
     177
     178        DataSet* loadsin=NULL;
     179        DataSet* nodesin=NULL;
     180        DataSet* materialsin=NULL;
     181        DataSet* parametersin=NULL;
     182
     183        /*Recover pointers :*/
     184        loadsin=(DataSet*)ploadsin;
     185        nodesin=(DataSet*)pnodesin;
     186        materialsin=(DataSet*)pmaterialsin;
     187        parametersin=(DataSet*)pparametersin;
     188
     189        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
     190         * datasets, using internal ids and offsets hidden in hooks: */
     191        hnodes.configure(nodesin);
     192        hmatice.configure(materialsin);
     193        hmatpar.configure(materialsin);
     194        hnumpar.configure(parametersin);
     195
    203196}
    204197/*}}}*/
     
    213206        double pressure[numgrids];
    214207        double rho_ice,g;
    215 
     208       
     209        /*dynamic objects pointed to by hooks: */
     210        Node**  nodes=NULL;
     211        Matpar* matpar=NULL;
     212        Matice* matice=NULL;
     213        Numpar* numpar=NULL;
     214
     215       
    216216        /*Get dof list on which we will plug the pressure values: */
    217217        GetDofList1(&doflist[0]);
     218
     219        /*recover objects from hooks: */
     220        nodes=(Node**)hnodes.deliverp();
     221        matpar=(Matpar*)hmatpar.delivers();
     222        matice=(Matice*)hmatice.delivers();
     223        numpar=(Numpar*)hnumpar.delivers();
    218224
    219225        /*pressure is lithostatic: */
     
    221227        g=matpar->GetG();
    222228        for(i=0;i<numgrids;i++){
    223                 pressure[i]=rho_ice*g*h[i];
     229                pressure[i]=rho_ice*g*this->properties.h[i];
    224230        }
    225231
    226232        /*plug local pressure values into global pressure vector: */
    227233        VecSetValues(pg,numgrids,doflist,(const double*)pressure,INSERT_VALUES);
    228 
    229 }
    230 /*}}}*/
    231 /*FUNCTION Configure {{{1*/
    232 void  Tria::Configure(void* ploadsin,void* pnodesin,void* pmaterialsin,void* pparametersin){
    233 
    234         int i;
    235 
    236         DataSet* loadsin=NULL;
    237         DataSet* nodesin=NULL;
    238         DataSet* materialsin=NULL;
    239         DataSet* parametersin=NULL;
    240 
    241         /*Recover pointers :*/
    242         loadsin=(DataSet*)ploadsin;
    243         nodesin=(DataSet*)pnodesin;
    244         materialsin=(DataSet*)pmaterialsin;
    245         parametersin=(DataSet*)pparametersin;
    246 
    247         /*Link this element with its nodes, ie find pointers to the nodes in the nodes dataset.: */
    248         ResolvePointers((Object**)nodes,node_ids,node_offsets,3,nodesin);
    249 
    250         /*Same for materials: */
    251         ResolvePointers((Object**)&matice,&mid,&matice_offset,1,materialsin);
    252         ResolvePointers((Object**)&matpar,&mparid,&matpar_offset,1,materialsin);
    253 
    254         /*Same for numpar: */
    255         ResolvePointers((Object**)&numpar,&numparid,&numpar_offset,1,parametersin);
    256234
    257235}
     
    301279        double Jdet;
    302280
     281        /*dynamic objects pointed to by hooks: */
     282        Node**  nodes=NULL;
     283        Matpar* matpar=NULL;
     284        Matice* matice=NULL;
     285        Numpar* numpar=NULL;
     286
    303287        ParameterInputs* inputs=NULL;
    304288
    305289        /*If on water, return 0: */
    306         if(onwater)return 0;
     290        if(this->properties.onwater)return 0;
    307291
    308292        /*recover pointers: */
    309293        inputs=(ParameterInputs*)vinputs;
     294
     295        /*recover objects from hooks: */
     296        nodes=(Node**)hnodes.deliverp();
     297        matpar=(Matpar*)hmatpar.delivers();
     298        matice=(Matice*)hmatice.delivers();
     299        numpar=(Numpar*)hnumpar.delivers();
    310300
    311301        /* Get node coordinates and dof list: */
     
    337327                /*Add Tikhonov regularization term to misfit*/
    338328                if (strcmp(numpar->control_type,"drag")==0){
    339                         if (!shelf){
    340 
    341                                 GetParameterDerivativeValue(&dk[0], &k[0],&xyz_list[0][0], gauss_l1l2l3);
     329                        if (!this->properties.shelf){
     330
     331                                GetParameterDerivativeValue(&dk[0], &this->properties.k[0],&xyz_list[0][0], gauss_l1l2l3);
    342332                                Jelem+=numpar->cm_noisedmp*1/2*(pow(dk[0],2)+pow(dk[1],2))*Jdet*gauss_weight;
    343333
     
    464454        int     found=0;
    465455
     456        /*dynamic objects pointed to by hooks: */
     457        Node**  nodes=NULL;
     458        Matpar* matpar=NULL;
     459        Matice* matice=NULL;
     460        Numpar* numpar=NULL;
     461
    466462        ParameterInputs* inputs=NULL;
    467463
    468464        /*recover pointers: */
    469465        inputs=(ParameterInputs*)vinputs;
     466
     467        /*recover objects from hooks: */
     468        nodes=(Node**)hnodes.deliverp();
     469        matpar=(Matpar*)hmatpar.delivers();
     470        matice=(Matice*)hmatice.delivers();
     471        numpar=(Numpar*)hnumpar.delivers();
    470472
    471473        /*recover extra inputs from users, at current convergence iteration: */
     
    666668        int     found=0;
    667669
     670        /*dynamic objects pointed to by hooks: */
     671        Node**  nodes=NULL;
     672        Matpar* matpar=NULL;
     673        Matice* matice=NULL;
     674        Numpar* numpar=NULL;
     675
    668676        ParameterInputs* inputs=NULL;
    669677
    670678        /*recover pointers: */
    671679        inputs=(ParameterInputs*)vinputs;
     680
     681        /*recover objects from hooks: */
     682        nodes=(Node**)hnodes.deliverp();
     683        matpar=(Matpar*)hmatpar.delivers();
     684        matice=(Matice*)hmatice.delivers();
     685        numpar=(Numpar*)hnumpar.delivers();
    672686
    673687        /*recover extra inputs from users, at current convergence iteration: */
     
    685699
    686700        /*Modify z so that it reflects the surface*/
    687         for(i=0;i<numgrids;i++) xyz_list[i][2]=s[i];
     701        for(i=0;i<numgrids;i++) xyz_list[i][2]=this->properties.s[i];
    688702
    689703        /*Get normal vector to the surface*/
     
    875889        int     dofs[2]={0,1};
    876890
     891        /*dynamic objects pointed to by hooks: */
     892        Node**  nodes=NULL;
     893        Matpar* matpar=NULL;
     894        Matice* matice=NULL;
     895        Numpar* numpar=NULL;
     896
    877897        ParameterInputs* inputs=NULL;
    878898
    879899        /*First, if we are on water, return empty matrix: */
    880         if(onwater)return;
     900        if(this->properties.onwater)return;
    881901
    882902        /*recover pointers: */
    883903        inputs=(ParameterInputs*)vinputs;
     904
     905        /*recover objects from hooks: */
     906        nodes=(Node**)hnodes.deliverp();
     907        matpar=(Matpar*)hmatpar.delivers();
     908        matice=(Matice*)hmatice.delivers();
     909        numpar=(Numpar*)hnumpar.delivers();
    884910
    885911        /*recover extra inputs from users, at current convergence iteration: */
     
    935961
    936962                /*Compute thickness at gaussian point: */
    937                 GetParameterValue(&thickness, &h[0],gauss_l1l2l3);
     963                GetParameterValue(&thickness, &this->properties.h[0],gauss_l1l2l3);
    938964
    939965                /*Get strain rate from velocity: */
     
    10121038
    10131039        /*Do not forget to include friction: */
    1014         if(!shelf){
     1040        if(!this->properties.shelf){
    10151041                CreateKMatrixDiagnosticHorizFriction(Kgg,inputs,analysis_type,sub_analysis_type);
    10161042        }
     
    10901116        double MOUNTAINKEXPONENT=10;
    10911117
     1118        /*dynamic objects pointed to by hooks: */
     1119        Node**  nodes=NULL;
     1120        Matpar* matpar=NULL;
     1121        Matice* matice=NULL;
     1122        Numpar* numpar=NULL;
     1123
    10921124        ParameterInputs* inputs=NULL;
    10931125
    10941126        /*recover pointers: */
    10951127        inputs=(ParameterInputs*)vinputs;
     1128
     1129        /*recover objects from hooks: */
     1130        nodes=(Node**)hnodes.deliverp();
     1131        matpar=(Matpar*)hmatpar.delivers();
     1132        matice=(Matice*)hmatice.delivers();
     1133        numpar=(Numpar*)hnumpar.delivers();
    10961134       
    10971135        /* Get node coordinates and dof list: */
     
    11021140        for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke_gg[i][j]=0.0;
    11031141
    1104         if (shelf){
     1142        if (this->properties.shelf){
    11051143                /*no friction, do nothing*/
    11061144                return;
    11071145        }
    11081146
    1109         if (friction_type!=2)ISSMERROR(" non-viscous friction not supported yet!");
     1147        if (this->properties.friction_type!=2)ISSMERROR(" non-viscous friction not supported yet!");
    11101148
    11111149        /*recover extra inputs from users, at current convergence iteration: */
     
    11221160        friction->rho_ice=matpar->GetRhoIce();
    11231161        friction->rho_water=matpar->GetRhoWater();
    1124         friction->K=&k[0];
    1125         friction->bed=&b[0];
    1126         friction->thickness=&h[0];
     1162        friction->K=&this->properties.k[0];
     1163        friction->bed=&this->properties.b[0];
     1164        friction->thickness=&this->properties.h[0];
    11271165        friction->velocities=&vxvy_list[0][0];
    1128         friction->p=p;
    1129         friction->q=q;
     1166        friction->p=this->properties.p;
     1167        friction->q=this->properties.q;
    11301168
    11311169        /*Compute alpha2_list: */
     
    11641202                // If we have a slope > 6% for this element,  it means  we are on a mountain. In this particular case,
    11651203                //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */
    1166                 GetParameterDerivativeValue(&slope[0], &s[0],&xyz_list[0][0], gauss_l1l2l3);
     1204                GetParameterDerivativeValue(&slope[0], &this->properties.s[0],&xyz_list[0][0], gauss_l1l2l3);
    11671205                slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2));
    11681206
     
    12501288        double Ke_gg_gaussian[numdof][numdof]; //stiffness matrix evaluated at the gaussian point.
    12511289
     1290        /*dynamic objects pointed to by hooks: */
     1291        Node**  nodes=NULL;
     1292        Matpar* matpar=NULL;
     1293        Matice* matice=NULL;
     1294        Numpar* numpar=NULL;
     1295
    12521296        ParameterInputs* inputs=NULL;
    12531297
    12541298        /*recover pointers: */
    12551299        inputs=(ParameterInputs*)vinputs;
     1300
     1301        /*recover objects from hooks: */
     1302        nodes=(Node**)hnodes.deliverp();
     1303        matpar=(Matpar*)hmatpar.delivers();
     1304        matice=(Matice*)hmatice.delivers();
     1305        numpar=(Numpar*)hnumpar.delivers();
    12561306
    12571307        /* Get node coordinates and dof list: */
     
    13681418        double     tLD[3];
    13691419        double     Ke_gaussian[numdof][numdof]={0.0};
     1420
     1421        /*dynamic objects pointed to by hooks: */
     1422        Node**  nodes=NULL;
     1423        Matpar* matpar=NULL;
     1424        Matice* matice=NULL;
     1425        Numpar* numpar=NULL;
     1426
     1427        /*recover objects from hooks: */
     1428        nodes=(Node**)hnodes.deliverp();
     1429        matpar=(Matpar*)hmatpar.delivers();
     1430        matice=(Matice*)hmatice.delivers();
     1431        numpar=(Numpar*)hnumpar.delivers();
    13701432
    13711433        /*Recover constants of ice */
     
    14691531        int     found;
    14701532
     1533        /*dynamic objects pointed to by hooks: */
     1534        Node**  nodes=NULL;
     1535        Matpar* matpar=NULL;
     1536        Matice* matice=NULL;
     1537        Numpar* numpar=NULL;
     1538
    14711539        ParameterInputs* inputs=NULL;
    14721540
    14731541        /*recover pointers: */
    14741542        inputs=(ParameterInputs*)vinputs;
     1543
     1544        /*recover objects from hooks: */
     1545        nodes=(Node**)hnodes.deliverp();
     1546        matpar=(Matpar*)hmatpar.delivers();
     1547        matice=(Matice*)hmatice.delivers();
     1548        numpar=(Numpar*)hnumpar.delivers();
    14751549
    14761550        /*recover extra inputs from users, at current convergence iteration: */
     
    16781752        int     found;
    16791753
     1754        /*dynamic objects pointed to by hooks: */
     1755        Node**  nodes=NULL;
     1756        Matpar* matpar=NULL;
     1757        Matice* matice=NULL;
     1758        Numpar* numpar=NULL;
     1759
    16801760        ParameterInputs* inputs=NULL;
    16811761
    16821762        /*recover pointers: */
    16831763        inputs=(ParameterInputs*)vinputs;
     1764
     1765        /*recover objects from hooks: */
     1766        nodes=(Node**)hnodes.deliverp();
     1767        matpar=(Matpar*)hmatpar.delivers();
     1768        matice=(Matice*)hmatice.delivers();
     1769        numpar=(Numpar*)hnumpar.delivers();
    16841770
    16851771        /*recover extra inputs from users, at current convergence iteration: */
     
    18081894       
    18091895        double Jdet;
    1810        
     1896
     1897        /*dynamic objects pointed to by hooks: */
     1898        Node**  nodes=NULL;
     1899        Matpar* matpar=NULL;
     1900        Matice* matice=NULL;
     1901        Numpar* numpar=NULL;
     1902
     1903        /*recover objects from hooks: */
     1904        nodes=(Node**)hnodes.deliverp();
     1905        matpar=(Matpar*)hmatpar.delivers();
     1906        matice=(Matice*)hmatice.delivers();
     1907        numpar=(Numpar*)hnumpar.delivers();
     1908
    18111909        /* Get node coordinates and dof list: */
    18121910        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
     
    18941992        ParameterInputs* inputs=NULL;
    18951993
     1994        /*dynamic objects pointed to by hooks: */
     1995        Node**  nodes=NULL;
     1996        Matpar* matpar=NULL;
     1997        Matice* matice=NULL;
     1998        Numpar* numpar=NULL;
     1999
    18962000        /*recover pointers: */
    18972001        inputs=(ParameterInputs*)vinputs;
     2002
     2003        /*recover objects from hooks: */
     2004        nodes=(Node**)hnodes.deliverp();
     2005        matpar=(Matpar*)hmatpar.delivers();
     2006        matice=(Matice*)hmatice.delivers();
     2007        numpar=(Numpar*)hnumpar.delivers();
    18982008
    18992009        /*recover extra inputs from users, dt: */
     
    20372147        int     found=0;
    20382148
     2149        /*dynamic objects pointed to by hooks: */
     2150        Node**  nodes=NULL;
     2151        Matpar* matpar=NULL;
     2152        Matice* matice=NULL;
     2153        Numpar* numpar=NULL;
     2154
    20392155        ParameterInputs* inputs=NULL;
    20402156
    20412157        /*recover pointers: */
    20422158        inputs=(ParameterInputs*)vinputs;
     2159
     2160        /*recover objects from hooks: */
     2161        nodes=(Node**)hnodes.deliverp();
     2162        matpar=(Matpar*)hmatpar.delivers();
     2163        matice=(Matice*)hmatice.delivers();
     2164        numpar=(Numpar*)hnumpar.delivers();
    20432165
    20442166        /*recover extra inputs from users, at current convergence iteration: */
     
    21262248        int     found=0;
    21272249
     2250        /*dynamic objects pointed to by hooks: */
     2251        Node**  nodes=NULL;
     2252        Matpar* matpar=NULL;
     2253        Matice* matice=NULL;
     2254        Numpar* numpar=NULL;
     2255
    21282256        ParameterInputs* inputs=NULL;
    21292257
    21302258        /*recover pointers: */
    21312259        inputs=(ParameterInputs*)vinputs;
     2260
     2261        /*recover objects from hooks: */
     2262        nodes=(Node**)hnodes.deliverp();
     2263        matpar=(Matpar*)hmatpar.delivers();
     2264        matice=(Matice*)hmatice.delivers();
     2265        numpar=(Numpar*)hnumpar.delivers();
     2266
     2267        /*recover objects from hooks: */
     2268        nodes=(Node**)hnodes.deliverp();
     2269        matpar=(Matpar*)hmatpar.delivers();
     2270        matice=(Matice*)hmatice.delivers();
     2271        numpar=(Numpar*)hnumpar.delivers();
    21322272
    21332273        /*recover extra inputs from users, at current convergence iteration: */
     
    22242364        int     dofs2[1]={1};
    22252365
     2366        /*dynamic objects pointed to by hooks: */
     2367        Node**  nodes=NULL;
     2368        Matpar* matpar=NULL;
     2369        Matice* matice=NULL;
     2370        Numpar* numpar=NULL;
     2371
    22262372        ParameterInputs* inputs=NULL;
    22272373
    22282374        /*recover pointers: */
    22292375        inputs=(ParameterInputs*)vinputs;
     2376
     2377        /*recover objects from hooks: */
     2378        nodes=(Node**)hnodes.deliverp();
     2379        matpar=(Matpar*)hmatpar.delivers();
     2380        matice=(Matice*)hmatice.delivers();
     2381        numpar=(Numpar*)hnumpar.delivers();
    22302382
    22312383        /* recover input parameters: */
     
    22542406
    22552407                /*Get melting at gaussian point: */
    2256                 GetParameterValue(&meltingvalue, &melting[0],gauss_l1l2l3);
     2408                GetParameterValue(&meltingvalue, &this->properties.melting[0],gauss_l1l2l3);
    22572409
    22582410                /*Get velocity at gaussian point: */
     
    22612413
    22622414                /*Get bed slope: */
    2263                 GetParameterDerivativeValue(&slope[0], &b[0],&xyz_list[0][0], gauss_l1l2l3);
     2415                GetParameterDerivativeValue(&slope[0], &this->properties.b[0],&xyz_list[0][0], gauss_l1l2l3);
    22642416                dbdx=slope[0];
    22652417                dbdy=slope[1];
     
    23332485        double  thickness;
    23342486
     2487        /*dynamic objects pointed to by hooks: */
     2488        Node**  nodes=NULL;
     2489        Matpar* matpar=NULL;
     2490        Matice* matice=NULL;
     2491        Numpar* numpar=NULL;
     2492
    23352493        ParameterInputs* inputs=NULL;
    23362494
    23372495        /*First, if we are on water, return empty vector: */
    2338         if(onwater)return;
     2496        if(this->properties.onwater)return;
    23392497
    23402498        /*recover pointers: */
    23412499        inputs=(ParameterInputs*)vinputs;
     2500
     2501        /*recover objects from hooks: */
     2502        nodes=(Node**)hnodes.deliverp();
     2503        matpar=(Matpar*)hmatpar.delivers();
     2504        matice=(Matice*)hmatice.delivers();
     2505        numpar=(Numpar*)hnumpar.delivers();
    23422506
    23432507        /* Get node coordinates and dof list: */
     
    23842548
    23852549                /*Compute thickness at gaussian point: */
    2386                 GetParameterValue(&thickness, &h[0],gauss_l1l2l3);
     2550                GetParameterValue(&thickness, &this->properties.h[0],gauss_l1l2l3);
    23872551       
    2388                 GetParameterDerivativeValue(&slope[0], &s[0],&xyz_list[0][0], gauss_l1l2l3);
     2552                GetParameterDerivativeValue(&slope[0], &this->properties.s[0],&xyz_list[0][0], gauss_l1l2l3);
    23892553               
    23902554                /*In case we have plastic basal drag, compute plastic stress at gaussian point from k1, k2 and k3 fields in the
    23912555                 * element itself: */
    2392                 if(friction_type==1){
    2393                         GetParameterValue(&plastic_stress, &k[0],gauss_l1l2l3);
     2556                if(this->properties.friction_type==1){
     2557                        GetParameterValue(&plastic_stress, &this->properties.k[0],gauss_l1l2l3);
    23942558                }
    23952559
     
    24172581
    24182582                /*Build pe_g_gaussian vector: */
    2419                 if(friction_type==1){
     2583                if(this->properties.friction_type==1){
    24202584                        for (i=0;i<numgrids;i++){
    24212585                                for (j=0;j<NDOF2;j++){
     
    25022666        int     found=0;
    25032667
     2668        /*dynamic objects pointed to by hooks: */
     2669        Node**  nodes=NULL;
     2670        Matpar* matpar=NULL;
     2671        Matice* matice=NULL;
     2672        Numpar* numpar=NULL;
     2673
    25042674        ParameterInputs* inputs=NULL;
    25052675
    25062676        /*recover pointers: */
    25072677        inputs=(ParameterInputs*)vinputs;
     2678
     2679        /*recover objects from hooks: */
     2680        nodes=(Node**)hnodes.deliverp();
     2681        matpar=(Matpar*)hmatpar.delivers();
     2682        matice=(Matice*)hmatice.delivers();
     2683        numpar=(Numpar*)hnumpar.delivers();
    25082684
    25092685        /*recover extra inputs from users, at current convergence iteration: */
     
    25982774        int     found=0;
    25992775
     2776        /*dynamic objects pointed to by hooks: */
     2777        Node**  nodes=NULL;
     2778        Matpar* matpar=NULL;
     2779        Matice* matice=NULL;
     2780        Numpar* numpar=NULL;
     2781
    26002782        ParameterInputs* inputs=NULL;
    26012783
    26022784        /*recover pointers: */
    26032785        inputs=(ParameterInputs*)vinputs;
     2786
     2787        /*recover objects from hooks: */
     2788        nodes=(Node**)hnodes.deliverp();
     2789        matpar=(Matpar*)hmatpar.delivers();
     2790        matice=(Matice*)hmatice.delivers();
     2791        numpar=(Numpar*)hnumpar.delivers();
    26042792
    26052793        /*recover extra inputs from users, at current convergence iteration: */
     
    26902878        double  slope[2];
    26912879
     2880        /*dynamic objects pointed to by hooks: */
     2881        Node**  nodes=NULL;
     2882        Matpar* matpar=NULL;
     2883        Matice* matice=NULL;
     2884        Numpar* numpar=NULL;
     2885
     2886        /*recover objects from hooks: */
     2887        nodes=(Node**)hnodes.deliverp();
     2888        matpar=(Matpar*)hmatpar.delivers();
     2889        matice=(Matice*)hmatice.delivers();
     2890        numpar=(Numpar*)hnumpar.delivers();
     2891
    26922892        /* Get node coordinates and dof list: */
    26932893        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
     
    26982898
    26992899        if ( (sub_analysis_type==SurfaceXAnalysisEnum()) || (sub_analysis_type==SurfaceYAnalysisEnum())){
    2700                 for(i=0;i<numdof;i++) param[i]=s[i];
     2900                for(i=0;i<numdof;i++) param[i]=this->properties.s[i];
    27012901        }
    27022902        if ( (sub_analysis_type==BedXAnalysisEnum()) || (sub_analysis_type==BedYAnalysisEnum())){
    2703                 for(i=0;i<numdof;i++) param[i]=b[i];
     2903                for(i=0;i<numdof;i++) param[i]=this->properties.b[i];
    27042904        }
    27052905
     
    27912991        double  scalar_ocean;
    27922992
     2993        /*dynamic objects pointed to by hooks: */
     2994        Node**  nodes=NULL;
     2995        Matpar* matpar=NULL;
     2996        Matice* matice=NULL;
     2997        Numpar* numpar=NULL;
     2998
    27932999        ParameterInputs* inputs=NULL;
    27943000
    27953001        /*recover pointers: */
    27963002        inputs=(ParameterInputs*)vinputs;
     3003       
     3004        /*recover objects from hooks: */
     3005        nodes=(Node**)hnodes.deliverp();
     3006        matpar=(Matpar*)hmatpar.delivers();
     3007        matice=(Matice*)hmatice.delivers();
     3008        numpar=(Numpar*)hnumpar.delivers();
    27973009       
    27983010        /* Get node coordinates and dof list: */
     
    29063118        ParameterInputs* inputs=NULL;
    29073119
     3120        /*dynamic objects pointed to by hooks: */
     3121        Node**  nodes=NULL;
     3122        Matpar* matpar=NULL;
     3123        Matice* matice=NULL;
     3124        Numpar* numpar=NULL;
     3125
    29083126        /*recover pointers: */
    29093127        inputs=(ParameterInputs*)vinputs;
     3128
     3129        /*recover objects from hooks: */
     3130        nodes=(Node**)hnodes.deliverp();
     3131        matpar=(Matpar*)hmatpar.delivers();
     3132        matice=(Matice*)hmatice.delivers();
     3133        numpar=(Numpar*)hnumpar.delivers();
    29103134       
    29113135        /* Get node coordinates and dof list: */
     
    29343158       
    29353159        /*Initialize all fields: */
    2936         if (friction_type!=2)ISSMERROR(" non-viscous friction not supported yet!");
     3160        if (this->properties.friction_type!=2)ISSMERROR(" non-viscous friction not supported yet!");
    29373161       
    29383162        friction->element_type=(char*)xmalloc((strlen("3d")+1)*sizeof(char));
     
    29423166        friction->rho_ice=matpar->GetRhoIce();
    29433167        friction->rho_water=matpar->GetRhoWater();
    2944         friction->K=&k[0];
    2945         friction->bed=&b[0];
    2946         friction->thickness=&h[0];
     3168        friction->K=&this->properties.k[0];
     3169        friction->bed=&this->properties.b[0];
     3170        friction->thickness=&this->properties.h[0];
    29473171        friction->velocities=&vxvyvz_list[0][0];
    2948         friction->p=p;
    2949         friction->q=q;
     3172        friction->p=this->properties.p;
     3173        friction->q=this->properties.q;
    29503174
    29513175        /*Compute alpha2_list: */
     
    29773201
    29783202                /*Get geothermal flux and basal friction */
    2979                 GetParameterValue(&geothermalflux_value,&geothermalflux[0],gauss_coord);
     3203                GetParameterValue(&geothermalflux_value,&this->properties.geothermalflux[0],gauss_coord);
    29803204                GetParameterValue(&basalfriction,&basalfriction_list[0],gauss_coord);
    29813205
     
    30003224        xfree((void**)&gauss_weights);
    30013225
    3002 }
    3003 /*}}}*/
    3004 /*FUNCTION DeepEcho{{{1*/
    3005 
    3006 void Tria::DeepEcho(void){
    3007 
    3008         printf("Tria:\n");
    3009         printf("   id: %i\n",id);
    3010         printf("   mid: %i\n",mid);
    3011         printf("   mparid: %i\n",mparid);
    3012         printf("   node_ids=[%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2]);
    3013         printf("   node_offsets=[%i,%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2]);
    3014         printf("   matice_offset=%i\n",matice_offset);
    3015         printf("   matpar_offset=%i\n",matpar_offset);
    3016         printf("   h=[%g,%g,%g]\n",h[0],h[1],h[2]);
    3017         printf("   s=[%g,%g,%g]\n",s[0],s[1],s[2]);
    3018         printf("   b=[%g,%g,%g]\n",b[0],b[1],b[2]);
    3019         printf("   k=[%g,%g,%g]\n",k[0],k[1],k[2]);
    3020         printf("   melting=[%g,%g,%g]\n",melting[0],melting[1],melting[2]);
    3021         printf("   accumulation=[%g,%g,%g]\n",accumulation[0],accumulation[1],accumulation[2]);
    3022         printf("   geothermalflux=[%g,%g,%g]\n",geothermalflux[0],geothermalflux[1],geothermalflux[2]);
    3023         printf("   friction_type: %i\n",friction_type);
    3024         printf("   p: %g\n",p);
    3025         printf("   q: %g\n",q);
    3026         printf("   shelf: %i\n",shelf);
    3027         printf("   onbed: %i\n",onbed);
    3028         printf("   onwater: %i\n",onwater);
    3029         printf("   nodes: \n");
    3030         if(nodes[0])nodes[0]->Echo();
    3031         if(nodes[1])nodes[1]->Echo();
    3032         if(nodes[2])nodes[2]->Echo();
    3033         if(matice)matice->Echo();
    3034         if(matpar)matpar->Echo();
    3035 
    3036         return;
    30373226}
    30383227/*}}}*/
     
    30933282        double fit=-1;
    30943283
     3284        /*dynamic objects pointed to by hooks: */
     3285        Node**  nodes=NULL;
     3286        Matpar* matpar=NULL;
     3287        Matice* matice=NULL;
     3288        Numpar* numpar=NULL;
     3289
    30953290        ParameterInputs* inputs=NULL;
    30963291
    30973292        /*recover pointers: */
    30983293        inputs=(ParameterInputs*)vinputs;
     3294
     3295        /*recover objects from hooks: */
     3296        nodes=(Node**)hnodes.deliverp();
     3297        matpar=(Matpar*)hmatpar.delivers();
     3298        matice=(Matice*)hmatice.delivers();
     3299        numpar=(Numpar*)hnumpar.delivers();
    30993300
    31003301        /* Get node coordinates and dof list: */
     
    33023503}
    33033504/*}}}*/
    3304 /*FUNCTION Echo {{{1*/
    3305 
    3306 void Tria::Echo(void){
    3307 
    3308         printf("Tria:\n");
    3309         printf("   id: %i\n",id);
    3310         printf("   mid: %i\n",mid);
    3311         printf("   mparid: %i\n",mparid);
    3312         printf("   node_ids=[%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2]);
    3313         printf("   node_offsets=[%i,%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2]);
    3314         printf("   matice_offset=%i\n",matice_offset);
    3315         printf("   matpar_offset=%i\n",matpar_offset);
    3316         printf("   h=[%g,%g,%g]\n",h[0],h[1],h[2]);
    3317         printf("   s=[%g,%g,%g]\n",s[0],s[1],s[2]);
    3318         printf("   b=[%g,%g,%g]\n",b[0],b[1],b[2]);
    3319         printf("   k=[%g,%g,%g]\n",k[0],k[1],k[2]);
    3320         printf("   melting=[%g,%g,%g]\n",melting[0],melting[1],melting[2]);
    3321         printf("   accumulation=[%g,%g,%g]\n",accumulation[0],accumulation[1],accumulation[2]);
    3322         printf("   geothermalflux=[%g,%g,%g]\n",geothermalflux[0],geothermalflux[1],geothermalflux[2]);
    3323         printf("   friction_type: %i\n",friction_type);
    3324         printf("   p: %g\n",p);
    3325         printf("   q: %g\n",q);
    3326         printf("   shelf: %i\n",shelf);
    3327         printf("   onbed: %i\n",onbed);
    3328         printf("   onwater: %i\n",onwater);
    3329         printf("   nodes: \n");
    3330         if(nodes[0])nodes[0]->Echo();
    3331         if(nodes[1])nodes[1]->Echo();
    3332         if(nodes[2])nodes[2]->Echo();
    3333         if(matice)matice->Echo();
    3334         if(matpar)matpar->Echo();
    3335 
    3336         return;
    3337 }
    3338 /*}}}*/
    33393505/*FUNCTION Enum {{{1*/
    33403506int Tria::Enum(void){
     
    33513517        double xyz_list[numgrids][3];
    33523518        double x1,y1,x2,y2,x3,y3;
     3519
     3520        /*dynamic objects pointed to by hooks: */
     3521        Node**  nodes=NULL;
     3522
     3523        /*recover objects from hooks: */
     3524        nodes=(Node**)hnodes.deliverp();
    33533525
    33543526        /*Get xyz list: */
     
    33683540        double xyz_list[numgrids][3];
    33693541        double x1,y1,x2,y2,x3,y3;
     3542
     3543        /*dynamic objects pointed to by hooks: */
     3544        Node**  nodes=NULL;
     3545
     3546        /*recover objects from hooks: */
     3547        nodes=(Node**)hnodes.deliverp();
    33703548
    33713549        /*Get area: */
     
    34763654
    34773655        int i;
    3478         for(i=0;i<3;i++)bed_list[i]=b[i];
     3656        for(i=0;i<3;i++)bed_list[i]=this->properties.b[i];
    34793657
    34803658}
     
    35553733        int doflist_per_node[MAXDOFSPERNODE];
    35563734        int numberofdofspernode;
     3735
     3736        /*dynamic objects pointed to by hooks: */
     3737        Node**  nodes=NULL;
     3738
     3739        /*recover objects from hooks: */
     3740        nodes=(Node**)hnodes.deliverp();
    35573741       
    35583742        for(i=0;i<3;i++){
     
    35713755void  Tria::GetDofList1(int* doflist){
    35723756
     3757        /*dynamic objects pointed to by hooks: */
     3758        Node**  nodes=NULL;
     3759
     3760        /*recover objects from hooks: */
     3761        nodes=(Node**)hnodes.deliverp();
     3762       
    35733763        int i;
    35743764        for(i=0;i<3;i++){
     
    37233913/*FUNCTION GetMatPar {{{1*/
    37243914void* Tria::GetMatPar(){
     3915
     3916        /*dynamic objects pointed to by hooks: */
     3917        Matpar* matpar=NULL;
     3918
     3919        /*recover objects from hooks: */
     3920        matpar=(Matpar*)hmatpar.delivers();
     3921
    37253922        return matpar;
    37263923}
     
    38064003void  Tria::GetNodes(void** vpnodes){
    38074004        int i;
    3808         Node** pnodes=(Node**)vpnodes;
    3809 
     4005        Node** pnodes=NULL;
     4006
     4007        /*dynamic objects pointed to by hooks: */
     4008        Node**  nodes=NULL;
     4009       
     4010        /*recover nodes: */
     4011        pnodes=(Node**)vpnodes;
     4012
     4013        /*recover objects from hooks: */
     4014        nodes=(Node**)hnodes.deliverp();
     4015       
    38104016        for(i=0;i<3;i++){
    38114017                pnodes[i]=nodes[i];
     
    38154021/*FUNCTION GetOnBed {{{1*/
    38164022int Tria::GetOnBed(){
    3817         return onbed;
     4023        return this->properties.onbed;
    38184024}
    38194025/*}}}*/
     
    38634069/*FUNCTION GetShelf {{{1*/
    38644070int   Tria::GetShelf(){
    3865         return shelf;
     4071        return this->properties.shelf;
    38664072}
    38674073/*}}}*/
     
    38894095
    38904096        int i;
    3891         for(i=0;i<3;i++)thickness_list[i]=h[i];
     4097        for(i=0;i<3;i++)thickness_list[i]=this->properties.h[i];
    38924098}
    38934099/*}}}*/
     
    38964102
    38974103        /*If on water, grad = 0: */
    3898         if(onwater)return;
     4104        if(this->properties.onwater)return;
    38994105
    39004106        if (strcmp(control_type,"drag")==0){
     
    39684174        double  B_gauss;
    39694175
     4176        /*dynamic objects pointed to by hooks: */
     4177        Node**  nodes=NULL;
     4178        Matpar* matpar=NULL;
     4179        Matice* matice=NULL;
     4180        Numpar* numpar=NULL;
     4181
    39704182        ParameterInputs* inputs=NULL;
    39714183
    39724184        /*recover pointers: */
    39734185        inputs=(ParameterInputs*)vinputs;
     4186
     4187        /*recover objects from hooks: */
     4188        nodes=(Node**)hnodes.deliverp();
     4189        matpar=(Matpar*)hmatpar.delivers();
     4190        matice=(Matice*)hmatice.delivers();
     4191        numpar=(Numpar*)hnumpar.delivers();
    39744192
    39754193        /* Get node coordinates and dof list: */
     
    39814199
    39824200        /* recover input parameters: */
    3983         inputs->Recover("thickness",&h[0],1,dofs,numgrids,(void**)nodes);
     4201        inputs->Recover("thickness",&this->properties.h[0],1,dofs,numgrids,(void**)nodes);
    39844202        if(!inputs->Recover("velocity",&vxvy_list[0][0],2,dofs2,numgrids,(void**)nodes)){
    39854203                ISSMERROR("missing velocity input parameter");
     
    40174235
    40184236                /*Get thickness: */
    4019                 GetParameterValue(&thickness, &h[0],gauss_l1l2l3);
     4237                GetParameterValue(&thickness, &this->properties.h[0],gauss_l1l2l3);
    40204238
    40214239                /*Get strain rate, if velocity has been supplied: */
     
    41404358        double epsilon[3]; /* epsilon=[exx,eyy,exy];*/
    41414359
     4360        /*dynamic objects pointed to by hooks: */
     4361        Node**  nodes=NULL;
     4362        Matpar* matpar=NULL;
     4363        Matice* matice=NULL;
     4364        Numpar* numpar=NULL;
     4365
    41424366        ParameterInputs* inputs=NULL;
    41434367
     
    41454369        inputs=(ParameterInputs*)vinputs;
    41464370
     4371        /*recover objects from hooks: */
     4372        nodes=(Node**)hnodes.deliverp();
     4373        matpar=(Matpar*)hmatpar.delivers();
     4374        matice=(Matice*)hmatice.delivers();
     4375        numpar=(Numpar*)hnumpar.delivers();
     4376
    41474377        /*Get out if shelf*/
    4148         if(shelf) return;
     4378        if(this->properties.shelf) return;
    41494379
    41504380        /* Get node coordinates and dof list: */
     
    41564386
    41574387        /* recover input parameters: */
    4158         inputs->Recover("drag",&k[0],1,dofs1,numgrids,(void**)nodes);
    4159         inputs->Recover("bed",&b[0],1,dofs1,numgrids,(void**)nodes);
    4160         inputs->Recover("thickness",&h[0],1,dofs1,numgrids,(void**)nodes);
     4388        inputs->Recover("drag",&this->properties.k[0],1,dofs1,numgrids,(void**)nodes);
     4389        inputs->Recover("bed",&this->properties.b[0],1,dofs1,numgrids,(void**)nodes);
     4390        inputs->Recover("thickness",&this->properties.h[0],1,dofs1,numgrids,(void**)nodes);
    41614391        if(!inputs->Recover("velocity",&vxvy_list[0][0],2,dofs2,numgrids,(void**)nodes)){
    41624392                ISSMERROR("missing velocity input parameter");
     
    41954425
    41964426                /*Build alpha_complement_list: */
    4197                 if (!shelf && (friction_type==2)){
     4427                if (!this->properties.shelf && (this->properties.friction_type==2)){
    41984428               
    41994429                        /*Allocate friction object: */
     
    42074437                        friction->rho_ice=matpar->GetRhoIce();
    42084438                        friction->rho_water=matpar->GetRhoWater();
    4209                         friction->K=&k[0];
    4210                         friction->bed=&b[0];
    4211                         friction->thickness=&h[0];
     4439                        friction->K=&this->properties.k[0];
     4440                        friction->bed=&this->properties.b[0];
     4441                        friction->thickness=&this->properties.h[0];
    42124442                        friction->velocities=&vxvy_list[0][0];
    4213                         friction->p=p;
    4214                         friction->q=q;
     4443                        friction->p=this->properties.p;
     4444                        friction->q=this->properties.q;
    42154445
    42164446                        if(friction->p!=1) ISSMERROR("non-linear friction not supported yet in control methods!");
     
    42304460                /*Recover alpha_complement and k: */
    42314461                GetParameterValue(&alpha_complement, &alpha_complement_list[0],gauss_l1l2l3);
    4232                 GetParameterValue(&drag, &k[0],gauss_l1l2l3);
     4462                GetParameterValue(&drag, &this->properties.k[0],gauss_l1l2l3);
    42334463                #ifdef _ISSM_DEBUG_
    42344464                        printf("Drag complement: %20.20lf Drag: %20.20lf\n",alpha_complement,drag);
     
    42624492
    42634493                /*Get k derivative: dk/dx */
    4264                 GetParameterDerivativeValue(&dk[0], &k[0],&xyz_list[0][0], gauss_l1l2l3);
     4494                GetParameterDerivativeValue(&dk[0], &this->properties.k[0],&xyz_list[0][0], gauss_l1l2l3);
    42654495
    42664496                /*Build gradje_g_gaussian vector (actually -dJ/ddrag): */
     
    43624592        ParameterInputs* inputs=NULL;
    43634593
     4594        /*dynamic objects pointed to by hooks: */
     4595        Node**  nodes=NULL;
     4596        Matpar* matpar=NULL;
     4597        Matice* matice=NULL;
     4598        Numpar* numpar=NULL;
     4599
    43644600        /*Get out if shelf*/
    4365         if(shelf) return;
     4601        if(this->properties.shelf) return;
    43664602
    43674603        /*recover pointers: */
    43684604        inputs=(ParameterInputs*)vinputs;
     4605
     4606        /*recover objects from hooks: */
     4607        nodes=(Node**)hnodes.deliverp();
     4608        matpar=(Matpar*)hmatpar.delivers();
     4609        matice=(Matice*)hmatice.delivers();
     4610        numpar=(Numpar*)hnumpar.delivers();
    43694611
    43704612        /* Get node coordinates and dof list: */
     
    43764618
    43774619        /* recover input parameters: */
    4378         inputs->Recover("drag",&k[0],1,dofs1,numgrids,(void**)nodes);
    4379         inputs->Recover("bed",&b[0],1,dofs1,numgrids,(void**)nodes);
    4380         inputs->Recover("thickness",&h[0],1,dofs1,numgrids,(void**)nodes);
     4620        inputs->Recover("drag",&this->properties.k[0],1,dofs1,numgrids,(void**)nodes);
     4621        inputs->Recover("bed",&this->properties.b[0],1,dofs1,numgrids,(void**)nodes);
     4622        inputs->Recover("thickness",&this->properties.h[0],1,dofs1,numgrids,(void**)nodes);
    43814623        if(!inputs->Recover("velocity",&vxvyvz_list[0][0],3,dofs3,numgrids,(void**)nodes)){
    43824624                ISSMERROR("missing velocity input parameter");
     
    44174659
    44184660                /*Build alpha_complement_list: */
    4419                 if (!shelf && (friction_type==2)){
     4661                if (!this->properties.shelf && (this->properties.friction_type==2)){
    44204662
    44214663                        /*Allocate friction object: */
     
    44294671                        friction->rho_ice=matpar->GetRhoIce();
    44304672                        friction->rho_water=matpar->GetRhoWater();
    4431                         friction->K=&k[0];
    4432                         friction->bed=&b[0];
    4433                         friction->thickness=&h[0];
     4673                        friction->K=&this->properties.k[0];
     4674                        friction->bed=&this->properties.b[0];
     4675                        friction->thickness=&this->properties.h[0];
    44344676                        friction->velocities=&vxvyvz_list[0][0];
    4435                         friction->p=p;
    4436                         friction->q=q;
     4677                        friction->p=this->properties.p;
     4678                        friction->q=this->properties.q;
    44374679
    44384680                        if(friction->p!=1) ISSMERROR("non-linear friction not supported yet in control methods!");
     
    44524694                /*Recover alpha_complement and k: */
    44534695                GetParameterValue(&alpha_complement, &alpha_complement_list[0],gauss_l1l2l3);
    4454                 GetParameterValue(&drag, &k[0],gauss_l1l2l3);
     4696                GetParameterValue(&drag, &this->properties.k[0],gauss_l1l2l3);
    44554697#ifdef _ISSM_DEBUG_
    44564698                printf("Drag complement: %20.20lf Drag: %20.20lf\n",alpha_complement,drag);
     
    44934735
    44944736                /*Get k derivative: dk/dx */
    4495                 GetParameterDerivativeValue(&dk[0], &k[0],&xyz_list[0][0], gauss_l1l2l3);
     4737                GetParameterDerivativeValue(&dk[0], &this->properties.k[0],&xyz_list[0][0], gauss_l1l2l3);
    44964738
    44974739                /*Build gradje_g_gaussian vector (actually -dJ/ddrag): */
     
    45554797        double rho_ice;
    45564798
     4799        /*dynamic objects pointed to by hooks: */
     4800        Node**  nodes=NULL;
     4801        Matpar* matpar=NULL;
     4802
     4803        /*recover objects from hooks: */
     4804        nodes=(Node**)hnodes.deliverp();
     4805        matpar=(Matpar*)hmatpar.delivers();
     4806
    45574807        /*Get material parameters :*/
    4558         rho_ice=this->matpar->GetRhoIce();
     4808        rho_ice=matpar->GetRhoIce();
    45594809
    45604810        /*First off, check that this segment belongs to this element: */
     
    45884838
    45894839        /*get thickness and velocity at two segment extremities: */
    4590         GetParameterValue(&h1, &h[0],gauss_1);
    4591         GetParameterValue(&h2, &h[0],gauss_2);
     4840        GetParameterValue(&h1, &this->properties.h[0],gauss_1);
     4841        GetParameterValue(&h2, &this->properties.h[0],gauss_2);
    45924842        GetParameterValue(&vx1, &vx_list[0],gauss_1);
    45934843        GetParameterValue(&vy1, &vy_list[0],gauss_1);
     
    46054855/*FUNCTION MaticeConfiguration {{{1*/
    46064856void  Tria::MaticeConfiguration(Matice* tria_matice,int tria_matice_offset){
    4607            matice=tria_matice;
    4608                    matice_offset=tria_matice_offset;
     4857
     4858        /*dynamic objects pointed to by hooks: */
     4859        Matice* matice=NULL;
     4860
     4861        /*recover objects from hooks: */
     4862        matice=(Matice*)hmatice.delivers();
     4863       
     4864        ISSMERROR("not supported yet!");
     4865
     4866        /*matice=tria_matice;
     4867        matice_offset=tria_matice_offset;*/
     4868
    46094869}
    46104870/*}}}*/
     
    46124872void  Tria::MatparConfiguration(Matpar* tria_matpar,int tria_matpar_offset){
    46134873
    4614            matpar=tria_matpar;
    4615                    matpar_offset=tria_matpar_offset;
     4874        /*dynamic objects pointed to by hooks: */
     4875        Matpar* matpar=NULL;
     4876
     4877        /*recover objects from hooks: */
     4878        matpar=(Matpar*)hmatpar.delivers();
     4879
     4880        ISSMERROR("not supported yet!");
     4881
     4882        /*matpar=tria_matpar;
     4883        matpar_offset=tria_matpar_offset;*/
    46164884
    46174885}
     
    46674935        ParameterInputs* inputs=NULL;
    46684936
     4937        /*dynamic objects pointed to by hooks: */
     4938        Node**  nodes=NULL;
     4939        Matpar* matpar=NULL;
     4940        Matice* matice=NULL;
     4941        Numpar* numpar=NULL;
     4942
    46694943        /*If on water, return 0: */
    4670         if(onwater)return 0;
     4944        if(this->properties.onwater)return 0;
    46714945
    46724946        /*recover pointers: */
    46734947        inputs=(ParameterInputs*)vinputs;
     4948
     4949        /*recover objects from hooks: */
     4950        nodes=(Node**)hnodes.deliverp();
     4951        matpar=(Matpar*)hmatpar.delivers();
     4952        matice=(Matice*)hmatice.delivers();
     4953        numpar=(Numpar*)hnumpar.delivers();
    46744954
    46754955        /* Get node coordinates and dof list: */
     
    48245104void  Tria::NodeConfiguration(int* tria_node_ids,Node* tria_nodes[3],int* tria_node_offsets){
    48255105
    4826         int i;
     5106        /*dynamic objects pointed to by hooks: */
     5107        Node**  nodes=NULL;
     5108
     5109        /*recover objects from hooks: */
     5110        nodes=(Node**)hnodes.deliverp();
     5111
     5112        ISSMERROR("not supported yet!");
     5113
     5114        /*int i;
    48275115        for(i=0;i<3;i++){
    48285116                node_ids[i]=tria_node_ids[i];
    48295117                nodes[i]=tria_nodes[i];
    48305118                node_offsets[i]=tria_node_offsets[i];
    4831         }
     5119        }*/
    48325120
    48335121}
     
    48365124void  Tria::NumparConfiguration(Numpar* tria_numpar,int tria_numpar_offset){
    48375125
    4838         numpar=tria_numpar;
    4839         numpar_offset=tria_numpar_offset;
     5126        /*dynamic objects pointed to by hooks: */
     5127        Numpar* numpar=NULL;
     5128
     5129        /*recover objects from hooks: */
     5130        numpar=(Numpar*)hnumpar.delivers();
     5131
     5132        ISSMERROR("not supported yet!");
     5133
     5134        /*numpar=tria_numpar;
     5135        numpar_offset=tria_numpar_offset;*/
    48405136
    48415137}
     
    48835179        double normal[3];
    48845180
     5181        /*dynamic objects pointed to by hooks: */
     5182        Node**  nodes=NULL;
     5183
     5184        /*recover objects from hooks: */
     5185        nodes=(Node**)hnodes.deliverp();
     5186
    48855187        /*If on water, return 0: */
    4886         if(onwater)return 0;
     5188        if(this->properties.onwater)return 0;
    48875189
    48885190        /* Get node coordinates and dof list: */
     
    49155217        double  new_h[3];
    49165218
     5219        /*dynamic objects pointed to by hooks: */
     5220        Node**  nodes=NULL;
     5221        Matpar* matpar=NULL;
     5222        Matice* matice=NULL;
     5223        Numpar* numpar=NULL;
     5224
    49175225        ParameterInputs* inputs=NULL;
    49185226
    49195227        /*recover pointers: */
    49205228        inputs=(ParameterInputs*)vinputs;
     5229
     5230        /*recover objects from hooks: */
     5231        nodes=(Node**)hnodes.deliverp();
     5232        matpar=(Matpar*)hmatpar.delivers();
     5233        matice=(Matice*)hmatice.delivers();
     5234        numpar=(Numpar*)hnumpar.delivers();
    49215235
    49225236        /*Update internal data if inputs holds new values: */
    49235237        //if (id==1) printf("WARNING if QMU: no hydrostatic equilibrium is applied here (conflict with prognostic, which does not have matpar)\n");
    49245238        //For now
    4925         inputs->Recover("thickness",&h[0],1,dofs,3,(void**)nodes);
     5239        inputs->Recover("thickness",&this->properties.h[0],1,dofs,3,(void**)nodes);
    49265240        //Later
    49275241        /*
     
    49315245        //Go through grids:
    49325246        for (i=0;i<3;i++){
    4933         if(this->nodes[i]->IsOnShelf()){
     5247        if(nodes[i]->IsOnShelf()){
    49345248        this->b[i]=this->b[i]-di*(new_h[i]-h[i]); //hydrostatic equilibrium;
    49355249        }
     
    49395253        }
    49405254        */
    4941         inputs->Recover("surface",&s[0],1,dofs,3,(void**)nodes);
    4942         inputs->Recover("bed",&b[0],1,dofs,3,(void**)nodes);
    4943         inputs->Recover("drag",&k[0],1,dofs,3,(void**)nodes);
    4944         inputs->Recover("melting",&melting[0],1,dofs,3,(void**)nodes);
    4945         inputs->Recover("accumulation",&accumulation[0],1,dofs,3,(void**)nodes);
    4946         inputs->Recover("geothermalflux",&geothermalflux[0],1,dofs,3,(void**)nodes);
     5255        inputs->Recover("surface",&this->properties.s[0],1,dofs,3,(void**)nodes);
     5256        inputs->Recover("bed",&this->properties.b[0],1,dofs,3,(void**)nodes);
     5257        inputs->Recover("drag",&this->properties.k[0],1,dofs,3,(void**)nodes);
     5258        inputs->Recover("melting",&this->properties.melting[0],1,dofs,3,(void**)nodes);
     5259        inputs->Recover("accumulation",&this->properties.accumulation[0],1,dofs,3,(void**)nodes);
     5260        inputs->Recover("geothermalflux",&this->properties.geothermalflux[0],1,dofs,3,(void**)nodes);
    49475261       
    49485262        //Update material if necessary
  • issm/trunk/src/c/objects/Tria.h

    r3359 r3383  
    88
    99#include "./Element.h"
     10#include "../DataSet/DataSet.h"
     11#include "./Object.h"
    1012#include "./Node.h"
    1113#include "./Matice.h"
     
    1315#include "./Numpar.h"
    1416#include "./ParameterInputs.h"
     17#include "./ElementProperties.h"
     18#include "./Hook.h"
     19
     20class Object;
     21class Hook;
     22class ElementProperties;
     23class DataSet;
    1524
    1625class Tria: public Element{
     
    1827        private:
    1928
    20                 /*ids:*/
    21                 int id;
     29                int  id;
    2230
    23                 /*nodes: */
    24                 int   node_ids[3]; //node ids
    25                 Node* nodes[3]; //node pointers
    26                 int   node_offsets[3]; //node offsets in nodes dataset
     31                Hook hnodes;  //hook to 3 nodes
     32                Hook hmatice; //hook to 1 matice
     33                Hook hmatpar; //hook to 1 matpar
     34                Hook hnumpar; //hook to 1 numpar
    2735
    28                 /*materials: */
    29                 int   mid;
    30                 Matice* matice;
    31                 int   matice_offset;
    32                
    33                 int mparid;
    34                 Matpar* matpar;
    35                 int   matpar_offset;
    36 
    37                 int numparid;
    38                 Numpar* numpar;
    39                 int   numpar_offset;
     36                ElementProperties properties;
    4037       
    41                 double h[3];
    42                 double s[3];
    43                 double b[3];
    44                 double k[3];
    45                 double melting[3];
    46                 double accumulation[3];
    47                 double geothermalflux[3];
    48                 int    friction_type;
    49                 double p;
    50                 double q;
    51                 int    shelf;
    52                 int    onbed;
    53                 bool   onwater;
    54 
    5538        public:
    5639
     40                /*FUNCTION constructors, destructors {{{1*/
    5741                Tria();
    58                 Tria(int id,int mid,int mparid,int numparid,int node_ids[3],double h[3],double s[3],double b[3],double k[3],double melting[3],double accumulation[3],double geothermalflux[3],int friction_type,double p,double q,int shelf,bool onwater);
     42                Tria(int tria_id,int* tria_node_ids, int tria_matice_id, int tria_matpar_id, int tria_numpar_id, ElementProperties* tria_properties);
     43                Tria(int tria_id,Hook* tria_hnodes, Hook* tria_hmatice, Hook* tria_hmatpar, Hook* tria_hnumpar, ElementProperties* tria_properties);
    5944                ~Tria();
    60 
     45                /*}}}*/
     46                /*FUNCTION object management {{{1*/
    6147                void  Echo();
    6248                void  DeepEcho();
     
    6854                int   GetId();
    6955                int   MyRank();
     56                /*}}}*/
     57                /*FUNCTION element numerical routines {{{1*/
    7058                void  Configure(void* loads,void* nodes,void* materials,void* parameters);
    7159                void  CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type);
     
    134122                double GetArea(void);
    135123                double GetAreaCoordinate(double x, double y, int which_one);
     124                /*}}}*/
    136125
    137126};
  • issm/trunk/src/m/classes/public/plot/applyoptions.m

    r3200 r3383  
    9090%Caxis
    9191if exist(options,'caxis'),
    92         if exist(options,'log'),
    93                 logvalue=getfieldvalue(options,'log');
    94                 if any(getfieldvalue(options,'caxis')<=0),
    95                         error('applyoptions error message: negative log values when trying to apply caxis option');
    96                 end
    97                 caxis(log(getfieldvalue(options,'caxis'))/log(logvalue));
    98         else
    99                 caxis(getfieldvalue(options,'caxis'));
    100         end
     92        caxis(getfieldvalue(options,'caxis'));
    10193end
    10294
  • issm/trunk/src/m/enum/PentaEnum.m

    r1714 r3383  
    77%      macro=PentaEnum()
    88
    9 macro=412;
     9macro=413;
  • issm/trunk/todo

    r3178 r3383  
    8282
    8383Get Matlab 7.8: version 4.2.3
    84 Use gprof to figure out where we are losing out time.
     84Use gprof to figure out where we are losing out time.
     85
     86Get rid of ResolvePointers
Note: See TracChangeset for help on using the changeset viewer.