Changeset 3417


Ignore:
Timestamp:
04/07/10 12:23:51 (15 years ago)
Author:
Eric.Larour
Message:

Massive temporary commit: redesign to include vertices (for galerkin discontinous), to simplify ModelProcessor.

Location:
issm/trunk/src
Files:
9 added
48 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/DataSet/DataSet.h

    r3372 r3417  
    77
    88
    9 #ifndef DATASET_H_
    10 #define DATASET_H_
     9#ifndef _DATASET_H_
     10#define _DATASET_H_
    1111
    1212#include <vector>
  • issm/trunk/src/c/Dofx/Dofx.cpp

    r3332 r3417  
    1010#include "../EnumDefinitions/EnumDefinitions.h"
    1111
    12 int Dofx( DofVec** ppartition, DofVec** ptpartition,DataSet* elements,DataSet* nodes, DataSet* params) {
     12int Dofx( DofVec** ppartition, DofVec** ptpartition, DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* params) {
    1313
    1414        int noerr=1;
     
    2121        /*intermediary: */
    2222        int  numberofnodes;
     23        int  numberofvertices;
    2324        int  numberofdofspernode;
    2425
     
    3132        tpartition=new DofVec("tpartition");
    3233
    33         /*First, recover number of grids from parameters: */
     34        /*First, recover number of vertices and nodes from parameters: */
     35        found=params->FindParam(&numberofvertices,"numberofvertices");
     36        if(!found)ISSMERROR(" could not find numberofvertices in parameters");
     37       
    3438        found=params->FindParam(&numberofnodes,"numberofnodes");
    3539        if(!found)ISSMERROR(" could not find numberofnodes in parameters");
     
    4145        /*Ensure that only for each cpu, the partition border nodes only will be taken into account once
    4246         * across the cluster. To do so, we flag all the clone nodes: */
     47        vertices->FlagClones(numberofvertices);
    4348        nodes->FlagClones(numberofnodes);
    4449
  • issm/trunk/src/c/Dofx/Dofx.h

    r2316 r3417  
    99
    1010/* local prototypes: */
    11 int             Dofx( DofVec** partition, DofVec** ptpartition,DataSet* elements,DataSet* nodesin,DataSet* params);
     11int             Dofx( DofVec** partition, DofVec** ptpartition,DataSet* elements,DataSet* nodesin, DataSet* verticesin, DataSet* params);
    1212
    1313#endif  /* _DOFX_H */
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.cpp

    r3383 r3417  
    1515int ParametersEnum(void){                   return          106; }
    1616int ResultsEnum(void){                      return          107; }
     17int VerticesEnum(void){                     return          108; }
    1718
    1819/*ANALYSIS TYPES: */
     
    7172int ElementEnum(void){                      return          410; }
    7273int TriaEnum(void){                         return          411; }
    73 int ElementPropertiesEnum(void){               return          412; }
    74 int PentaEnum(void){                        return          413; }
    75 int SingEnum(void){                         return          414; }
    76 int BeamEnum(void){                         return          415; }
     74int ElementPropertiesEnum(void){            return          412; }
     75int NodePropertiesEnum(void){               return          413; }
     76int PentaEnum(void){                        return          414; }
     77int SingEnum(void){                         return          415; }
     78int BeamEnum(void){                         return          416; }
     79int DofIndexingEnum(void){                  return          417; }
     80
    7781/*Grids: */
    78 int NodeEnum(void){                         return          420; }
     82int VertexEnum(void){                         return        420; }
     83int NodeEnum(void){                         return          421; }
    7984/*Loads: */
    8085int LoadEnum(void){                         return          430; }
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h

    r3383 r3417  
    1616int ParametersEnum(void);
    1717int ResultsEnum(void);
     18int VerticesEnum(void);
    1819
    1920/*ANALYSIS TYPES: */
     
    7374int TriaEnum(void);
    7475int ElementPropertiesEnum(void);
     76int NodePropertiesEnum(void);
    7577int PentaEnum(void);
    7678int SingEnum(void);
    7779int BeamEnum(void);
     80int DofIndexingEnum(void);
    7881/*Grids: */
    7982int NodeEnum(void);
     83int VertexEnum(void);
    8084/*Loads: */
    8185int LoadEnum(void);
  • issm/trunk/src/c/Makefile.am

    r3406 r3417  
    5252                                        ./objects/DakotaPlugin.h\
    5353                                        ./objects/DakotaPlugin.cpp\
    54                                         ./objects/Node.h\
    55                                         ./objects/Node.cpp\
    5654                                        ./objects/Vertex.h\
    5755                                        ./objects/Vertex.cpp\
    5856                                        ./objects/Hook.h\
    5957                                        ./objects/Hook.cpp\
     58                                        ./objects/DofIndexing.h\
     59                                        ./objects/DofIndexing.cpp\
     60                                        ./objects/NodeProperties.h\
     61                                        ./objects/NodeProperties.cpp\
     62                                        ./objects/Node.h\
     63                                        ./objects/Node.cpp\
    6064                                        ./objects/Result.h\
    6165                                        ./objects/Result.cpp\
     
    201205                                        ./ModelProcessorx/IoModel.h\
    202206                                        ./ModelProcessorx/IoModel.cpp\
     207                                        ./ModelProcessorx/Partitioning.cpp\
    203208                                        ./ModelProcessorx/CreateDataSets.cpp\
    204209                                        ./ModelProcessorx/CreateParameters.cpp\
     
    446451                                        ./objects/DakotaPlugin.h\
    447452                                        ./objects/DakotaPlugin.cpp\
     453                                        ./objects/DofIndexing.h\
     454                                        ./objects/DofIndexing.cpp\
     455                                        ./objects/NodeProperties.h\
     456                                        ./objects/NodeProperties.cpp\
    448457                                        ./objects/Node.h\
    449458                                        ./objects/Node.cpp\
     
    592601                                        ./ModelProcessorx/IoModel.h\
    593602                                        ./ModelProcessorx/IoModel.cpp\
     603                                        ./ModelProcessorx/Partitioning.cpp\
    594604                                        ./ModelProcessorx/CreateDataSets.cpp\
    595605                                        ./ModelProcessorx/CreateParameters.cpp\
  • issm/trunk/src/c/ModelProcessorx/Balancedthickness/CreateElementsNodesAndMaterialsBalancedthickness.cpp

    r3383 r3417  
    1313
    1414
    15 void    CreateElementsNodesAndMaterialsBalancedthickness(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
     15void    CreateElementsNodesAndMaterialsBalancedthickness(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1616
    1717
     
    2626        DataSet*    elements  = NULL;
    2727        DataSet*    nodes = NULL;
     28        DataSet*    vertices = NULL;
    2829        DataSet*    materials = NULL;
    2930       
    3031        /*Objects: */
    3132        Node*       node   = NULL;
     33        NodeProperties node_properties;
     34        Vertex*     vertex = NULL;
    3235        Tria*       tria = NULL;
    3336        Penta*      penta = NULL;
     
    9699        /* node constructor input: */
    97100        int node_id;
    98         int node_partitionborder=0;
    99         double node_x[3];
    100         double node_sigma;
     101        int vertex_id;
     102        int partitionborder=0;
    101103        int node_onbed;
    102104        int node_onsurface;
     
    121123        elements  = new DataSet(ElementsEnum());
    122124        nodes     = new DataSet(NodesEnum());
     125        vertices  = new DataSet(VerticesEnum());
    123126        materials = new DataSet(MaterialsEnum());
    124127
     
    436439        #endif
    437440
     441                #ifdef _PARALLEL_
     442                if(my_bordergrids[i]>1.0) { //this grid belongs to a partition border
     443                        partitionborder=1;
     444                }
     445                else{
     446                        partitionborder=0;
     447                }
     448                #else
     449                        partitionborder=0;
     450                #endif
     451
     452                /*create vertex: */
     453                vertex_id=i+1;
     454                vertex=new Vertex(vertex_id, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]),partitionborder);
     455                vertices->AddObject(vertex);
     456
     457                /*create node: */
    438458                node_id=i+1; //matlab indexing
    439459                       
    440460               
    441                
    442                 #ifdef _PARALLEL_
    443                 if(my_bordergrids[i]>1.0) { //this grid belongs to a partition border
    444                         node_partitionborder=1;
    445                 }
    446                 else{
    447                         node_partitionborder=0;
    448                 }
    449                 #else
    450                         node_partitionborder=0;
    451                 #endif
    452 
    453                 node_x[0]=iomodel->x[i];
    454                 node_x[1]=iomodel->y[i];
    455                 node_x[2]=iomodel->z[i];
    456                 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]);
    457                
    458                 node_onbed=(int)iomodel->gridonbed[i];
    459                 node_onsurface=(int)iomodel->gridonsurface[i]; 
    460                 node_onshelf=(int)iomodel->gridoniceshelf[i];   
    461                 node_onsheet=(int)iomodel->gridonicesheet[i];   
     461                node_properties.SetProperties(
     462                                (int)iomodel->gridonbed[i],
     463                                (int)iomodel->gridonsurface[i],
     464                                (int)iomodel->gridoniceshelf[i],
     465                                (int)iomodel->gridonicesheet[i]);
    462466
    463467                if (strcmp(iomodel->meshtype,"3d")==0){
     
    475479
    476480                /*Create node using its constructor: */
    477                 node=new Node(node_id,node_partitionborder,node_numdofs,node_x,node_sigma,node_onbed,node_onsurface,node_upper_node_id,node_onshelf,node_onsheet);
     481                node=new Node(node_id,vertex_id, node_upper_node_id, node_partitionborder,node_numdofs, &node_properties);   
     482
    478483
    479484                /*set single point constraints.: */
     
    497502         * datasets, it will not be redone: */
    498503        elements->Presort();
     504        vertices->Presort();
    499505        nodes->Presort();
    500506        materials->Presort();
     
    531537        *pelements=elements;
    532538        *pnodes=nodes;
     539        *pvertices=vertices;
    533540        *pmaterials=materials;
    534541
  • issm/trunk/src/c/ModelProcessorx/Balancedvelocities/CreateElementsNodesAndMaterialsBalancedvelocities.cpp

    r3383 r3417  
    1313
    1414
    15 void    CreateElementsNodesAndMaterialsBalancedvelocities(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
     15void    CreateElementsNodesAndMaterialsBalancedvelocities(DataSet** pelements,DataSet** pnodes, DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1616
    1717
     
    2626        DataSet*    elements  = NULL;
    2727        DataSet*    nodes = NULL;
     28        DataSet*    vertices = NULL;
    2829        DataSet*    materials = NULL;
    2930        ElementProperties* tria_properties=NULL;
     
    3233        /*Objects: */
    3334        Node*       node   = NULL;
     35        Vertex*     vertex = NULL;
    3436        Tria*       tria = NULL;
    3537        Penta*      penta = NULL;
     
    9698        /* node constructor input: */
    9799        int node_id;
    98         int node_partitionborder=0;
    99         double node_x[3];
    100         double node_sigma;
     100        int vertex_id;
     101        int partitionborder=0;
    101102        int node_onbed;
    102103        int node_onsurface;
     
    121122        elements  = new DataSet(ElementsEnum());
    122123        nodes     = new DataSet(NodesEnum());
     124        vertices  = new DataSet(VerticesEnum());
    123125        materials = new DataSet(MaterialsEnum());
    124126
     
    435437        #endif
    436438
     439                /*create vertex: */
     440                vertex_id=i+1;
     441                vertex=new Vertex(vertex_id, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]));
     442
     443                vertices->AddObject(vertex);
     444
    437445                node_id=i+1; //matlab indexing
    438446                       
    439                
    440                
    441447                #ifdef _PARALLEL_
    442448                if(my_bordergrids[i]>1.0) { //this grid belongs to a partition border
     
    450456                #endif
    451457
    452                 node_x[0]=iomodel->x[i];
    453                 node_x[1]=iomodel->y[i];
    454                 node_x[2]=iomodel->z[i];
    455                 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]);
    456                
    457                 node_onbed=(int)iomodel->gridonbed[i];
    458                 node_onsurface=(int)iomodel->gridonsurface[i]; 
    459                 node_onshelf=(int)iomodel->gridoniceshelf[i];   
    460                 node_onsheet=(int)iomodel->gridonicesheet[i];   
     458                node_properties.SetProperties(
     459                        (int)iomodel->gridonbed[i],
     460                        (int)iomodel->gridonsurface[i],
     461                        (int)iomodel->gridoniceshelf[i],
     462                        (int)iomodel->gridonicesheet[i]);
     463
    461464
    462465                if (strcmp(iomodel->meshtype,"3d")==0){
     
    474477
    475478                /*Create node using its constructor: */
    476                 node=new Node(node_id,node_partitionborder,node_numdofs,node_x,node_sigma,node_onbed,node_onsurface,node_upper_node_id,node_onshelf,node_onsheet);
     479                node=new Node(node_id,vertex_id, node_upper_node_id, node_partitionborder,node_numdofs, &node_properties);   
    477480
    478481                /*set single point constraints.: */
     
    497500        elements->Presort();
    498501        nodes->Presort();
     502        vertices->Presort();
    499503        materials->Presort();
    500504
     
    530534        *pelements=elements;
    531535        *pnodes=nodes;
     536        *pvertices=vertices;
    532537        *pmaterials=materials;
    533538
  • issm/trunk/src/c/ModelProcessorx/CreateDataSets.cpp

    r3354 r3417  
    1515
    1616
    17 void CreateDataSets(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,DataSet** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle){
     17void CreateDataSets(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,DataSet** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle){
    1818
    1919        /*create parameters common to all solutions: */
     
    2626                if (iomodel->sub_analysis_type==HorizAnalysisEnum()){
    2727
    28                         CreateElementsNodesAndMaterialsDiagnosticHoriz(pelements,pnodes,pmaterials, iomodel,iomodel_handle);
     28                        CreateElementsNodesAndMaterialsDiagnosticHoriz(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
    2929                        CreateConstraintsDiagnosticHoriz(pconstraints,iomodel,iomodel_handle);
    3030                        CreateLoadsDiagnosticHoriz(ploads,iomodel,iomodel_handle);
     
    3434                else if (iomodel->sub_analysis_type==VertAnalysisEnum()){
    3535               
    36                         CreateElementsNodesAndMaterialsDiagnosticVert(pelements,pnodes,pmaterials, iomodel,iomodel_handle);
     36                        CreateElementsNodesAndMaterialsDiagnosticVert(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
    3737                        CreateConstraintsDiagnosticVert(pconstraints,iomodel,iomodel_handle);
    3838                        CreateLoadsDiagnosticVert(ploads,iomodel,iomodel_handle);
     
    4141                else if (iomodel->sub_analysis_type==StokesAnalysisEnum()){
    4242
    43                         CreateElementsNodesAndMaterialsDiagnosticStokes(pelements,pnodes,pmaterials, iomodel,iomodel_handle);
     43                        CreateElementsNodesAndMaterialsDiagnosticStokes(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
    4444                        CreateConstraintsDiagnosticStokes(pconstraints,iomodel,iomodel_handle);
    4545                        CreateLoadsDiagnosticStokes(ploads,iomodel,iomodel_handle);
     
    4848                else if (iomodel->sub_analysis_type==HutterAnalysisEnum()){
    4949
    50                         CreateElementsNodesAndMaterialsDiagnosticHutter(pelements,pnodes,pmaterials, iomodel,iomodel_handle);
     50                        CreateElementsNodesAndMaterialsDiagnosticHutter(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    5151                        CreateConstraintsDiagnosticHutter(pconstraints,iomodel,iomodel_handle);
    5252                        CreateLoadsDiagnosticHutter(ploads,iomodel,iomodel_handle);
     
    5656        else if (iomodel->analysis_type==SlopecomputeAnalysisEnum()){
    5757
    58                 CreateElementsNodesAndMaterialsSlopeCompute(pelements,pnodes,pmaterials, iomodel,iomodel_handle);
     58                CreateElementsNodesAndMaterialsSlopeCompute(pelements,pnodes, pvertices,pmaterials, iomodel,iomodel_handle);
    5959                CreateConstraintsSlopeCompute(pconstraints,iomodel,iomodel_handle);
    6060                CreateLoadsSlopeCompute(ploads,iomodel,iomodel_handle);
     
    6363        else if (iomodel->analysis_type==ThermalAnalysisEnum()){
    6464
    65                 CreateElementsNodesAndMaterialsThermal(pelements,pnodes,pmaterials, iomodel,iomodel_handle);
     65                CreateElementsNodesAndMaterialsThermal(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    6666                CreateConstraintsThermal(pconstraints,iomodel,iomodel_handle);
    6767                CreateLoadsThermal(ploads,iomodel,iomodel_handle);
     
    7171        else if (iomodel->analysis_type==MeltingAnalysisEnum()){
    7272                       
    73                 CreateElementsNodesAndMaterialsMelting(pelements,pnodes,pmaterials, iomodel,iomodel_handle);
     73                CreateElementsNodesAndMaterialsMelting(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    7474                CreateConstraintsMelting(pconstraints,iomodel,iomodel_handle);
    7575                CreateLoadsMelting(ploads,iomodel,iomodel_handle);
     
    7878        else if (iomodel->analysis_type==PrognosticAnalysisEnum()){
    7979
    80                 CreateElementsNodesAndMaterialsPrognostic(pelements,pnodes,pmaterials, iomodel,iomodel_handle);
     80                CreateElementsNodesAndMaterialsPrognostic(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    8181                CreateConstraintsPrognostic(pconstraints,iomodel,iomodel_handle);
    8282                CreateLoadsPrognostic(ploads,iomodel,iomodel_handle);
     
    8686        else if (iomodel->analysis_type==Prognostic2AnalysisEnum()){
    8787
    88                 CreateElementsNodesAndMaterialsPrognostic2(pelements,pnodes,pmaterials, iomodel,iomodel_handle);
     88                CreateElementsNodesAndMaterialsPrognostic2(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    8989                CreateConstraintsPrognostic2(pconstraints,iomodel,iomodel_handle);
    9090                CreateLoadsPrognostic2(ploads,iomodel,iomodel_handle);
     
    9494        else if (iomodel->analysis_type==BalancedthicknessAnalysisEnum()){
    9595
    96                 CreateElementsNodesAndMaterialsBalancedthickness(pelements,pnodes,pmaterials, iomodel,iomodel_handle);
     96                CreateElementsNodesAndMaterialsBalancedthickness(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    9797                CreateConstraintsBalancedthickness(pconstraints,iomodel,iomodel_handle);
    9898                CreateLoadsBalancedthickness(ploads,iomodel,iomodel_handle);
     
    102102        else if (iomodel->analysis_type==BalancedvelocitiesAnalysisEnum()){
    103103
    104                 CreateElementsNodesAndMaterialsBalancedvelocities(pelements,pnodes,pmaterials, iomodel,iomodel_handle);
     104                CreateElementsNodesAndMaterialsBalancedvelocities(pelements,pnodes,pvertices,pmaterials, iomodel,iomodel_handle);
    105105                CreateConstraintsBalancedvelocities(pconstraints,iomodel,iomodel_handle);
    106106                CreateLoadsBalancedvelocities(ploads,iomodel,iomodel_handle);
  • issm/trunk/src/c/ModelProcessorx/CreateParameters.cpp

    r3359 r3417  
    238238        parameters->AddObject(param);
    239239
    240         /*numberofgrids: */
     240        /*numberofvertices: */
     241        count++;
     242        param= new Param(count,"numberofvertices",DOUBLE);
     243        param->SetDouble(iomodel->numberofvertices);
     244        parameters->AddObject(param);
     245
     246        /*numberofnodes: */
    241247        count++;
    242248        param= new Param(count,"numberofnodes",DOUBLE);
    243249        if (iomodel->analysis_type==Prognostic2AnalysisEnum()) param->SetDouble(3*iomodel->numberofelements);
    244         else param->SetDouble(iomodel->numberofnodes);
     250        else param->SetDouble(iomodel->numberofvertices);
    245251        parameters->AddObject(param);
    246252
  • issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateElementsNodesAndMaterialsDiagnosticHoriz.cpp

    r3383 r3417  
    1313
    1414
    15 void    CreateElementsNodesAndMaterialsDiagnosticHoriz(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
    16 
    17 
    18         /*output: int* epart, int* my_grids, double* my_bordergrids*/
     15void    CreateElementsNodesAndMaterialsDiagnosticHoriz(DataSet** pelements,DataSet** pnodes, DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1916
    2017
    2118        int i,j,k,n;
    22         extern int my_rank;
    23         extern int num_procs;
    2419
    2520        /*DataSets: */
    2621        DataSet*    elements  = NULL;
    2722        DataSet*    nodes = NULL;
     23        DataSet*    vertices = NULL;
    2824        DataSet*    materials = NULL;
    2925       
    3026        /*Objects: */
    3127        Node*       node   = NULL;
     28        Vertex*     vertex = NULL;
    3229        Tria*       tria = NULL;
    3330        Penta*      penta = NULL;
    3431        Matice*     matice  = NULL;
    3532        Matpar*     matpar  = NULL;
    36         ElementProperties* tria_properties=NULL;
    37         ElementProperties* penta_properties=NULL;
    38 
    39         /*output: */
    40         int* epart=NULL; //element partitioning.
    41         int* npart=NULL; //node partitioning.
    42         int* my_grids=NULL;
    43         double* my_bordergrids=NULL;
    44 
    45 
    46         /*intermediary: */
    47         int elements_width; //size of elements
    48         double B_avg;
    49                        
    50         /*tria constructor input: */
    51         int tria_id;
    52         int tria_matice_id;
    53         int tria_matpar_id;
    54         int tria_numpar_id;
    55         int tria_node_ids[3];
    56         double tria_h[3];
    57         double tria_s[3];
    58         double tria_b[3];
    59         double tria_k[3];
    60         double tria_melting[3];
    61         double tria_accumulation[3];
    62         int    tria_friction_type;
    63         double tria_p;
    64         double tria_q;
    65         int    tria_shelf;
    66         bool   tria_onwater;
    67        
    68         /*matice constructor input: */
    69         int    matice_mid;
    70         double matice_B;
    71         double matice_n;
    72        
    73         /*penta constructor input: */
    74         int penta_id;
    75         int penta_matice_id;
    76         int penta_matpar_id;
    77         int penta_numpar_id;
    78         int penta_node_ids[6];
    79         double penta_h[6];
    80         double penta_s[6];
    81         double penta_b[6];
    82         double penta_k[6];
    83         int penta_friction_type;
    84         double penta_p;
    85         double penta_q;
    86         int penta_shelf;
    87         int penta_onbed;
    88         int penta_onsurface;
    89         int penta_collapse;
    90         double penta_melting[6];
    91         double penta_accumulation[6];
    92         bool   penta_onwater;
    93 
    94         /*matpar constructor input: */
    95         int     matpar_mid;
    96         double matpar_rho_ice;
    97         double matpar_rho_water;
    98         double matpar_heatcapacity;
    99         double matpar_thermalconductivity;
    100         double matpar_latentheat;
    101         double matpar_beta;
    102         double matpar_meltingpoint;
    103         double matpar_mixed_layer_capacity;
    104         double matpar_thermal_exchange_velocity;
    105         double matpar_g;
    106 
    107         /* node constructor input: */
    108         int node_id;
    109         int node_partitionborder=0;
    110         double node_x[3];
    111         double node_sigma;
    112         int node_onbed;
    113         int node_onsurface;
    114         int node_onsheet;
    115         int node_onshelf;
    116         int node_upper_node_id;
    117         int node_numdofs;
    118 
    119                
    120         #ifdef _PARALLEL_
    121         /*Metis partitioning: */
    122         int  range;
    123         Vec  gridborder=NULL;
    124         int  my_numgrids;
    125         int* all_numgrids=NULL;
    126         int  gridcount;
    127         int  count;
    128         #endif
    129         int  first_grid_index;
    130 
    131         /*Rifts:*/
    132         int el1,el2;
    133          
     33
     34        /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */
     35        if (!iomodel->ismacayealpattyn)goto cleanup_and_return;
     36
    13437        /*First create the elements, nodes and material properties: */
    13538        elements  = new DataSet(ElementsEnum());
    13639        nodes     = new DataSet(NodesEnum());
     40        vertices  = new DataSet(VerticesEnum());
    13741        materials = new DataSet(MaterialsEnum());
    13842
    139 
    140         /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */
    141         if (!iomodel->ismacayealpattyn)goto cleanup_and_return;
    142 
    143         /*Width of elements: */
    144         if(strcmp(iomodel->meshtype,"2d")==0){
    145                 elements_width=3; //tria elements
    146         }
    147         else{
    148                 elements_width=6; //penta elements
    149         }
    150 
    151 
    152 
    153         #ifdef _PARALLEL_
    154         /*Determine parallel partitioning of elements: we use Metis for now. First load the data, then partition*/
    155         if(strcmp(iomodel->meshtype,"2d")==0){
    156                 /*load elements: */
    157                 IoModelFetchData(&iomodel->elements,NULL,NULL,iomodel_handle,"elements");
    158         }
    159         else{
    160                 /*load elements2d: */
    161                 IoModelFetchData(&iomodel->elements2d,NULL,NULL,iomodel_handle,"elements2d");
    162         }
    163 
    164         MeshPartitionx(&epart, &npart,iomodel->numberofelements,iomodel->numberofnodes,iomodel->elements, iomodel->numberofelements2d,iomodel->numberofnodes2d,iomodel->elements2d,iomodel->numlayers,elements_width, iomodel->meshtype,num_procs);
    165 
    166         /*Free elements and elements2d: */
    167         xfree((void**)&iomodel->elements);
    168         xfree((void**)&iomodel->elements2d);
    169 
    170 
    171         /*Deal with rifts, they have to be included into one partition only, not several: */
    172         IoModelFetchData(&iomodel->riftinfo,&iomodel->numrifts,NULL,iomodel_handle,"riftinfo");
    173 
    174         for(i=0;i<iomodel->numrifts;i++){
    175                 el1=(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+2)-1; //matlab indexing to c indexing
    176                 el2=(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+3)-1; //matlab indexing to c indexing
    177                 epart[el2]=epart[el1]; //ensures that this pair of elements will be in the same partition, as well as the corresponding grids;
    178         }
    179         /*Free rifts: */
    180         xfree((void**)&iomodel->riftinfo);
    181 
    182         /*Used later on: */
    183         my_grids=(int*)xcalloc(iomodel->numberofnodes,sizeof(int));
    184         #endif
    185 
    186 
    187 
    188         /*elements created vary if we are dealing with a 2d mesh, or a 3d mesh: */
     43        /*Partition elements and vertices and nodes: */
     44        Partitioning(&iomodel->my_elements, &iomodel->my_vertices, &iomodel->my_nodes, &iomodel->my_bordervertices, iomodel, iomodel_handle);
    18945
    19046        /*2d mesh: */
     
    20965                for (i=0;i<iomodel->numberofelements;i++){
    21066
    211                 #ifdef _PARALLEL_
    212                 /*!All elements have been partitioned above, only create elements for this CPU: */
    213                 if(my_rank==epart[i]){
    214                 #endif
    215                        
    216                         if (*(iomodel->elements_type+2*i+0)==MacAyealFormulationEnum()){ //elements of type 1 are Hutter type Tria. Don't create this elements.
     67                        if(iomodel->my_elements[i]){
    21768                               
    218                                 /*ids: */
    219                                 tria_id=i+1; //matlab indexing.
    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);
    228 
    229                                 /*thickness,surface and bed:*/
    230                                 tria_h[0]= *(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+0)-1)); //remember, elements is an index of vertices offsets, in matlab indexing.
    231                                 tria_h[1]=*(iomodel->thickness+  ((int)*(iomodel->elements+elements_width*i+1)-1));
    232                                 tria_h[2]=*(iomodel->thickness+  ((int)*(iomodel->elements+elements_width*i+2)-1)) ;
    233 
    234                                 tria_s[0]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+0)-1));
    235                                 tria_s[1]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+1)-1));
    236                                 tria_s[2]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+2)-1));
    237 
    238                                 tria_b[0]=*(iomodel->bed+        ((int)*(iomodel->elements+elements_width*i+0)-1));
    239                                 tria_b[1]=*(iomodel->bed+        ((int)*(iomodel->elements+elements_width*i+1)-1));
    240                                 tria_b[2]=*(iomodel->bed+        ((int)*(iomodel->elements+elements_width*i+2)-1));
    241 
    242                                 /*basal drag:*/
    243                                 tria_friction_type=(int)iomodel->drag_type;
    244 
    245                                 tria_k[0]=*(iomodel->drag+        ((int)*(iomodel->elements+elements_width*i+0)-1));
    246                                 tria_k[1]=*(iomodel->drag+        ((int)*(iomodel->elements+elements_width*i+1)-1));
    247                                 tria_k[2]=*(iomodel->drag+        ((int)*(iomodel->elements+elements_width*i+2)-1));
    248                                
    249                                 tria_p=iomodel->p[i];
    250                                 tria_q=iomodel->q[i];
    251 
    252                                 /*meling and accumulation*/
    253                                 tria_melting[0]=*(iomodel->melting+        ((int)*(iomodel->elements+elements_width*i+0)-1));
    254                                 tria_melting[1]=*(iomodel->melting+        ((int)*(iomodel->elements+elements_width*i+1)-1));
    255                                 tria_melting[2]=*(iomodel->melting+        ((int)*(iomodel->elements+elements_width*i+2)-1));
    256 
    257                                 tria_accumulation[0]=*(iomodel->accumulation+        ((int)*(iomodel->elements+elements_width*i+0)-1));
    258                                 tria_accumulation[1]=*(iomodel->accumulation+        ((int)*(iomodel->elements+elements_width*i+1)-1));
    259                                 tria_accumulation[2]=*(iomodel->accumulation+        ((int)*(iomodel->elements+elements_width*i+2)-1));
    260 
    261                                 /*element on iceshelf, water?:*/
    262                                 tria_shelf=(int)*(iomodel->elementoniceshelf+i);
    263                                 tria_onwater=(bool)*(iomodel->elementonwater+i);
    264 
    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 
    269                                 /*Create tria element using its constructor:*/
    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;
    274 
    275                                 /*Add tria element to elements dataset: */
    276                                 elements->AddObject(tria);
    277 
    278                                 /*Deal with material property card: */
    279                                 matice_mid=i+1; //same as the material id from the geom2 elements.
    280                                
    281                                 /*Average B over 3 grid elements: */
    282                                 B_avg=0;
    283                                 for(j=0;j<3;j++){
    284                                         B_avg+=*(iomodel->B+((int)*(iomodel->elements+elements_width*i+j)-1));
     69                                if (*(iomodel->elements_type+2*i+0)==MacAyealFormulationEnum()){ //elements of type 1 are Hutter type Tria. Don't create this elements.
     70
     71                                        /*Create and add tria element to elements dataset: */
     72                                        elements->AddObject(new Tria(i,iomodel));
     73                                       
     74                                        /*Create and add material property to materials dataset: */
     75                                        materials->AddObject(new Matice(i,iomodel,3));
    28576                                }
    286                                 B_avg=B_avg/3;
    287                                 matice_B=B_avg;
    288                                 matice_n=(double)*(iomodel->n+i);
    289                                
    290                                 /*Create matice using its constructor:*/
    291                                 matice= new Matice(matice_mid,matice_B,matice_n);
    292                
    293                                 /*Add matice element to materials dataset: */
    294                                 materials->AddObject(matice);
    295                
    296                         } //if(!MacAyealFormulationEnum)
    297 
    298                         #ifdef _PARALLEL_
    299                         /*Now that we are here, we can also start building the list of grids belonging to this node partition: we use
    300                          *the  element index to do this. For each element n, we know index[n][0:2] holds the indices (matlab indexing)
    301                          into the grid coordinates. If we start plugging 1 into my_grids for each index[n][i] (i=0:2), then my_grids
    302                          will hold which grids belong to this partition*/
    303                         my_grids[(int)*(iomodel->elements+elements_width*i+0)-1]=1;
    304                         my_grids[(int)*(iomodel->elements+elements_width*i+1)-1]=1;
    305                         my_grids[(int)*(iomodel->elements+elements_width*i+2)-1]=1;
    306                         #endif
    307 
    308                 #ifdef _PARALLEL_
    309                 }//if(my_rank==epart[i])
    310                 #endif
    311 
     77                        }
    31278                }//for (i=0;i<numberofelements;i++)
    313 
    31479       
    31580                /*Free data : */
     
    349114               
    350115                for (i=0;i<iomodel->numberofelements;i++){
    351                 #ifdef _PARALLEL_
    352                 /*We are using our element partition to decide which elements will be created on this node: */
    353                 if(my_rank==epart[i]){
    354                 #endif
    355 
    356                         if (*(iomodel->elements_type+2*i+0)==MacAyealFormulationEnum() | *(iomodel->elements_type+2*i+0)==PattynFormulationEnum()){ //elements of type 1 are Hutter type Tria. Don't create this elements.
    357                        
    358                                 /*name and id: */
    359                                 penta_id=i+1; //matlab indexing.
    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;
    363 
    364                                 /*vertices,thickness,surface,bed and drag: */
    365                                 for(j=0;j<6;j++){
    366                                         penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j);
    367                                         penta_h[j]=*(iomodel->thickness+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    368                                         penta_s[j]=*(iomodel->surface+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    369                                         penta_b[j]=*(iomodel->bed+    ((int)*(iomodel->elements+elements_width*i+j)-1));
    370                                         penta_k[j]=*(iomodel->drag+        ((int)*(iomodel->elements+elements_width*i+j)-1));
    371                                         penta_melting[j]=*(iomodel->melting+        ((int)*(iomodel->elements+elements_width*i+j)-1));
    372                                         penta_accumulation[j]=*(iomodel->accumulation+        ((int)*(iomodel->elements+elements_width*i+j)-1));
     116                        if(my_elements[i]){
     117                                if (*(iomodel->elements_type+2*i+0)==MacAyealFormulationEnum() | *(iomodel->elements_type+2*i+0)==PattynFormulationEnum()){ //elements of type 1 are Hutter type Tria. Don't create this elements.
     118                                        /*Create and add penta element to elements dataset: */
     119                                        elements->AddObject(new Penta(i,iomodel));
     120                                       
     121                                        /*Create and add material property to materials dataset: */
     122                                        materials->AddObject(new Matice(i,iomodel,6));
     123                                       
    373124                                }
    374 
    375                                 /*basal drag:*/
    376                                 penta_friction_type=(int)iomodel->drag_type;
    377                
    378                                 penta_p=iomodel->p[i];
    379                                 penta_q=iomodel->q[i];
    380 
    381                                 /*diverse: */
    382                                 penta_shelf=(int)*(iomodel->elementoniceshelf+i);
    383                                 penta_onbed=(int)*(iomodel->elementonbed+i);
    384                                 penta_onsurface=(int)*(iomodel->elementonsurface+i);
    385                                 penta_onwater=(bool)*(iomodel->elementonwater+i);
    386                                
    387                                 if (*(iomodel->elements_type+2*i+0)==MacAyealFormulationEnum()){ //elements of type 3 are MacAyeal type Penta. We collapse the formulation on their base.
    388                                         penta_collapse=1;
    389                                 }
    390                                 else{
    391                                         penta_collapse=0;
    392                                 }
    393 
    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);
    396 
    397                                 /*Create Penta using its constructor:*/
    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;
    402 
    403                                 /*Add penta element to elements dataset: */
    404                                 elements->AddObject(penta);
    405                
    406 
    407                                 /*Deal with material:*/
    408                                 matice_mid=i+1; //same as the material id from the geom2 elements.
    409                                 /*Average B over 6 element grids: */
    410                                 B_avg=0;
    411                                 for(j=0;j<6;j++){
    412                                         B_avg+=*(iomodel->B+((int)*(iomodel->elements+elements_width*i+j)-1));
    413                                 }
    414                                 B_avg=B_avg/6;
    415                                 matice_B= B_avg;
    416                                 matice_n=(double)*(iomodel->n+i);
    417                
    418                                 /*Create matice using its constructor:*/
    419                                 matice= new Matice(matice_mid,matice_B,matice_n);
    420                
    421                                 /*Add matice element to materials dataset: */
    422                                 materials->AddObject(matice);
    423                                
    424                         }
    425 
    426                         #ifdef _PARALLEL_
    427                         /*Now that we are here, we can also start building the list of grids belonging to this node partition: we use
    428                          *the  element index to do this. For each element n, we know index[n][0:2] holds the indices (matlab indexing)
    429                          into the grid coordinates. If we start plugging 1 into my_grids for each index[n][i] (i=0:2), then my_grids
    430                          will hold which grids belong to this partition*/
    431                         my_grids[(int)*(iomodel->elements+elements_width*i+0)-1]=1;
    432                         my_grids[(int)*(iomodel->elements+elements_width*i+1)-1]=1;
    433                         my_grids[(int)*(iomodel->elements+elements_width*i+2)-1]=1;
    434                         my_grids[(int)*(iomodel->elements+elements_width*i+3)-1]=1;
    435                         my_grids[(int)*(iomodel->elements+elements_width*i+4)-1]=1;
    436                         my_grids[(int)*(iomodel->elements+elements_width*i+5)-1]=1;
    437                         #endif
    438 
    439                 #ifdef _PARALLEL_
    440                 }//if(my_rank==epart[i])
    441                 #endif
     125                        }//if(my_elements[i])
    442126
    443127                }//for (i=0;i<numberofelements;i++)
     
    463147        } //if (strcmp(meshtype,"2d")==0)
    464148
    465         /*Add one constant material property to materials: */
    466         matpar_mid=iomodel->numberofelements+1; //put it at the end of the materials
    467         matpar_g=iomodel->g;
    468         matpar_rho_ice=iomodel->rho_ice;
    469         matpar_rho_water=iomodel->rho_water;
    470         matpar_thermalconductivity=iomodel->thermalconductivity;
    471         matpar_heatcapacity=iomodel->heatcapacity;
    472         matpar_latentheat=iomodel->latentheat;
    473         matpar_beta=iomodel->beta;
    474         matpar_meltingpoint=iomodel->meltingpoint;
    475         matpar_mixed_layer_capacity=iomodel->mixed_layer_capacity;
    476         matpar_thermal_exchange_velocity=iomodel->thermal_exchange_velocity;
    477 
    478         /*Create matpar object using its constructor: */
    479         matpar=new Matpar(matpar_mid,matpar_rho_ice,matpar_rho_water,matpar_heatcapacity,matpar_thermalconductivity,
    480                         matpar_latentheat,matpar_beta,matpar_meltingpoint,matpar_mixed_layer_capacity,
    481                         matpar_thermal_exchange_velocity,matpar_g);
    482                
    483         /*Add to materials datset: */
    484         materials->AddObject(matpar);
    485        
    486         #ifdef _PARALLEL_
    487                 /*From the element partitioning, we can determine which grids are on the inside of this cpu's
    488                  *element partition, and which are on its border with other nodes:*/
    489                 gridborder=NewVec(iomodel->numberofnodes);
    490 
    491                 for (i=0;i<iomodel->numberofnodes;i++){
    492                         if(my_grids[i])VecSetValue(gridborder,i,1,ADD_VALUES);
    493                 }
    494                 VecAssemblyBegin(gridborder);
    495                 VecAssemblyEnd(gridborder);
    496 
    497                 #ifdef _ISSM_DEBUG_
    498                 VecView(gridborder,PETSC_VIEWER_STDOUT_WORLD);
    499                 #endif
    500                
    501                 VecToMPISerial(&my_bordergrids,gridborder);
    502 
    503                 #ifdef _ISSM_DEBUG_
    504                 if(my_rank==0){
    505                         for (i=0;i<iomodel->numberofnodes;i++){
    506                                 printf("Grid id %i Border grid %lf\n",i+1,my_bordergrids[i]);
    507                         }
    508                 }
    509                 #endif
    510         #endif
    511 
    512         /*Partition penalties in 3d: */
    513         if(strcmp(iomodel->meshtype,"3d")==0){
    514        
    515                 /*Get penalties: */
    516                 IoModelFetchData(&iomodel->penalties,&iomodel->numpenalties,NULL,iomodel_handle,"penalties");
    517 
    518                 if(iomodel->numpenalties){
    519 
    520                         iomodel->penaltypartitioning=(int*)xmalloc(iomodel->numpenalties*sizeof(int));
    521                         #ifdef _SERIAL_
    522                         for(i=0;i<iomodel->numpenalties;i++)iomodel->penaltypartitioning[i]=1;
    523                         #else
    524                         for(i=0;i<iomodel->numpenalties;i++)iomodel->penaltypartitioning[i]=-1;
    525 
    526                         for(i=0;i<iomodel->numpenalties;i++){
    527                                 first_grid_index=(int)(*(iomodel->penalties+i*iomodel->numlayers+0)-1);
    528                                 if((my_grids[first_grid_index]==1) && (my_bordergrids[first_grid_index]<=1.0) ) { //this grid belongs to this node's internal partition  grids
    529                                         /*All grids that are being penalised belong to this node's internal grid partition.:*/
    530                                         iomodel->penaltypartitioning[i]=1;
    531                                 }
    532                                 if(my_bordergrids[first_grid_index]>1.0) { //this grid belongs to a partition border
    533                                         iomodel->penaltypartitioning[i]=0;
    534                                 }
    535                         }
    536                         #endif
    537                 }
    538 
    539                 /*Free penalties: */
    540                 xfree((void**)&iomodel->penalties);
    541         }
    542 
    543         /*Ok, let's summarise. Now, every CPU has the following two arrays: my_grids, and my_bordergrids.
    544          We can therefore determine  which grids are internal to this node's partition
    545          and which ones are shared with other nodes because they are on the border of this node's partition. Knowing
    546          that, go and create the grids*/
    547 
    548         /*Create nodes from x,y,z, as well as the spc values on those grids: */
    549                
    550         /*First fetch data: */
    551         if (strcmp(iomodel->meshtype,"3d")==0){
    552                 IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids");
    553                 IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids");
    554         }
     149       
     150        /*Add new constrant material property tgo materials, at the end: */
     151        materials->AddObject(new Matpar(iomodel));
     152       
     153        /*Create nodes and vertices: */
    555154        IoModelFetchData(&iomodel->x,NULL,NULL,iomodel_handle,"x");
    556155        IoModelFetchData(&iomodel->y,NULL,NULL,iomodel_handle,"y");
     
    563162        IoModelFetchData(&iomodel->gridonicesheet,NULL,NULL,iomodel_handle,"gridonicesheet");
    564163        IoModelFetchData(&iomodel->gridoniceshelf,NULL,NULL,iomodel_handle,"gridoniceshelf");
    565 
    566         /*Get number of dofs per node: */
    567         DistributeNumDofs(&node_numdofs,iomodel->analysis_type,iomodel->sub_analysis_type);
    568 
    569         for (i=0;i<iomodel->numberofnodes;i++){
    570         #ifdef _PARALLEL_
    571 
    572         /*keep only this partition's nodes:*/
    573         if((my_grids[i]==1)){
    574         #endif
    575 
    576                 node_id=i+1; //matlab indexing
     164        if (strcmp(iomodel->meshtype,"3d")==0){
     165                IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids");
     166                IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids");
     167        }
     168
     169       
     170        for (i=0;i<iomodel->numberovertices;i++){
     171
     172                /*vertices and nodes (same number, as we are running continuous galerkin formulation: */
     173                if(iomodel->my_vertices[i]){
    577174                       
    578                
    579                 #ifdef _PARALLEL_
    580                 if(my_bordergrids[i]>1.0) { //this grid belongs to a partition border
    581                         node_partitionborder=1;
     175                        /*Add vertex to vertices dataset: */
     176                        vertices->AddObject(new Vertex(i,iomodel));
     177
     178                        /*Add node to nodes dataset: */
     179                        nodes->AddObject(new Node(i,iomodel));
     180
    582181                }
    583                 else{
    584                         node_partitionborder=0;
    585                 }
    586                 #else
    587                         node_partitionborder=0;
    588                 #endif
    589 
    590                 node_x[0]=iomodel->x[i];
    591                 node_x[1]=iomodel->y[i];
    592                 node_x[2]=iomodel->z[i];
    593                 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]);
    594                
    595                 node_onbed=(int)iomodel->gridonbed[i];
    596                 node_onsurface=(int)iomodel->gridonsurface[i]; 
    597                 node_onshelf=(int)iomodel->gridoniceshelf[i];   
    598                 node_onsheet=(int)iomodel->gridonicesheet[i];   
    599 
    600                 if (strcmp(iomodel->meshtype,"3d")==0){
    601                         if (isnan(iomodel->uppernodes[i])){
    602                                 node_upper_node_id=node_id;  //nodes on surface do not have upper nodes, only themselves.
    603                         }
    604                         else{
    605                                 node_upper_node_id=(int)iomodel->uppernodes[i];
    606                         }
    607                 }
    608                 else{
    609                         /*If we are running 2d, upper_node does not mean much. Just point towards itself!:*/
    610                         node_upper_node_id=node_id;
    611                 }
    612 
    613                 /*Create node using its constructor: */
    614                 node=new Node(node_id,node_partitionborder,node_numdofs,node_x,node_sigma,node_onbed,node_onsurface,node_upper_node_id,node_onshelf,node_onsheet);
    615 
    616                 /*set single point constraints.: */
    617                 if (strcmp(iomodel->meshtype,"3d")==0){
    618                         /*On a 3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */
    619                         if (iomodel->deadgrids[i]){
    620                                 for(k=1;k<=node_numdofs;k++){
    621                                         node->FreezeDof(k);
    622                                 }
    623                         }
    624                 }
    625                 if (iomodel->gridonhutter[i]){
    626                         for(k=1;k<=node_numdofs;k++){
    627                                 node->FreezeDof(k);
    628                         }
    629                 }
    630                 /*Add node to nodes dataset: */
    631                 nodes->AddObject(node);
    632 
    633         #ifdef _PARALLEL_
    634         } //if((my_grids[i]==1))
    635         #endif
    636182        }
    637 
    638         /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these
    639          * datasets, it will not be redone: */
    640         elements->Presort();
    641         nodes->Presort();
    642         materials->Presort();
    643183
    644184        /*Clean fetched data: */
     
    655195        xfree((void**)&iomodel->gridonicesheet);
    656196        xfree((void**)&iomodel->gridoniceshelf);
    657        
    658 
    659         /*Keep partitioning information into iomodel*/
    660         iomodel->epart=epart;
    661         iomodel->my_grids=my_grids;
    662         iomodel->my_bordergrids=my_bordergrids;
    663 
    664         /*Free ressources:*/
    665         #ifdef _PARALLEL_
    666         xfree((void**)&all_numgrids);
    667         xfree((void**)&npart);
    668         VecFree(&gridborder);
    669         #endif
    670 
    671         cleanup_and_return:
    672 
     197
     198        /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these
     199         * datasets, it will not be redone: */
     200        elements->Presort();
     201        nodes->Presort();
     202        vertices->Presort();
     203        materials->Presort();
     204       
    673205        /*Assign output pointer: */
    674206        *pelements=elements;
    675207        *pnodes=nodes;
     208        *pvertices=vertices;
    676209        *pmaterials=materials;
    677210
  • issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateElementsNodesAndMaterialsDiagnosticStokes.cpp

    r3383 r3417  
    1313#include "../IoModel.h"
    1414
    15 void    CreateElementsNodesAndMaterialsDiagnosticStokes(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
     15void    CreateElementsNodesAndMaterialsDiagnosticStokes(DataSet** pelements,DataSet** pnodes, DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1616
    1717       
     
    2626        DataSet*    elements  = NULL;
    2727        DataSet*    nodes = NULL;
     28        DataSet*    vertices = NULL;
    2829        DataSet*    materials = NULL;
    2930       
    3031        /*Objects: */
    3132        Node*       node   = NULL;
     33        Vertex*     vertex = NULL;
    3234        Penta*      penta = NULL;
    3335        Matice*     matice  = NULL;
     
    8890        /* node constructor input: */
    8991        int node_id;
     92        int vertex_id;
    9093        int node_partitionborder=0;
    91         double node_x[3];
    92         double node_sigma;
    9394        int node_onbed;
    9495        int node_onsurface;
     
    113114        elements  = new DataSet(ElementsEnum());
    114115        nodes     = new DataSet(NodesEnum());
     116        vertices  = new DataSet(VerticesEnum());
    115117        materials = new DataSet(MaterialsEnum());
    116118
     
    400402        #endif
    401403
     404                /*create vertex: */
     405                vertex_id=i+1;
     406                vertex=new Vertex(vertex_id, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]));
     407
     408                vertices->AddObject(vertex);
     409
    402410                node_id=i+1; //matlab indexing
    403                        
    404                
    405411               
    406412                #ifdef _PARALLEL_
     
    415421                #endif
    416422
    417                 node_x[0]=iomodel->x[i];
    418                 node_x[1]=iomodel->y[i];
    419                 node_x[2]=iomodel->z[i];
    420                 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]);
    421                
    422                 node_onbed=(int)iomodel->gridonbed[i];
    423                 node_onsurface=(int)iomodel->gridonsurface[i]; 
    424                 node_onshelf=(int)iomodel->gridoniceshelf[i];   
    425                 node_onsheet=(int)iomodel->gridonicesheet[i];   
    426 
     423                node_properties.SetProperties(
     424                        (int)iomodel->gridonbed[i],
     425                        (int)iomodel->gridonsurface[i],
     426                        (int)iomodel->gridoniceshelf[i],
     427                        (int)iomodel->gridonicesheet[i]);
     428
     429       
    427430                if (strcmp(iomodel->meshtype,"3d")==0){
    428431                        if (isnan(iomodel->uppernodes[i])){
     
    439442
    440443                /*Create node using its constructor: */
    441                 node=new Node(node_id,node_partitionborder,node_numdofs,node_x,node_sigma,node_onbed,node_onsurface,node_upper_node_id,node_onshelf,node_onsheet);
     444                node=new Node(node_id,vertex_id, node_upper_node_id, node_partitionborder,node_numdofs, &node_properties);   
    442445
    443446                /*set single point constraints.: */
     
    468471        elements->Presort();
    469472        nodes->Presort();
     473        vertices->Presort();
    470474        materials->Presort();
    471475
     
    503507        *pelements=elements;
    504508        *pnodes=nodes;
     509        *pvertices=vertices;
    505510        *pmaterials=materials;
    506511
  • issm/trunk/src/c/ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp

    r3383 r3417  
    1414
    1515
    16 void    CreateElementsNodesAndMaterialsDiagnosticVert(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
     16void    CreateElementsNodesAndMaterialsDiagnosticVert(DataSet** pelements,DataSet** pnodes, DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1717
    1818
     
    2727        DataSet*    elements  = NULL;
    2828        DataSet*    nodes = NULL;
     29        DataSet*    vertices = NULL;
    2930        DataSet*    materials = NULL;
    3031       
    3132        /*Objects: */
    3233        Node*       node   = NULL;
     34        Vertex*     vertex = NULL;
    3335        Penta*      penta = NULL;
    3436        Matice*     matice  = NULL;
     
    8890        /* node constructor input: */
    8991        int node_id;
     92        int vertex_id;
    9093        int node_partitionborder=0;
    91         double node_x[3];
    92         double node_sigma;
    9394        int node_onbed;
    9495        int node_onsurface;
     
    123124        elements  = new DataSet(ElementsEnum());
    124125        nodes     = new DataSet(NodesEnum());
     126        vertices  = new DataSet(VerticesEnum());
    125127        materials = new DataSet(MaterialsEnum());
    126128
     
    329331        #endif
    330332
     333                /*create vertex: */
     334                vertex_id=i+1;
     335                vertex=new Vertex(vertex_id, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]));
     336
     337                vertices->AddObject(vertex);
     338
     339
    331340                node_id=i+1; //matlab indexing
    332                        
    333                
    334341               
    335342                #ifdef _PARALLEL_
     
    344351                #endif
    345352
    346                 node_x[0]=iomodel->x[i];
    347                 node_x[1]=iomodel->y[i];
    348                 node_x[2]=iomodel->z[i];
    349                 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]);
    350                
    351                 node_onbed=(int)iomodel->gridonbed[i];
    352                 node_onsurface=(int)iomodel->gridonsurface[i];
    353                 node_onshelf=(int)iomodel->gridoniceshelf[i];   
    354                 node_onsheet=(int)iomodel->gridonicesheet[i];   
    355        
     353                node_properties.SetProperties(
     354                        (int)iomodel->gridonbed[i],
     355                        (int)iomodel->gridonsurface[i],
     356                        (int)iomodel->gridoniceshelf[i],
     357                        (int)iomodel->gridonicesheet[i]);
     358
    356359                if (isnan(iomodel->uppernodes[i])){
    357360                        node_upper_node_id=node_id;  //nodes on surface do not have upper nodes, only themselves.
     
    362365
    363366                /*Create node using its constructor: */
    364                 node=new Node(node_id,node_partitionborder,node_numdofs,node_x,node_sigma,node_onbed,node_onsurface,node_upper_node_id,node_onshelf,node_onsheet);
     367                node=new Node(node_id,vertex_id, node_upper_node_id, node_partitionborder,node_numdofs, &node_properties);   
    365368
    366369                /*Add node to nodes dataset: */
     
    376379        elements->Presort();
    377380        nodes->Presort();
     381        vertices->Presort();
    378382        materials->Presort();
    379383
     
    409413        *pelements=elements;
    410414        *pnodes=nodes;
     415        *pvertices=vertices;
    411416        *pmaterials=materials;
    412417
  • issm/trunk/src/c/ModelProcessorx/IoModel.cpp

    r3359 r3417  
    4646        iomodel->qmu_npart=0;
    4747        iomodel->numberofelements=0;
    48         iomodel->numberofnodes=0;
     48        iomodel->numberofvertices=0;
    4949        iomodel->x=NULL;
    5050        iomodel->y=NULL;
     
    5252        iomodel->elements=NULL;
    5353        iomodel->elements_type=NULL;
    54         iomodel->numberofnodes2d=0;
     54        iomodel->numberofvertices2d=0;
    5555        iomodel->elements2d=NULL;
    5656        iomodel->deadgrids=NULL;
     
    180180        iomodel->isstokes=0;
    181181
    182 
    183         iomodel->epart=NULL;
    184         iomodel->npart=NULL;
    185         iomodel->my_grids=NULL;
    186         iomodel->my_bordergrids=NULL;
     182        /*exterior data: */
     183        iomodel->my_elements=NULL;
     184        iomodel->my_vertices=NULL;
     185        iomodel->my_nodes=NULL;
     186        iomodel->my_bordervertices=NULL;
     187        iomodel->penaltypartitioning=NULL;
    187188
    188189        return iomodel;
     
    276277        xfree((void**)&iomodel->control_type);
    277278       
    278         xfree((void**)&iomodel->epart);
    279         xfree((void**)&iomodel->npart);
    280         xfree((void**)&iomodel->my_grids);
    281         xfree((void**)&iomodel->my_bordergrids);
    282        
     279        /*exterior data: */
     280        xfree((void**)&iomodel->my_elements);
     281        xfree((void**)&iomodel->my_vertices);
     282        xfree((void**)&iomodel->my_nodes);
     283        xfree((void**)&iomodel->my_bordervertices);
     284        xfree((void**)&iomodel->penaltypartitioning);
     285
    283286        /*!Delete entire structure: */
    284287        xfree((void**)piomodel);
     
    309312        IoModelFetchData(&iomodel->control_analysis,iomodel_handle,"control_analysis");
    310313        IoModelFetchData(&iomodel->meshtype,iomodel_handle,"type");
    311         /*!Get numberofelements and numberofnodes: */
    312         IoModelFetchData(&iomodel->numberofnodes,iomodel_handle,"numberofgrids");
     314        /*!Get numberofelements and numberofvertices: */
     315        IoModelFetchData(&iomodel->numberofvertices,iomodel_handle,"numberofgrids");
    313316        IoModelFetchData(&iomodel->numberofelements,iomodel_handle,"numberofelements");
    314317        /*!In case we are running 3d, we are going to need the collapsed and non-collapsed 2d meshes, from which the 3d mesh was extruded: */
     
    317320                /*!Deal with 2d mesh: */
    318321                IoModelFetchData(&iomodel->numberofelements2d,iomodel_handle,"numberofelements2d");
    319                 IoModelFetchData(&iomodel->numberofnodes2d,iomodel_handle,"numberofgrids2d");
     322                IoModelFetchData(&iomodel->numberofvertices2d,iomodel_handle,"numberofgrids2d");
    320323                IoModelFetchData(&iomodel->numlayers,iomodel_handle,"numlayers");
    321324        }
  • issm/trunk/src/c/ModelProcessorx/IoModel.h

    r3359 r3417  
    2828        /*2d mesh: */
    2929        int     numberofelements;
    30         int     numberofnodes;
     30        int     numberofvertices;
    3131        double* x;
    3232        double* y;
     
    3636
    3737        /*3d mesh: */
    38         int     numberofnodes2d;
     38        int     numberofvertices2d;
    3939        int     numberofelements2d;
    4040        double* elements2d;
     
    176176        int      numoutput;
    177177
    178         /*exterior data: */
    179         int* epart; /*!element partitioning.*/
    180         int* npart; /*!node partitioning.*/
    181         int* my_grids; /*! grids that belong to this cpu*/
    182         double* my_bordergrids; /*! grids that belong to this cpu, and some other cpu also*/
     178        /*exterior partitioning data, to be carried around: */
     179        bool*   my_elements;
     180        bool*   my_vertices;
     181        bool*   my_nodes;
     182        double* my_bordervertices;
    183183        int*    penaltypartitioning;
    184184
     
    197197
    198198        /*Creation of fem datasets: general drivers*/
    199         void  CreateDataSets(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,DataSet** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
     199        void  CreateDataSets(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,DataSet** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
    200200        void  CreateParameters(DataSet** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
    201201
     
    204204       
    205205        /*diagnostic horizontal*/
    206         void    CreateElementsNodesAndMaterialsDiagnosticHoriz(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     206        void    CreateElementsNodesAndMaterialsDiagnosticHoriz(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
    207207        void    CreateConstraintsDiagnosticHoriz(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    208208        void  CreateLoadsDiagnosticHoriz(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     
    210210
    211211        /*diagnostic vertical*/
    212         void    CreateElementsNodesAndMaterialsDiagnosticVert(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     212        void    CreateElementsNodesAndMaterialsDiagnosticVert(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
    213213        void    CreateConstraintsDiagnosticVert(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    214214        void  CreateLoadsDiagnosticVert(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
    215215
    216216        /*diagnostic hutter*/
    217         void    CreateElementsNodesAndMaterialsDiagnosticHutter(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     217        void    CreateElementsNodesAndMaterialsDiagnosticHutter(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
    218218        void    CreateConstraintsDiagnosticHutter(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    219219        void  CreateLoadsDiagnosticHutter(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
    220220
    221221        /*diagnostic stokes*/
    222         void    CreateElementsNodesAndMaterialsDiagnosticStokes(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     222        void    CreateElementsNodesAndMaterialsDiagnosticStokes(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
    223223        void    CreateConstraintsDiagnosticStokes(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    224224        void  CreateLoadsDiagnosticStokes(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
    225225
    226226        /*slope compute*/
    227         void    CreateElementsNodesAndMaterialsSlopeCompute(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     227        void    CreateElementsNodesAndMaterialsSlopeCompute(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
    228228        void    CreateConstraintsSlopeCompute(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    229229        void  CreateLoadsSlopeCompute(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     
    233233
    234234        /*thermal:*/
    235         void    CreateElementsNodesAndMaterialsThermal(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     235        void    CreateElementsNodesAndMaterialsThermal(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
    236236        void    CreateConstraintsThermal(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    237237        void  CreateLoadsThermal(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     
    239239
    240240        /*melting:*/
    241         void    CreateElementsNodesAndMaterialsMelting(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     241        void    CreateElementsNodesAndMaterialsMelting(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
    242242        void    CreateConstraintsMelting(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    243243        void  CreateLoadsMelting(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     
    245245
    246246        /*prognostic:*/
    247         void    CreateElementsNodesAndMaterialsPrognostic(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     247        void    CreateElementsNodesAndMaterialsPrognostic(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
    248248        void    CreateConstraintsPrognostic(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    249249        void  CreateLoadsPrognostic(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     
    251251
    252252        /*prognostic2:*/
    253         void    CreateElementsNodesAndMaterialsPrognostic2(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     253        void    CreateElementsNodesAndMaterialsPrognostic2(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
    254254        void    CreateConstraintsPrognostic2(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    255255        void  CreateLoadsPrognostic2(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     
    257257
    258258        /*balancedthickness:*/
    259         void    CreateElementsNodesAndMaterialsBalancedthickness(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     259        void    CreateElementsNodesAndMaterialsBalancedthickness(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
    260260        void    CreateConstraintsBalancedthickness(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    261261        void  CreateLoadsBalancedthickness(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     
    263263
    264264        /*balancedvelocities:*/
    265         void    CreateElementsNodesAndMaterialsBalancedvelocities(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
     265        void    CreateElementsNodesAndMaterialsBalancedvelocities(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);
    266266        void    CreateConstraintsBalancedvelocities(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle);
    267267        void  CreateLoadsBalancedvelocities(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);
     
    271271        void CreateParametersQmu(DataSet** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
    272272
     273       
     274        /*partitioning: */
     275        void  Partitioning(bool** pmy_elements, bool** pmy_vertices, bool** pmy_nodes, double** pmy_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle);
     276
    273277#endif  /* _IOMODEL_H */
  • issm/trunk/src/c/ModelProcessorx/Melting/CreateElementsNodesAndMaterialsMelting.cpp

    r3383 r3417  
    1313
    1414
    15 void    CreateElementsNodesAndMaterialsMelting(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
     15void    CreateElementsNodesAndMaterialsMelting(DataSet** pelements,DataSet** pnodes, DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1616
    1717
     
    2626        DataSet*    elements  = NULL;
    2727        DataSet*    nodes = NULL;
     28        DataSet*    vertices = NULL;
    2829        DataSet*    materials = NULL;
    2930       
    3031        /*Objects: */
    3132        Node*       node   = NULL;
     33        Vertex*     vertex = NULL;
    3234        Penta*      penta = NULL;
    3335        Matice*     matice  = NULL;
     
    8890        /* node constructor input: */
    8991        int node_id;
     92        int vertex_id;
    9093        int node_partitionborder=0;
    91         double node_x[3];
    92         double node_sigma;
    9394        int node_onbed;
    9495        int node_onsurface;
     
    113114        elements  = new DataSet(ElementsEnum());
    114115        nodes     = new DataSet(NodesEnum());
     116        vertices  = new DataSet(VerticesEnum());
    115117        materials = new DataSet(MaterialsEnum());
    116118
     
    371373        #endif
    372374
     375                /*create vertex: */
     376                vertex_id=i+1;
     377                vertex=new Vertex(vertex_id, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]));
     378                vertices->AddObject(vertex);
     379
     380
    373381                node_id=i+1; //matlab indexing
    374                        
    375                
    376382               
    377383                #ifdef _PARALLEL_
     
    386392                #endif
    387393
    388                 node_x[0]=iomodel->x[i];
    389                 node_x[1]=iomodel->y[i];
    390                 node_x[2]=iomodel->z[i];
    391                 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]);
    392                
    393                 node_onbed=(int)iomodel->gridonbed[i];
    394                 node_onsurface=(int)iomodel->gridonsurface[i]; 
    395                 node_onshelf=(int)iomodel->gridoniceshelf[i];   
    396                 node_onsheet=(int)iomodel->gridonicesheet[i];   
     394                node_properties.SetProperties(
     395                        (int)iomodel->gridonbed[i],
     396                        (int)iomodel->gridonsurface[i],
     397                        (int)iomodel->gridoniceshelf[i],
     398                        (int)iomodel->gridonicesheet[i]);
    397399
    398400                if (strcmp(iomodel->meshtype,"3d")==0){
     
    410412
    411413                /*Create node using its constructor: */
    412                 node=new Node(node_id,node_partitionborder,node_numdofs,node_x,node_sigma,node_onbed,node_onsurface,node_upper_node_id,node_onshelf,node_onsheet);
     414                node=new Node(node_id,vertex_id, node_upper_node_id, node_partitionborder,node_numdofs, &node_properties);   
    413415
    414416                /*set single point constraints.: */
     
    430432        elements->Presort();
    431433        nodes->Presort();
     434        vertices->Presort();
    432435        materials->Presort();
    433436
     
    462465        *pelements=elements;
    463466        *pnodes=nodes;
     467        *pvertices=vertices;
    464468        *pmaterials=materials;
    465469}
  • issm/trunk/src/c/ModelProcessorx/Prognostic/CreateElementsNodesAndMaterialsPrognostic.cpp

    r3383 r3417  
    1414
    1515
    16 void    CreateElementsNodesAndMaterialsPrognostic(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
     16void    CreateElementsNodesAndMaterialsPrognostic(DataSet** pelements,DataSet** pnodes, DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1717
    1818
     
    2727        DataSet*    elements  = NULL;
    2828        DataSet*    nodes = NULL;
     29        DataSet*    vertices = NULL;
    2930        DataSet*    materials = NULL;
    3031       
    3132        /*Objects: */
    3233        Node*       node   = NULL;
     34        Vertex*     vertex = NULL;
    3335        Tria*       tria = NULL;
    3436        Penta*      penta = NULL;
     
    9799        /* node constructor input: */
    98100        int node_id;
     101        int vertex_id;
    99102        int node_partitionborder=0;
    100         double node_x[3];
    101         double node_sigma;
    102103        int node_onbed;
    103104        int node_onsurface;
     
    122123        elements  = new DataSet(ElementsEnum());
    123124        nodes     = new DataSet(NodesEnum());
     125        vertices  = new DataSet(VerticesEnum());
    124126        materials = new DataSet(MaterialsEnum());
    125127
     
    436438        #endif
    437439
     440                /*create vertex: */
     441                vertex_id=i+1;
     442                vertex=new Vertex(vertex_id, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]));
     443                vertices->AddObject(vertex);
     444
     445
    438446                node_id=i+1; //matlab indexing
    439                        
    440                
    441447               
    442448                #ifdef _PARALLEL_
     
    451457                #endif
    452458
    453                 node_x[0]=iomodel->x[i];
    454                 node_x[1]=iomodel->y[i];
    455                 node_x[2]=iomodel->z[i];
    456                 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]);
    457                
    458                 node_onbed=(int)iomodel->gridonbed[i];
    459                 node_onsurface=(int)iomodel->gridonsurface[i]; 
    460                 node_onshelf=(int)iomodel->gridoniceshelf[i];   
    461                 node_onsheet=(int)iomodel->gridonicesheet[i];   
    462 
     459                node_properties.SetProperties(
     460                        (int)iomodel->gridonbed[i],
     461                        (int)iomodel->gridonsurface[i],
     462                        (int)iomodel->gridoniceshelf[i],
     463                        (int)iomodel->gridonicesheet[i]);
     464
     465       
    463466                if (strcmp(iomodel->meshtype,"3d")==0){
    464467                        if (isnan(iomodel->uppernodes[i])){
     
    475478
    476479                /*Create node using its constructor: */
    477                 node=new Node(node_id,node_partitionborder,node_numdofs,node_x,node_sigma,node_onbed,node_onsurface,node_upper_node_id,node_onshelf,node_onsheet);
     480                node=new Node(node_id,vertex_id, node_upper_node_id, node_partitionborder,node_numdofs, &node_properties);   
    478481
    479482                /*set single point constraints.: */
     
    498501        elements->Presort();
    499502        nodes->Presort();
     503        vertices->Presort();
    500504        materials->Presort();
    501505
     
    531535        *pelements=elements;
    532536        *pnodes=nodes;
     537        *pvertices=vertices;
    533538        *pmaterials=materials;
    534539
  • issm/trunk/src/c/ModelProcessorx/Prognostic2/CreateElementsNodesAndMaterialsPrognostic2.cpp

    r3383 r3417  
    1313#include "../IoModel.h"
    1414
    15 void    CreateElementsNodesAndMaterialsPrognostic2(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
     15void    CreateElementsNodesAndMaterialsPrognostic2(DataSet** pelements,DataSet** pnodes, DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1616
    1717        int i,j,k,n;
     
    2222        DataSet* elements  = NULL;
    2323        DataSet* nodes = NULL;
     24        DataSet*    vertices = NULL;
    2425        DataSet* materials = NULL;
    2526       
    2627        /*Objects: */
    2728        Node*   node   = NULL;
     29        Vertex*     vertex = NULL;
    2830        Tria*   tria = NULL;
    2931        Penta*  penta = NULL;
     
    9698        /* node constructor input: */
    9799        int node_id;
     100        int vertex_id;
     101        int vertex_partitionborder=0;
    98102        int node_partitionborder=0;
    99         double node_x[3];
    100         double node_sigma;
    101103        int node_onbed;
    102104        int node_onsurface;
     
    125127        elements  = new DataSet(ElementsEnum());
    126128        nodes     = new DataSet(NodesEnum());
     129        vertices  = new DataSet(VerticesEnum());
    127130        materials = new DataSet(MaterialsEnum());
    128131
     
    349352        DistributeNumDofs(&node_numdofs,iomodel->analysis_type,iomodel->sub_analysis_type);
    350353
     354        /*Create vertices: */
     355        for (i=0;i<iomodel->numberofnodes;i++){
     356        #ifdef _PARALLEL_
     357        /*keep only this partition's nodes:*/
     358        if((my_grids[i]==1)){
     359        #endif
     360
     361        /*create vertex: */
     362        vertex_id=i+1;
     363        vertex=new Vertex(vertex_id, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]));
     364
     365        vertices->AddObject(vertex);
     366
     367        #ifdef _PARALLEL_
     368        } //if((my_grids[i]==1))
     369        #endif
     370        }
     371
    351372        /*Build Nodes dataset -> 3 for each element*/
    352373        for (i=0;i<iomodel->numberofelements;i++){
     
    374395                                        node_partitionborder=0;
    375396                                #endif
    376                                 node_x[0]=iomodel->x[k];
    377                                 node_x[1]=iomodel->y[k];
    378                                 node_x[2]=iomodel->z[k];
    379                                 node_sigma=(iomodel->z[k]-iomodel->bed[k])/(iomodel->thickness[k]);
    380                                 node_onbed=(int)iomodel->gridonbed[k];
    381                                 node_onsurface=(int)iomodel->gridonsurface[k]; 
    382                                 node_onshelf=(int)iomodel->gridoniceshelf[k];   
    383                                 node_onsheet=(int)iomodel->gridonicesheet[k];   
     397
     398                                node_properties.SetProperties(
     399                                        (int)iomodel->gridonbed[k],
     400                                        (int)iomodel->gridonsurface[k],
     401                                        (int)iomodel->gridoniceshelf[k],
     402                                        (int)iomodel->gridonicesheet[k]);
     403
    384404                                if (strcmp(iomodel->meshtype,"3d")==0){
    385405                                        if (isnan(iomodel->uppernodes[k])){
     
    396416
    397417                                /*Create node using its constructor: */
    398                                 node=new Node(node_id,node_partitionborder,node_numdofs,node_x,node_sigma,node_onbed,node_onsurface,node_upper_node_id,node_onshelf,node_onsheet);
     418                                node=new Node(node_id, k, node_upper_node_id, node_partitionborder,node_numdofs, &node_properties);   
    399419
    400420                                /*Add node to nodes dataset: */
     
    410430        elements->Presort();
    411431        nodes->Presort();
     432        vertices->Presort();
    412433        materials->Presort();
    413434
     
    443464        *pelements=elements;
    444465        *pnodes=nodes;
     466        *pvertices=vertices;
    445467        *pmaterials=materials;
    446468}
  • issm/trunk/src/c/ModelProcessorx/SlopeCompute/CreateElementsNodesAndMaterialsSlopeCompute.cpp

    r3383 r3417  
    1313#include "../IoModel.h"
    1414
    15 void    CreateElementsNodesAndMaterialsSlopeCompute(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
     15void    CreateElementsNodesAndMaterialsSlopeCompute(DataSet** pelements,DataSet** pnodes, DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1616
    1717
     
    2626        DataSet*    elements  = NULL;
    2727        DataSet*    nodes = NULL;
     28        DataSet*    vertices = NULL;
    2829        DataSet*    materials = NULL;
    2930       
    3031        /*Objects: */
    3132        Node*       node   = NULL;
     33        Vertex*     vertex = NULL;
    3234        Tria*       tria = NULL;
    3335        Penta*      penta = NULL;
     
    6870        /* node constructor input: */
    6971        int node_id;
     72        int vertex_id;
    7073        int node_partitionborder=0;
    71         double node_x[3];
    72         double node_sigma;
    7374        int node_onbed;
    7475        int node_onsurface;
     
    9394        elements  = new DataSet(ElementsEnum());
    9495        nodes     = new DataSet(NodesEnum());
     96        vertices  = new DataSet(VerticesEnum());
    9597        materials = new DataSet(MaterialsEnum());
    9698
     
    372374        #endif
    373375
     376                /*create vertex: */
     377                vertex_id=i+1;
     378                vertex=new Vertex(vertex_id, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]));
     379                vertices->AddObject(vertex);
     380
     381
    374382                node_id=i+1; //matlab indexing
    375                        
    376                
    377383               
    378384                #ifdef _PARALLEL_
     
    387393                #endif
    388394
    389                 node_x[0]=iomodel->x[i];
    390                 node_x[1]=iomodel->y[i];
    391                 node_x[2]=iomodel->z[i];
    392                 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]);
    393                
    394                 node_onbed=(int)iomodel->gridonbed[i];
    395                 node_onsurface=(int)iomodel->gridonsurface[i]; 
    396                 node_onshelf=(int)iomodel->gridoniceshelf[i];   
    397                 node_onsheet=(int)iomodel->gridonicesheet[i];   
     395                node_properties.SetProperties(
     396                        (int)iomodel->gridonbed[i],
     397                        (int)iomodel->gridonsurface[i],
     398                        (int)iomodel->gridoniceshelf[i],
     399                        (int)iomodel->gridonicesheet[i]);
    398400
    399401                if (strcmp(iomodel->meshtype,"3d")==0){
     
    411413
    412414                /*Create node using its constructor: */
    413                 node=new Node(node_id,node_partitionborder,node_numdofs,node_x,node_sigma,node_onbed,node_onsurface,node_upper_node_id,node_onshelf,node_onsheet);
     415                node=new Node(node_id,vertex_id, node_upper_node_id, node_partitionborder,node_numdofs, &node_properties);   
    414416
    415417                /*set single point constraints.: */
     
    434436        elements->Presort();
    435437        nodes->Presort();
     438        vertices->Presort();
    436439        materials->Presort();
    437440
     
    467470        *pelements=elements;
    468471        *pnodes=nodes;
     472        *pvertices=vertices;
    469473        *pmaterials=materials;
    470474
  • issm/trunk/src/c/ModelProcessorx/Thermal/CreateElementsNodesAndMaterialsThermal.cpp

    r3383 r3417  
    1212#include "../IoModel.h"
    1313
    14 void    CreateElementsNodesAndMaterialsThermal(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
     14void    CreateElementsNodesAndMaterialsThermal(DataSet** pelements,DataSet** pnodes, DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1515
    1616
     
    2525        DataSet*    elements  = NULL;
    2626        DataSet*    nodes = NULL;
     27        DataSet*    vertices = NULL;
    2728        DataSet*    materials = NULL;
    2829       
    2930        /*Objects: */
    3031        Node*       node   = NULL;
     32        Vertex*     vertex = NULL;
    3133        Penta*      penta = NULL;
    3234        Matice*     matice  = NULL;
     
    8688        /* node constructor input: */
    8789        int node_id;
     90        int vertex_id;
    8891        int node_partitionborder=0;
    89         double node_x[3];
    90         double node_sigma;
    9192        int node_onbed;
    9293        int node_onsurface;
     
    111112        elements  = new DataSet(ElementsEnum());
    112113        nodes     = new DataSet(NodesEnum());
     114        vertices  = new DataSet(VerticesEnum());
    113115        materials = new DataSet(MaterialsEnum());
    114116
     
    369371        #endif
    370372
     373                /*create vertex: */
     374                vertex_id=i+1;
     375                vertex=new Vertex(vertex_id, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]));
     376                vertices->AddObject(vertex);
     377
     378
    371379                node_id=i+1; //matlab indexing
    372380               
     
    382390                #endif
    383391
    384                 node_x[0]=iomodel->x[i];
    385                 node_x[1]=iomodel->y[i];
    386                 node_x[2]=iomodel->z[i];
    387                 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]);
    388                
    389                 node_onbed=(int)iomodel->gridonbed[i];
    390                 node_onsurface=(int)iomodel->gridonsurface[i]; 
    391                 node_onshelf=(int)iomodel->gridoniceshelf[i];   
    392                 node_onsheet=(int)iomodel->gridonicesheet[i];   
     392                node_properties.SetProperties(
     393                        (int)iomodel->gridonbed[i],
     394                        (int)iomodel->gridonsurface[i],
     395                        (int)iomodel->gridoniceshelf[i],
     396                        (int)iomodel->gridonicesheet[i]);
     397
    393398
    394399                if (strcmp(iomodel->meshtype,"3d")==0){
     
    406411
    407412                /*Create node using its constructor: */
    408                 node=new Node(node_id,node_partitionborder,node_numdofs,node_x,node_sigma,node_onbed,node_onsurface,node_upper_node_id,node_onshelf,node_onsheet);
     413                node=new Node(node_id,vertex_id, node_upper_node_id, node_partitionborder,node_numdofs, &node_properties);   
    409414
    410415                /*Add node to nodes dataset: */
     
    420425        elements->Presort();
    421426        nodes->Presort();
     427        vertices->Presort();
    422428        materials->Presort();
    423429
     
    440446        *pelements=elements;
    441447        *pnodes=nodes;
     448        *pvertices=vertices;
    442449        *pmaterials=materials;
    443450
  • issm/trunk/src/c/objects/ElementProperties.cpp

    r3396 r3417  
    9696}
    9797/*}}}*/
    98 /*FUNCTION ElementProperties copy constructor{{{1*/
    99 ElementProperties::ElementProperties(ElementProperties* prop){ //copy constructor
    100        
     98/*FUNCTION ElementProperties constructor {{{1*/
     99
     100ElementProperties::ElementProperties(int elementproperties_numnodes, double* elementproperties_h,double* elementproperties_s,double* elementproperties_b,
     101                double* elementproperties_k,double* elementproperties_melting,double* elementproperties_accumulation,
     102                double* elementproperties_geothermalflux, int elementproperties_friction_type,double elementproperties_p,
     103                double elementproperties_q, int elementproperties_shelf, int elementproperties_onbed, bool elementproperties_onwater,
     104                int elementproperties_onsurface, int elementproperties_collapse, int elementproperties_thermal_steadystate){
     105
     106        this->Init(elementproperties_numnodes, elementproperties_h,elementproperties_s,elementproperties_b,
     107                elementproperties_k,elementproperties_melting,elementproperties_accumulation,
     108                elementproperties_geothermalflux, elementproperties_friction_type,elementproperties_p,
     109                elementproperties_q, elementproperties_shelf, elementproperties_onbed, elementproperties_onwater,
     110                elementproperties_onsurface, elementproperties_collapse, elementproperties_thermal_steadystate);
     111}
     112/*}}}*/
     113/*FUNCTION ElementProperties Initialize propreties, used by constructor{{{1*/
     114ElementProperties::Init(int elementproperties_numnodes, double* elementproperties_h,double* elementproperties_s,double* elementproperties_b,
     115                double* elementproperties_k,double* elementproperties_melting,double* elementproperties_accumulation,
     116                double* elementproperties_geothermalflux, int elementproperties_friction_type,double elementproperties_p,
     117                double elementproperties_q, int elementproperties_shelf, int elementproperties_onbed, bool elementproperties_onwater,
     118                int elementproperties_onsurface, int elementproperties_collapse, int elementproperties_thermal_steadystate){
     119
    101120        int i;
    102121
  • issm/trunk/src/c/objects/ElementProperties.h

    r3390 r3417  
    3333                ElementProperties();
    3434                ElementProperties(int numnodes, double* h, double* s, double* b, double* k, double* melting, double* accumulation, double* geothermalflux, int friction_type, double p, double q, int shelf, int onbed, bool onwater, int onsurface, int collapse, int thermal_steadystate);
     35                Init(int numnodes, double* h, double* s, double* b, double* k, double* melting, double* accumulation, double* geothermalflux, int friction_type, double p, double q, int shelf, int onbed, bool onwater, int onsurface, int collapse, int thermal_steadystate);
    3536                ElementProperties(ElementProperties* properties);
    3637                ~ElementProperties();
  • issm/trunk/src/c/objects/FemModel.cpp

    r3332 r3417  
    99#endif
    1010
    11 #include "./FemModel.h"
    1211#include "stdio.h"
    1312#include "../shared/shared.h"
    1413#include "../include/macros.h"
    15 
     14#include "./FemModel.h"
     15
     16/*Object constructors, destructors: {{{1:*/
    1617FemModel::FemModel(){
    1718
    1819        elements=NULL;
    1920        nodes=NULL;
     21        vertices=NULL;
    2022        constraints=NULL;
    2123        loads=NULL;
     
    3436}
    3537
    36 FemModel::FemModel(DataSet* femmodel_elements,DataSet* femmodel_nodes,DataSet* femmodel_constraints,DataSet* femmodel_loads,
     38FemModel::FemModel(DataSet* femmodel_elements,DataSet* femmodel_nodes,DataSet* femmodel_vertices, DataSet* femmodel_constraints,DataSet* femmodel_loads,
    3739                DataSet* femmodel_materials,DataSet* femmodel_parameters, DofVec* femmodel_partition,DofVec* femmodel_tpartition,DofVec* femmodel_yg,
    3840                Mat femmodel_Rmg,Mat femmodel_Gmn,NodeSets* femmodel_nodesets,Vec femmodel_ys,Vec femmodel_ys0){
     
    4143        elements=femmodel_elements;
    4244        nodes=femmodel_nodes;
     45        vertices=femmodel_vertices;
    4346        constraints=femmodel_constraints;
    4447        loads=femmodel_loads;
     
    6164        delete elements;
    6265        delete nodes;
     66        delete vertices;
    6367        delete loads;
    6468        delete constraints;
     
    7680
    7781}
    78 
    79 
     82/*}}}*/
     83/* Object management: {{{1*/
    8084void FemModel::Echo(void){
    8185
     
    8387        printf("   elements: %p\n",elements);
    8488        printf("   nodes: %p\n",nodes);
     89        printf("   vertices: %p\n",vertices);
    8590        printf("   loads: %p\n",loads);
    8691        printf("   materials: %p\n",materials);
     
    105110        printf("   nodes: \n");
    106111        nodes->Echo();
     112        printf("   vertices: \n");
     113        vertices->Echo();
    107114        printf("   loads: \n");
    108115        nodes->Echo();
     
    204211DataSet*            FemModel::get_elements(void){return elements;}
    205212DataSet*            FemModel::get_nodes(void){return nodes ;}
     213DataSet*            FemModel::get_vertices(void){return vertices ;}
    206214DataSet*            FemModel::get_constraints(void){return constraints ;}
    207215DataSet*            FemModel::get_loads(void){return loads;}
     
    216224Vec                 FemModel::get_ys0(void){return ys0;}
    217225Mat                 FemModel::get_Gmn(void){return Gmn;}
     226/*}}}*/
  • issm/trunk/src/c/objects/FemModel.h

    r2333 r3417  
    66#define FEMMODEL_H_
    77
     8#include "./Object.h"
     9#include "../DataSet/DataSet.h"
     10#include "./DofVec.h"
    811#include "../toolkits/toolkits.h"
    9 #include "../DataSet/DataSet.h"
    1012#include "../parallel/parallel.h"
    11 #include "./DofVec.h"
    12 
    13 class DataSet;
    14 struct OptArgs;
    1513
    1614class FemModel: public Object{
     
    2220                DataSet*            elements;
    2321                DataSet*            nodes;
     22                DataSet*            vertices;
    2423                DataSet*            constraints;
    2524                DataSet*            loads;
     
    2726                DataSet*            parameters;
    2827
    29                 DofVec*                 partition;
    30                 DofVec*                 tpartition;
    31                 DofVec*                 yg;
     28                DofVec*             partition;
     29                DofVec*             tpartition;
     30                DofVec*             yg;
     31
    3232                Mat                 Rmg;
    3333                NodeSets*           nodesets;
     
    3838                FemModel();
    3939                ~FemModel();
    40                 FemModel(DataSet* elements,DataSet* nodes,DataSet* constraints,DataSet* loads,DataSet* materials,DataSet* parameters,
     40                FemModel(DataSet* elements,DataSet* nodes,DataSet* vertices, DataSet* constraints,DataSet* loads,DataSet* materials,DataSet* parameters,
    4141                                      DofVec* partition,DofVec* tpartition,DofVec* yg,Mat Rmg,Mat Gmn,NodeSets* nodesets,Vec ys,Vec ys0);
    4242     
     
    6262                DataSet* get_elements(void);
    6363                DataSet* get_nodes(void);
     64                DataSet* get_vertices(void){return vertices ;}
    6465                DataSet* get_constraints(void);
    6566                DataSet* get_loads(void);
     
    7576                Mat      get_Gmn(void);
    7677
    77                
    78 
    79 
    8078};
    8179
  • issm/trunk/src/c/objects/Hook.cpp

    r3399 r3417  
    1212#include "stdio.h"
    1313#include <string.h>
     14#include "./Object.h"
     15#include "../DataSet/DataSet.h"
     16#include "./Hook.h"
    1417#include "../EnumDefinitions/EnumDefinitions.h"
    1518#include "./ParameterInputs.h"
     
    1720#include "../include/typedefs.h"
    1821#include "../include/macros.h"
    19 #include "./Hook.h"
    2022
    2123
     
    3133/*}}}*/
    3234/*FUNCTION Hook::Hook(int* ids, int num){{{1*/
    33 Hook::Hook(int* ids, int num){
    34 
    35         int i;
    36         this->num=num;
     35Hook::Hook(int* in_ids, int in_num){
     36        this->Init(in_ids,in_num);
     37}
     38/*}}}*/
     39/*FUNCTION Hook::Init(int* ids, int num){{{1*/
     40Hook::Init(int* in_ids, int in_num){
     41
     42        int i;
     43        this->num=in_num;
    3744       
    3845        /*Allocate: */
     
    4350        /*Copy ids: */
    4451        for (i=0;i<this->num;i++){
    45                 this->ids[i]=ids[i];
     52                this->ids[i]=in_ids[i];
    4653                this->objects[i]=NULL;
    4754                this->offsets[i]=0;
  • issm/trunk/src/c/objects/Hook.h

    r3383 r3417  
    1010
    1111#include "./Object.h"
    12 #include "./../DataSet/DataSet.h"
     12#include "../DataSet/DataSet.h"
    1313#include "../toolkits/toolkits.h"
    1414
    1515class DataSet;
    16 class Object;
    17 
    1816class Hook{
    1917
     
    2927                Hook();
    3028                Hook(int* ids, int num);
     29                Init(int* ids, int num);
    3130                Hook(Object** objects, int* ids, int* offsets,int num);
    3231                Hook(Hook* hook);
  • issm/trunk/src/c/objects/Matice.cpp

    r3332 r3417  
    1717               
    1818/*Object constructors and destructor*/
     19/*FUNCTION Matice::default constructor {{{1*/
     20Matice::Matice(){
     21        return;
     22}
     23/*}}}*/
    1924/*FUNCTION Matice::constructor {{{1*/
    20 Matice::Matice(){
    21         return;
    22 }
    23 /*}}}*/
    24 /*FUNCTION Matice::creation {{{1*/
    25 Matice::Matice(int matice_mid,double matice_B,double matice_n){
    26         mid=matice_mid;
    27         B=matice_B;
    28         n=matice_n;
    29         return;
     25Matice::Matice(int in_mid,double in_B,double in_n){
     26        this->Init(in_mid,in_B,in_n);
     27}
     28/*}}}*/
     29/*FUNCTION Matice::init {{{1*/
     30Matice::Init(int in_mid,double in_B,double in_n){
     31        this->mid=in_mid;
     32        this->B=in_B;
     33        this->n=in_n;
     34}
     35/*}}}*/
     36/*FUNCTION Matice::constructor from iomodel {{{1*/
     37Matice::Matice(int i, IoModel* iomodel, int num_vertices){
     38
     39        int j;
     40       
     41        /*needed for Init routine:*/
     42        int matice_mid;
     43        double matice_B;
     44        double matice_n;
     45
     46        /*intermediary: */
     47        double B_avg;
     48       
     49        /*id: */
     50        matice_mid=i+1;  //same as element it is created for
     51 
     52        /*B and n: */
     53        B_avg=0;
     54        for(j=0;j<num_vertices;j++){
     55                B_avg+=*(iomodel->B+((int)*(iomodel->elements+num_vertices*i+j)-1));
     56        }
     57        B_avg=B_avg/num_vertices;
     58       
     59        matice_B=B_avg;
     60        matice_n=(double)*(iomodel->n+i);
     61
     62        this->Init(matice_mid,matice_B,matice_n);
    3063}
    3164/*}}}*/
  • issm/trunk/src/c/objects/Matice.h

    r1051 r3417  
    1919                Matice();
    2020                Matice(int mid,double B,double n);
     21                Matice(int i, IoModel* iomodel, int num_vertices);
     22                Init(int mid,double B,double n);
    2123                ~Matice();
    2224
  • issm/trunk/src/c/objects/Matpar.cpp

    r3332 r3417  
    1818               
    1919/*Object constructors and destructor*/
    20 /*FUNCTION Matpar::constructor {{{1*/
     20/*FUNCTION Matpar::default constructor {{{1*/
    2121Matpar::Matpar(){
    2222        return;
    2323}
    2424/*}}}1*/
    25 /*FUNCTION Matpar::creation {{{1*/
     25/*FUNCTION Matpar::constructorr {{{1*/
    2626Matpar::Matpar(int      matpar_mid, double      matpar_rho_ice, double  matpar_rho_water, double  matpar_heatcapacity, double  matpar_thermalconductivity, double  matpar_latentheat, double  matpar_beta, double  matpar_meltingpoint, double  matpar_mixed_layer_capacity, double  matpar_thermal_exchange_velocity, double  matpar_g){
    2727
    28 
    29         mid=matpar_mid;
    30         rho_ice=matpar_rho_ice;
    31         rho_water=matpar_rho_water;
    32         heatcapacity=matpar_heatcapacity;
    33         thermalconductivity=matpar_thermalconductivity;
    34         latentheat=matpar_latentheat;
    35         beta=matpar_beta;
    36         meltingpoint=matpar_meltingpoint;
    37         mixed_layer_capacity=matpar_mixed_layer_capacity;
    38         thermal_exchange_velocity=matpar_thermal_exchange_velocity;
    39         g=matpar_g;
     28        this->Init(matpar_mid, matpar_rho_ice, matpar_rho_water, matpar_heatcapacity, matpar_thermalconductivity, matpar_latentheat, matpar_beta, matpar_meltingpoint, matpar_mixed_layer_capacity, matpar_thermal_exchange_velocity, matpar_g);
     29
     30}
     31/*}}}1*/
     32/*FUNCTION Matpar::constructor  from iomodel{{{1*/
     33Matpar::Matpar(IoModel* iomodel){
     34
     35        int     matpar_mid;
     36        double  matpar_rho_ice;
     37        double  matpar_rho_water;
     38        double  matpar_heatcapacity;
     39        double  matpar_thermalconductivity;
     40        double  matpar_latentheat;
     41        double  matpar_beta;
     42        double  matpar_meltingpoint;
     43        double  matpar_mixed_layer_capacity;
     44        double  matpar_thermal_exchange_velocity;
     45        double  matpar_g;
     46
     47        matpar_mid=iomodel->numberofelements+1; //put it at the end of the materials
     48        matpar_g=iomodel->g;
     49        matpar_rho_ice=iomodel->rho_ice;
     50        matpar_rho_water=iomodel->rho_water;
     51        matpar_thermalconductivity=iomodel->thermalconductivity;
     52        matpar_heatcapacity=iomodel->heatcapacity;
     53        matpar_latentheat=iomodel->latentheat;
     54        matpar_beta=iomodel->beta;
     55        matpar_meltingpoint=iomodel->meltingpoint;
     56        matpar_mixed_layer_capacity=iomodel->mixed_layer_capacity;
     57        matpar_thermal_exchange_velocity=iomodel->thermal_exchange_velocity;
     58
     59        this->Init(matpar_mid, matpar_rho_ice, matpar_rho_water, matpar_heatcapacity, matpar_thermalconductivity, matpar_latentheat, matpar_beta, matpar_meltingpoint, matpar_mixed_layer_capacity, matpar_thermal_exchange_velocity, matpar_g);
     60
     61}
     62/*}}}1*/
     63/*FUNCTION Matpar::Init {{{1*/
     64Matpar::Init(int        matpar_mid, double      matpar_rho_ice, double  matpar_rho_water, double  matpar_heatcapacity, double  matpar_thermalconductivity, double  matpar_latentheat, double  matpar_beta, double  matpar_meltingpoint, double  matpar_mixed_layer_capacity, double  matpar_thermal_exchange_velocity, double  matpar_g){
     65
     66        this->mid=matpar_mid;
     67        this->rho_ice=matpar_rho_ice;
     68        this->rho_water=matpar_rho_water;
     69        this->heatcapacity=matpar_heatcapacity;
     70        this->thermalconductivity=matpar_thermalconductivity;
     71        this->latentheat=matpar_latentheat;
     72        this->beta=matpar_beta;
     73        this->meltingpoint=matpar_meltingpoint;
     74        this->mixed_layer_capacity=matpar_mixed_layer_capacity;
     75        this->thermal_exchange_velocity=matpar_thermal_exchange_velocity;
     76        this->g=matpar_g;
    4077
    4178        return;
  • issm/trunk/src/c/objects/Matpar.h

    r803 r3417  
    2828       
    2929                Matpar(int      mid, double     rho_ice, double rho_water, double  heatcapacity, double  thermalconductivity, double  latentheat, double  beta, double  meltingpoint, double  mixed_layer_capacity, double  thermal_exchange_velocity, double  g);
     30                Init(int        mid, double     rho_ice, double rho_water, double  heatcapacity, double  thermalconductivity, double  latentheat, double  beta, double  meltingpoint, double  mixed_layer_capacity, double  thermal_exchange_velocity, double  g);
     31                Matpar(IoModel* iomodel);
    3032               
    3133                ~Matpar();
  • issm/trunk/src/c/objects/Model.cpp

    r3332 r3417  
    4343        DataSet*            elements=NULL;
    4444        DataSet*            nodes=NULL;
     45        DataSet*            vertices=NULL;
    4546        DataSet*            constraints=NULL;
    4647        DataSet*            loads=NULL;
     
    7172
    7273        _printf_("   create datasets:\n");
    73         CreateDataSets(&elements,&nodes,&materials,&constraints,&loads,&parameters,iomodel,MODEL);
     74        CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,&parameters,iomodel,MODEL);
    7475
    7576        _printf_("   create degrees of freedom: \n");
    76         Dofx( &partition,&tpartition,elements,nodes, parameters);
     77        Dofx( &partition,&tpartition,elements,nodes, vertices,parameters);
    7778       
    7879        _printf_("   create single point constraints: \n");
     
    9293
    9394        _printf_("   configuring element and loads:\n");
    94         ConfigureObjectsx(elements, loads, nodes, materials,parameters);
     95        ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
    9596
    9697        _printf_("   process parameters:\n");
     
    101102
    102103        /*Use all the data created to create an femmodel: */
    103         femmodel=new FemModel(elements,nodes,constraints,loads,materials,parameters,
     104        femmodel=new FemModel(elements, nodes, vertices, constraints,loads,materials,parameters,
    104105                                      partition,tpartition,yg,Rmg,Gmn,nodesets,ys,ys0);
    105106
     
    116117        DataSet*            elements=NULL;
    117118        DataSet*            nodes=NULL;
     119        DataSet*            vertices=NULL;
    118120        DataSet*            constraints=NULL;
    119121        DataSet*            loads=NULL;
     
    148150
    149151        _printf_("   create datasets:\n");
    150         CreateDataSets(&elements,&nodes,&materials,&constraints,&loads,&parameters,iomodel,MODEL);
     152        CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,&parameters,iomodel,MODEL);
    151153
    152154        _printf_("   create degrees of freedom: \n");
    153         Dofx( &partition,&tpartition,elements,nodes, parameters);
     155        Dofx( &partition,&tpartition,elements,nodes, vertices,parameters);
    154156       
    155157        _printf_("   create single point constraints: \n");
     
    169171
    170172        _printf_("   configuring element and loads:\n");
    171         ConfigureObjectsx(elements, loads, nodes, materials,parameters);
     173        ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
    172174
    173175        _printf_("   process parameters:\n");
     
    178180
    179181        /*Use all the data created to create an femmodel: */
    180         femmodel=new FemModel(elements,nodes,constraints,loads,materials,parameters,
     182        femmodel=new FemModel(elements,nodes,vertices, constraints,loads,materials,parameters,
    181183                                      partition,tpartition,yg,Rmg,Gmn,nodesets,ys,ys0);
    182184
  • issm/trunk/src/c/objects/Node.cpp

    r3392 r3417  
    33 */
    44
    5 
     5/*Include files: {{{1*/
    66#ifdef HAVE_CONFIG_H
    77        #include "config.h"
     
    1111
    1212#include "stdio.h"
     13#include "./Vertex.h"
    1314#include "./Node.h"
     15#include "./Hook.h"
     16#include "./DofIndexing.h"
    1417#include <string.h>
    1518#include "../EnumDefinitions/EnumDefinitions.h"
     
    1821#include "../include/typedefs.h"
    1922#include "../include/macros.h"
    20 
    21 /*Object constructors and destructor*/
    22 /*FUNCTION Node constructor {{{1*/
     23/*}}}*/
     24/*Object constructors and destructors: {{{1*/
     25/*FUNCTION Node default constructor {{{2*/
    2326Node::Node(){
    2427        return;
    2528}
    2629/*}}}*/
    27 /*FUNCTION Node constructor {{{1*/
    28 Node::Node(int node_id,int node_partitionborder,int node_numdofs, double node_x[3],double node_sigma,int node_onbed,int node_onsurface,int node_upper_node_id,int node_onshelf,int node_onsheet){
    29 
    30         int i;
    31        
    32         id=node_id;
    33         partitionborder=node_partitionborder;
    34         numberofdofs=node_numdofs;
    35         x[0]=node_x[0];
    36         x[1]=node_x[1];
    37         x[2]=node_x[2];
    38         sigma=node_sigma;
    39         onbed=node_onbed;
    40         onsurface=node_onsurface;
    41         onshelf=node_onshelf;
    42         onsheet=node_onsheet;
    43 
    44         /*Initialize sets: */
    45         for(i=0;i<numberofdofs;i++){
    46                 mset[i]=0;
    47                 nset[i]=1;
    48                 fset[i]=1; //we assume new nodes are not constrained in rigid body mode, or single point constraint mode.
    49                 sset[i]=0;
    50         }
    51 
    52         /*Initialize upper node:*/
    53         upper_node_id=node_upper_node_id;
    54         upper_node=NULL;
    55         upper_node_offset=UNDEF;
     30/*FUNCTION Node constructor {{{2*/
     31Node::Node(int node_id,int node_vertex_id, int node_upper_node_id, int node_partitionborder,int node_numdofs, NodeProperties* node_properties):
     32        indexing(node_numdofs,node_partitionborder),
     33        properties(node_properties),
     34    hvertex(&node_vertex_id,1),
     35    hupper_node(&node_upper_node_id,1){
     36
     37        this->id=node_id;
    5638
    5739        return;
    5840}
    5941/*}}}*/
    60 /*FUNCTION Node destructor{{{1*/
     42/*FUNCTION Node other constructor {{{2*/
     43Node::Node(int node_id,DofIndexing* node_indexing, NodeProperties* node_properties, Hook* node_vertex, Hook* node_upper_node):
     44            indexing(node_indexing),
     45                properties(node_properties),
     46                hvertex(node_vertex),
     47                hupper_node(node_upper_node) {
     48
     49            /*all the initialization has been done by the initializer, just fill in the id: */
     50            this->id=node_id;
     51
     52}
     53/*}}}*/
     54/*FUNCTION Node constructor  from iomodel{{{2*/
     55Node::Node(int i, IoModel* iomodel){ //i is the node index
     56
     57        int k;
     58       
     59        int numdofs;
     60        int partitionborder;
     61        int vertex_id;
     62
     63
     64        /*id: */
     65        this->id=i+1; //matlab indexing
     66
     67        /*indexing:*/
     68        DistributeNumDofs(&numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); //number of dofs per node
     69        if(my_bordervertices[i])partitionborder=1; else partitionborder=0;//is this node on a partition border?
     70
     71        this->indexing.Init(numdofs,partitionborder);
     72
     73        /*properties: */
     74        this->properties.Init(
     75                        (int)iomodel->gridonbed[i],
     76                        (int)iomodel->gridonsurface[i],
     77                        (int)iomodel->gridoniceshelf[i],
     78                        (int)iomodel->gridonicesheet[i]);
     79
     80        /*hooks: */
     81        vertex_id=this->id; //node and vertex have the same id, as we are running galerkin continuous, with same number of nodes and vertices.
     82
     83        if (strcmp(iomodel->meshtype,"3d")==0){
     84                if (isnan(iomodel->uppernodes[i])){
     85                        upper_node_id=this->id; //nodes on surface do not have upper nodes, only themselves.
     86                }
     87                else{
     88                        upper_node_id=(int)iomodel->uppernodes[i];
     89                }
     90        }
     91        else{
     92                /*If we are running 2d, upper_node does not mean much. Just point towards itself!:*/
     93                upper_node_id=this->id;
     94        }
     95
     96        this->hvertex->Init(vertex_id,1); //node id is the same as the vertex id, continuous galerkin!
     97        this->hupper_node->Init(upper_node_id,1);
     98       
     99
     100        /*set single point constraints.: */
     101        if (strcmp(iomodel->meshtype,"3d")==0){
     102                /*We have a  3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */
     103                if (iomodel->deadgrids[i]){
     104                        for(k=1;k<=numdofs;k++){
     105                                node->FreezeDof(k);
     106                        }
     107                }
     108        }
     109        if (iomodel->gridonhutter[i]){
     110                for(k=1;k<=numdofs;k++){
     111                        node->FreezeDof(k);
     112                }
     113        }
     114}
     115/*}}}*/
     116/*FUNCTION Node destructor{{{2*/
    61117Node::~Node(){
    62118        return;
    63119}
    64120/*}}}*/
    65 
    66 /*Object management*/
    67 /*FUNCTION Node Marshall{{{1*/
    68 void  Node::Marshall(char** pmarshalled_dataset){
     121/*}}}*/
     122/*Object management: {{{1*/
     123/*FUNCTION Node Configure {{{2*/
     124void  Node::Configure(void* pnodes, void* pvertices){
     125
     126        int i;
     127
     128        DataSet* nodesin=NULL;
     129        DataSet* verticesin=NULL;
     130
     131        /*Recover pointers :*/
     132        nodesin=(DataSet*)pnodes;
     133        verticesin=(DataSet*)pvertices;
     134
     135        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
     136         * datasets, using internal ids and ofthis->indexing.f_sets hidden in hooks: */
     137        hvertex.configure(verticesin);
     138        hupper_node.configure(nodesin);
     139
     140}
     141/*}}}*/
     142/*FUNCTION Node copy {{{2*/
     143Object* Node::copy() {
     144               
     145        return new Node(this->id,&this->indexing, &this->properties, &this->hvertex,&this->hupper_node);
     146
     147}
     148
     149/*}}}*/
     150/*FUNCTION Node DeepEcho{{{2*/
     151void Node::DeepEcho(void){
     152
     153        printf("Node:\n");
     154        printf("   id: %i\n",id);
     155        indexing.DeepEcho();
     156        properties.DeepEcho();
     157        hvertex.DeepEcho();
     158        hupper_node.DeepEcho();
     159
     160}
     161/*}}}*/
     162/*FUNCTION Node Demarshall{{{2*/
     163void  Node::Demarshall(char** pmarshalled_dataset){
    69164
    70165        char* marshalled_dataset=NULL;
    71         int   enum_type=0;
    72166
    73167        /*recover marshalled_dataset: */
    74168        marshalled_dataset=*pmarshalled_dataset;
    75169
    76         /*get enum type of Node: */
    77         enum_type=NodeEnum();
    78        
    79         /*marshall enum: */
    80         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    81        
    82         /*marshall Node data: */
    83         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    84         memcpy(marshalled_dataset,&partitionborder,sizeof(partitionborder));marshalled_dataset+=sizeof(partitionborder);
    85         memcpy(marshalled_dataset,&clone,sizeof(clone));marshalled_dataset+=sizeof(clone);
    86         memcpy(marshalled_dataset,&numberofdofs,sizeof(numberofdofs));marshalled_dataset+=sizeof(numberofdofs);
    87         memcpy(marshalled_dataset,&x,sizeof(x));marshalled_dataset+=sizeof(x);
    88         memcpy(marshalled_dataset,&sigma,sizeof(sigma));marshalled_dataset+=sizeof(sigma);
    89         memcpy(marshalled_dataset,&onbed,sizeof(onbed));marshalled_dataset+=sizeof(onbed);
    90         memcpy(marshalled_dataset,&onsurface,sizeof(onsurface));marshalled_dataset+=sizeof(onsurface);
    91         memcpy(marshalled_dataset,&onshelf,sizeof(onshelf));marshalled_dataset+=sizeof(onshelf);
    92         memcpy(marshalled_dataset,&onsheet,sizeof(onsheet));marshalled_dataset+=sizeof(onsheet);
    93         memcpy(marshalled_dataset,&doflist,sizeof(doflist));marshalled_dataset+=sizeof(doflist);
    94         memcpy(marshalled_dataset,&doflist1,sizeof(doflist1));marshalled_dataset+=sizeof(doflist1);
    95         memcpy(marshalled_dataset,&mset,sizeof(mset));marshalled_dataset+=sizeof(mset);
    96         memcpy(marshalled_dataset,&nset,sizeof(nset));marshalled_dataset+=sizeof(nset);
    97         memcpy(marshalled_dataset,&fset,sizeof(fset));marshalled_dataset+=sizeof(fset);
    98         memcpy(marshalled_dataset,&sset,sizeof(sset));marshalled_dataset+=sizeof(sset);
    99         memcpy(marshalled_dataset,&upper_node_id,sizeof(upper_node_id));marshalled_dataset+=sizeof(upper_node_id);
    100         memcpy(marshalled_dataset,&upper_node,sizeof(upper_node));marshalled_dataset+=sizeof(upper_node);
    101         memcpy(marshalled_dataset,&upper_node_offset,sizeof(upper_node_offset));marshalled_dataset+=sizeof(upper_node_offset);
    102 
    103         *pmarshalled_dataset=marshalled_dataset;
    104         return;
    105 }
    106 /*}}}*/
    107 /*FUNCTION Node MarshallSize{{{1*/
    108 int   Node::MarshallSize(){
    109 
    110         return sizeof(id)+
    111                 sizeof(partitionborder)+
    112                 sizeof(clone)+
    113                 sizeof(numberofdofs)+
    114                 sizeof(x)+
    115                 sizeof(sigma)+
    116                 sizeof(onbed)+
    117                 sizeof(onsurface)+
    118                 sizeof(onshelf)+
    119                 sizeof(onsheet)+
    120                 sizeof(doflist)+
    121                 sizeof(doflist1)+
    122                 sizeof(mset)+
    123                 sizeof(nset)+
    124                 sizeof(fset)+
    125                 sizeof(sset)+
    126                 sizeof(upper_node_id)+
    127                 sizeof(upper_node)+
    128                 sizeof(upper_node_offset)+
    129                 sizeof(int); //sizeof(int) for enum type
    130 }
    131 /*}}}*/
    132 /*FUNCTION Node Demarshall{{{1*/
    133 void  Node::Demarshall(char** pmarshalled_dataset){
    134 
    135         char* marshalled_dataset=NULL;
    136 
    137         /*recover marshalled_dataset: */
    138         marshalled_dataset=*pmarshalled_dataset;
    139 
    140170        /*this time, no need to get enum type, the pointer directly points to the beginning of the
    141171         *object data (thanks to DataSet::Demarshall):*/
    142172
    143173        memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    144         memcpy(&partitionborder,marshalled_dataset,sizeof(partitionborder));marshalled_dataset+=sizeof(partitionborder);
    145         memcpy(&clone,marshalled_dataset,sizeof(clone));marshalled_dataset+=sizeof(clone);
    146         memcpy(&numberofdofs,marshalled_dataset,sizeof(numberofdofs));marshalled_dataset+=sizeof(numberofdofs);
    147         memcpy(&x,marshalled_dataset,sizeof(x));marshalled_dataset+=sizeof(x);
    148         memcpy(&sigma,marshalled_dataset,sizeof(sigma));marshalled_dataset+=sizeof(sigma);
    149         memcpy(&onbed,marshalled_dataset,sizeof(onbed));marshalled_dataset+=sizeof(onbed);
    150         memcpy(&onsurface,marshalled_dataset,sizeof(onsurface));marshalled_dataset+=sizeof(onsurface);
    151         memcpy(&onshelf,marshalled_dataset,sizeof(onshelf));marshalled_dataset+=sizeof(onshelf);
    152         memcpy(&onsheet,marshalled_dataset,sizeof(onsheet));marshalled_dataset+=sizeof(onsheet);
    153         memcpy(&doflist,marshalled_dataset,sizeof(doflist));marshalled_dataset+=sizeof(doflist);
    154         memcpy(&doflist1,marshalled_dataset,sizeof(doflist1));marshalled_dataset+=sizeof(doflist1);
    155         memcpy(&mset,marshalled_dataset,sizeof(mset));marshalled_dataset+=sizeof(mset);
    156         memcpy(&nset,marshalled_dataset,sizeof(nset));marshalled_dataset+=sizeof(nset);
    157         memcpy(&fset,marshalled_dataset,sizeof(fset));marshalled_dataset+=sizeof(fset);
    158         memcpy(&sset,marshalled_dataset,sizeof(sset));marshalled_dataset+=sizeof(sset);
    159         memcpy(&upper_node_id,marshalled_dataset,sizeof(upper_node_id));marshalled_dataset+=sizeof(upper_node_id);
    160         memcpy(&upper_node,marshalled_dataset,sizeof(upper_node));marshalled_dataset+=sizeof(upper_node);
    161         memcpy(&upper_node_offset,marshalled_dataset,sizeof(upper_node_offset));marshalled_dataset+=sizeof(upper_node_offset);
    162        
    163         /*upper node is not pointing to correct object anymore: */
    164         upper_node=NULL;
    165 
     174       
     175        /*demarshall objects: */
     176        indexing.Demarshall(&marshalled_dataset);
     177        properties.Demarshall(&marshalled_dataset);
     178        hvertex.Demarshall(&marshalled_dataset);
     179        hupper_node.Demarshall(&marshalled_dataset);
     180       
    166181        /*return: */
    167182        *pmarshalled_dataset=marshalled_dataset;
     
    169184}
    170185/*}}}*/
    171 /*FUNCTION Node GetId{{{1*/
     186/*FUNCTION Node Echo{{{2*/
     187void Node::Echo(void){
     188
     189        printf("Node:\n");
     190        printf("   id: %i\n",id);
     191        indexing.Echo();
     192        properties.Echo();
     193        hvertex.Echo();
     194        hupper_node.Echo();
     195
     196}
     197/*}}}*/
     198/*FUNCTION Node Enum{{{2*/
     199int Node::Enum(void){
     200
     201        return NodeEnum();
     202
     203}
     204/*}}}*/
     205/*FUNCTION Node GetId{{{2*/
    172206int    Node::GetId(void){ return id; }
    173207/*}}}*/
    174 /*FUNCTION Node GetName{{{1*/
     208/*FUNCTION Node GetName{{{2*/
    175209char* Node::GetName(void){
    176210        return "node";
    177211}
    178212/*}}}*/
    179                
    180 /*Object functions*/
    181 /*FUNCTION Node ApplyConstraints{{{1*/
     213/*FUNCTION Node GetVertexDof {{{2*/
     214int   Node::GetVertexDof(void){
     215
     216        Vertex*  vertex=NULL;
     217
     218        vertex=(Vertex*)hvertex.delivers();
     219        return vertex->dof;
     220}
     221/*}}}*/
     222/*FUNCTION Node Marshall{{{2*/
     223void  Node::Marshall(char** pmarshalled_dataset){
     224
     225        char* marshalled_dataset=NULL;
     226        int   enum_type=0;
     227
     228        /*recover marshalled_dataset: */
     229        marshalled_dataset=*pmarshalled_dataset;
     230
     231        /*get enum type of Node: */
     232        enum_type=NodeEnum();
     233       
     234        /*marshall enum: */
     235        memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
     236       
     237        /*marshall Node data: */
     238        memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
     239       
     240        /*marshall objects: */
     241        indexing.Marshall(&marshalled_dataset);
     242        properties.Marshall(&marshalled_dataset);
     243        hvertex.Marshall(&marshalled_dataset);
     244        hupper_node.Marshall(&marshalled_dataset);
     245
     246        *pmarshalled_dataset=marshalled_dataset;
     247        return;
     248}
     249/*}}}*/
     250/*FUNCTION Node MarshallSize{{{2*/
     251int   Node::MarshallSize(){
     252
     253        return sizeof(id)+
     254                +indexing.MarshallSize()+
     255                +properties.MarshallSize()+
     256                +hvertex.MarshallSize()+
     257                +hupper_node.MarshallSize()+
     258                sizeof(int); //sizeof(int) for enum type
     259}
     260/*}}}*/
     261/*FUNCTION Node SetVertexDof {{{2*/
     262void   Node::SetVertexDof(int in_dof){
     263
     264        Vertex*  vertex=NULL;
     265
     266        vertex=(Vertex*)hvertex.delivers();
     267        vertex->dof=in_dof;
     268
     269}
     270/*}}}*/
     271/*}}}*/
     272/*Object numerics: {{{1*/
     273/*FUNCTION Node ApplyConstraints{{{2*/
    182274void  Node::ApplyConstraint(Vec yg,int dof,double value){
    183275
     
    192284         *  we are a clone!*/
    193285
    194         if(!clone){
    195 
    196                 index=doflist[dof-1]; //matlab indexing
     286        if(!indexing.clone){
     287
     288                index=indexing.doflist[dof-1]; //matlab indexing
    197289
    198290                VecSetValues(yg,1,&index,&value,INSERT_VALUES);
     
    202294}
    203295/*}}}*/
    204 /*FUNCTION Node Configure {{{1*/
    205 void  Node::Configure(void* pnodes){
    206 
    207         DataSet* nodes=NULL;
    208 
    209         /*Recover pointers :*/
    210         nodes=(DataSet*)pnodes;
    211 
    212         /*Link this node with its upper node: */
    213         ResolvePointers((Object**)&upper_node,&upper_node_id,&upper_node_offset,1,nodes);
    214        
    215 }
    216 /*}}}*/
    217 /*FUNCTION Node copy {{{1*/
    218 Object* Node::copy() {
    219         return new Node(*this);
    220 }
    221 /*}}}*/
    222 /*FUNCTION Node CreatePartition{{{1*/
     296/*FUNCTION Node CreatePartition{{{2*/
    223297void  Node::CreatePartition(Vec partition){
    224298
     
    227301
    228302        idxm=(id-1);
    229         value=(double)doflist1[0];
     303        value=(double)this->GetVertexDof();
    230304        ISSMASSERT(value>=0);
    231305
     
    235309}
    236310/*}}}*/
    237 /*FUNCTION Node CreateVecSets {{{1*/
     311/*FUNCTION Node CreateVecSets {{{2*/
    238312void  Node::CreateVecSets(Vec pv_g,Vec pv_m,Vec pv_n,Vec pv_f,Vec pv_s){
    239313
     
    243317        int i;
    244318
    245         for(i=0;i<numberofdofs;i++){
     319        for(i=0;i<this->indexing.numberofdofs;i++){
    246320
    247321                /*g set: */
    248                 VecSetValues(pv_g,1,&doflist[i],&gvalue,INSERT_VALUES);
     322                VecSetValues(pv_g,1,&indexing.doflist[i],&gvalue,INSERT_VALUES);
    249323               
    250324                /*m set: */
    251                 value=(double)mset[i];
    252                 VecSetValues(pv_m,1,&doflist[i],&value,INSERT_VALUES);
     325                value=(double)this->indexing.m_set[i];
     326                VecSetValues(pv_m,1,&indexing.doflist[i],&value,INSERT_VALUES);
    253327
    254328                /*n set: */
    255                 value=(double)nset[i];
    256                 VecSetValues(pv_n,1,&doflist[i],&value,INSERT_VALUES);
     329                value=(double)this->indexing.n_set[i];
     330                VecSetValues(pv_n,1,&indexing.doflist[i],&value,INSERT_VALUES);
    257331
    258332                /*f set: */
    259                 value=(double)fset[i];
    260                 VecSetValues(pv_f,1,&doflist[i],&value,INSERT_VALUES);
     333                value=(double)this->indexing.f_set[i];
     334                VecSetValues(pv_f,1,&indexing.doflist[i],&value,INSERT_VALUES);
    261335
    262336                /*s set: */
    263                 value=(double)sset[i];
    264                 VecSetValues(pv_s,1,&doflist[i],&value,INSERT_VALUES);
    265 
    266         }
    267 
    268 
    269 }
    270 /*}}}*/
    271 /*FUNCTION Node DeepEcho{{{1*/
    272 void Node::DeepEcho(void){
    273 
    274         int i;
    275 
    276         printf("Node:\n");
    277         printf("   id: %i\n",id);
    278         printf("   partitionborder: %i\n",partitionborder);
    279         printf("   clone: %i\n",clone);
    280         printf("   numberofdofs: %i\n",numberofdofs);
    281         printf("   x=[%g,%g,%g]\n",x[0],x[1],x[2]);
    282         printf("   sigma=%g\n",sigma);
    283         printf("   onbed: %i\n",onbed);
    284         printf("   onsurface: %i\n",onsurface);
    285         printf("   onshelf: %i\n",onshelf);
    286         printf("   onsheet: %i\n",onsheet);
    287         printf("   upper_node_id=%i\n",upper_node_id);
    288         printf("   upper_node_offset=%i\n",upper_node_offset);
    289         printf("   doflist:|");
    290         for(i=0;i<numberofdofs;i++){
    291                 if(i>MAXDOFSPERNODE)break;
    292                 printf("%i|",doflist[i]);
    293         }
    294         printf("   doflist1:|");
    295         printf("%i|",doflist1[0]);
    296         printf("\n");
    297 
    298         printf("   set membership: m,n,f,s sets \n");
    299         for(i=0;i<numberofdofs;i++){
    300                 if(i>MAXDOFSPERNODE)break;
    301                 printf("      dof %i: %i %i %i %i\n",i,mset[i],nset[i],fset[i],sset[i]);
    302         }
    303         printf("\n");
    304         if(upper_node)printf("   upper_node pointer: %p\n",upper_node);
    305 
    306         return;
    307 }               
    308 /*}}}*/
    309 /*FUNCTION Node DistributeDofs{{{1*/
     337                value=(double)this->indexing.s_set[i];
     338                VecSetValues(pv_s,1,&indexing.doflist[i],&value,INSERT_VALUES);
     339
     340        }
     341
     342
     343}
     344/*}}}*/
     345/*FUNCTION Node DistributeDofs{{{2*/
    310346void  Node::DistributeDofs(int* pdofcount,int* pdofcount1){
    311347
     
    318354        dofcount1=*pdofcount1;
    319355       
    320         if(clone){
     356        if(indexing.clone){
    321357                /*This node is a clone! Don't distribute dofs, it will get them from another cpu!*/
    322358                return;
     
    324360
    325361        /*This node should distribute dofs, go ahead: */
    326         for(i=0;i<numberofdofs;i++){
    327                 doflist[i]=dofcount+i;
    328         }
    329         dofcount+=numberofdofs;
    330 
    331         doflist1[0]=dofcount1;
     362        for(i=0;i<this->indexing.numberofdofs;i++){
     363                indexing.doflist[i]=dofcount+i;
     364        }
     365        dofcount+=this->indexing.numberofdofs;
     366
     367        SetVertexDof(dofcount1);
    332368        dofcount1+=1;
    333369
     
    339375}
    340376/*}}}*/
    341 /*FUNCTION Node DofInMSet{{{1*/
     377/*FUNCTION Node DofInMSet{{{2*/
    342378void  Node::DofInMSet(int dof){
    343379
    344380        /*Put dof for this node into the m set (m set is for rigid body modes)*/
    345381
    346         mset[dof]=1; //m and n are mutually exclusive (m for rigid body modes)
    347         nset[dof]=0;
    348         fset[dof]=0; //n splits into f (for which we solve) and s (single point constraints)
    349         sset[dof]=0;
    350 }
    351 /*}}}*/
    352 /*FUNCTION Node DofInSSet {{{1*/
     382        this->indexing.m_set[dof]=1; //m and n are mutually exclusive (m for rigid body modes)
     383        this->indexing.n_set[dof]=0;
     384        this->indexing.f_set[dof]=0; //n splits into f (for which we solve) and s (single point constraints)
     385        this->indexing.s_set[dof]=0;
     386}
     387/*}}}*/
     388/*FUNCTION Node DofInSSet {{{2*/
    353389void  Node::DofInSSet(int dof){
    354390
     
    356392         * to a fixed value during computations. */
    357393
    358         mset[dof]=0; //m and n are mutually exclusive (m for rigid body modes)
    359         nset[dof]=1;
    360         fset[dof]=0; //n splits into f (for which we solve) and s (single point constraints)
    361         sset[dof]=1;
    362 }
    363 /*}}}*/
    364 /*FUNCTION Node DofIsInMSet{{{1*/
     394        this->indexing.m_set[dof]=0; //m and n are mutually exclusive (m for rigid body modes)
     395        this->indexing.n_set[dof]=1;
     396        this->indexing.f_set[dof]=0; //n splits into f (for which we solve) and s (single point constraints)
     397        this->indexing.s_set[dof]=1;
     398}
     399/*}}}*/
     400/*FUNCTION Node DofIsInMSet{{{2*/
    365401int  Node::DofIsInMSet(int dof){
    366402
    367         if (mset[dof])return 1;
     403        if (this->indexing.m_set[dof])return 1;
    368404        else return 0;
    369405
    370406}
    371407/*}}}*/
    372 /*FUNCTION Node Echo{{{1*/
    373 void Node::Echo(void){
    374 
    375         int i;
    376 
    377         printf("Node:\n");
    378         printf("   id: %i\n",id);
    379         printf("   partitionborder: %i\n",partitionborder);
    380         printf("   clone: %i\n",clone);
    381         printf("   numberofdofs: %i\n",numberofdofs);
    382         printf("   x=[%g,%g,%g]\n",x[0],x[1],x[2]);
    383         printf("   sigma=%g\n",sigma);
    384         printf("   onbed: %i\n",onbed);
    385         printf("   onsurface: %i\n",onsurface);
    386         printf("   onshelf: %i\n",onshelf);
    387         printf("   onsheet: %i\n",onsheet);
    388         printf("   upper_node_id=%i\n",upper_node_id);
    389         printf("   upper_node_offset=%i\n",upper_node_offset);
    390         printf("   doflist:|");
    391         for(i=0;i<numberofdofs;i++){
    392                 if(i>MAXDOFSPERNODE)break;
    393                 printf("%i|",doflist[i]);
    394         }
    395         printf("   doflist1:|");
    396         printf("%i|",doflist1[0]);
    397         printf("\n");
    398 
    399         printf("   set membership: m,n,f,s sets \n");
    400         for(i=0;i<numberofdofs;i++){
    401                 if(i>MAXDOFSPERNODE)break;
    402                 printf("      dof %i: %i %i %i %i\n",i,mset[i],nset[i],fset[i],sset[i]);
    403         }
    404         printf("\n");
    405         if(upper_node)printf("   upper_node pointer: %p\n",upper_node);
    406 
    407         return;
    408 }
    409 /*}}}*/
    410 /*FUNCTION Node Enum{{{1*/
    411 int Node::Enum(void){
    412 
    413         return NodeEnum();
    414 
    415 }
    416 /*}}}*/
    417 /*FUNCTION Node FieldAverageOntoVertices{{{1*/
     408/*FUNCTION Node FieldAverageOntoVertices{{{2*/
    418409void  Node::FieldAverageOntoVertices(Vec field,double* field_serial,char* fieldname){
    419410
     
    421412}
    422413/*}}}*/
    423 /*FUNCTION Node FieldDepthAverageAtBase{{{1*/
     414/*FUNCTION Node FieldDepthAverageAtBase{{{2*/
    424415void  Node::FieldDepthAverageAtBase(Vec field,double* field_serial,char* fieldname){
    425416
    426417        /* node data: */
    427         int          doflist1;
     418        int          vertexdof;
    428419        int          dofx,dofy;
    429420        int          isnodeonsurface;
     
    436427        /*Are we on the base, not on the surface, and not on a clone node?:*/
    437428       
    438         if(onbed==1 & clone==0 &onsurface==0){
     429        if(properties.onbed==1 & indexing.clone==0 &properties.onsurface==0){
    439430                       
    440                 doflist1=GetDofList1();
     431                vertexdof=this->GetVertexDof();
    441432
    442433                /*this node is on the bed. We are going to, follow the upper nodes until we reach the surface. At each upper node,
     
    456447
    457448                        /*get dofs for this base node velocity: we know there are two dofs in field_serial */
    458                         dofx=2*doflist1;
    459                         dofy=2*doflist1+1;
     449                        dofx=2*vertexdof;
     450                        dofy=2*vertexdof+1;
    460451
    461452                        node=this;
     
    464455                                if (node->IsOnSurface())break;
    465456
    466                                 doflist1=node->GetDofList1();
     457                                vertexdof=node->GetVertexDof();
    467458                               
    468                                 velocity1[0]=field_serial[2*doflist1];
    469                                 velocity1[1]=field_serial[2*doflist1+1];
     459                                velocity1[0]=field_serial[2*vertexdof];
     460                                velocity1[1]=field_serial[2*vertexdof+1];
    470461                                z1=node->GetZ();
    471462
    472463                                upper_node=node->GetUpperNode();
    473                                 doflist1=upper_node->GetDofList1();
     464                                vertexdof=upper_node->GetVertexDof();
    474465                       
    475                                 velocity2[0]=field_serial[2*doflist1];
    476                                 velocity2[1]=field_serial[2*doflist1+1];
     466                                velocity2[0]=field_serial[2*vertexdof];
     467                                velocity2[1]=field_serial[2*vertexdof+1];
    477468                                z2=upper_node->GetZ();
    478469
     
    507498
    508499                        /*get dofs for this base node velocity: we know there are two dofs in field_serial */
    509                         dofx=doflist1;
     500                        dofx=vertexdof;
    510501
    511502                        node=this;
     
    514505                                if (node->IsOnSurface())break;
    515506
    516                                 doflist1=node->GetDofList1();
     507                                vertexdof=node->GetVertexDof();
    517508                               
    518                                 field1=field_serial[doflist1];
     509                                field1=field_serial[vertexdof];
    519510                                z1=node->GetZ();
    520511
    521512                                upper_node=node->GetUpperNode();
    522                                 doflist1=upper_node->GetDofList1();
     513                                vertexdof=upper_node->GetVertexDof();
    523514                       
    524                                 field2=field_serial[doflist1];
     515                                field2=field_serial[vertexdof];
    525516                                z2=upper_node->GetZ();
    526517
     
    543534}
    544535/*}}}*/
    545 /*FUNCTION Node FieldExtrude {{{1*/
     536/*FUNCTION Node FieldExtrude {{{2*/
    546537void  Node::FieldExtrude(Vec field,double* field_serial,char* field_name){
    547538               
     
    552543
    553544        /*Is this node on bed? :*/
    554         if (onbed){
     545        if (properties.onbed){
    555546
    556547                if (strcmp(field_name,"velocity")==0){
    557548
    558549                        /* node data: */
    559                         int          doflist1;
     550                        int          vertexdof;
    560551                        int          doflist[2];
    561552                        double       fieldnode[2];
    562553
    563                         doflist1=GetDofList1();
     554                        vertexdof=GetVertexDof();
    564555
    565556                        /*get dofs for this base node velocity: we know there are two dofs in field_serial */
    566                         doflist[0]=2*doflist1;
    567                         doflist[1]=2*doflist1+1;
     557                        doflist[0]=2*vertexdof;
     558                        doflist[1]=2*vertexdof+1;
    568559
    569560                        //initilaize node
     
    578569                        for(;;){
    579570
    580                                 doflist1=node->GetDofList1();
    581                                 doflist[0]=2*doflist1;
    582                                 doflist[1]=2*doflist1+1;
     571                                vertexdof=node->GetVertexDof();
     572                                doflist[0]=2*vertexdof;
     573                                doflist[1]=2*vertexdof+1;
    583574                                VecSetValues(field,1,&doflist[0],&fieldnode[0],INSERT_VALUES);
    584575                                VecSetValues(field,1,&doflist[1],&fieldnode[1],INSERT_VALUES);
     
    597588                        //initilaize node and get dof1
    598589                        node=this;
    599                         dof1=node->GetDofList1();
     590                        dof1=node->GetVertexDof();
    600591
    601592                        /*get field for this base node: */
     
    606597                        for(;;){
    607598
    608                                 dof1=node->GetDofList1();
     599                                dof1=node->GetVertexDof();
    609600                                VecSetValues(field,1,&dof1,&fieldel,INSERT_VALUES);
    610601
     
    655646}
    656647/*}}}*/
    657 /*FUNCTION Node FreezeDof{{{1*/
     648/*FUNCTION Node FreezeDof{{{2*/
    658649void  Node::FreezeDof(int dof){
    659650       
     
    662653}
    663654/*}}}*/
    664 /*FUNCTION Node GetDof {{{1*/
     655/*FUNCTION Node GetDof {{{2*/
    665656int   Node::GetDof(int dofindex){
    666657
    667         return doflist[dofindex];
    668 
    669 }
    670 /*}}}*/
    671 /*FUNCTION Node GetDofList{{{1*/
     658        return indexing.doflist[dofindex];
     659
     660}
     661/*}}}*/
     662/*FUNCTION Node GetDofList{{{2*/
    672663void  Node::GetDofList(int* outdoflist,int* pnumberofdofspernode){
    673664
    674665        int i;
    675         for(i=0;i<numberofdofs;i++){
    676                 outdoflist[i]=doflist[i];
     666        for(i=0;i<this->indexing.numberofdofs;i++){
     667                outdoflist[i]=indexing.doflist[i];
    677668        }
    678669        /*Assign output pointers:*/
    679         *pnumberofdofspernode=numberofdofs;
    680 }
    681 /*}}}*/
    682 /*FUNCTION Node GetDOfList1{{{1*/
    683 int   Node::GetDofList1(void){
    684         return doflist1[0];
    685 }
    686 /*}}}*/
    687 /*FUNCTION Node GetNumberOfDofs{{{1*/
     670        *pnumberofdofspernode=this->indexing.numberofdofs;
     671}
     672/*}}}*/
     673/*FUNCTION Node GetNumberOfDofs{{{2*/
    688674int   Node::GetNumberOfDofs(){
    689675       
    690         return numberofdofs;
    691 
    692 }
    693 /*}}}*/
    694 /*FUNCTION Node GetSigma {{{1*/
    695 double Node::GetSigma(){return sigma;}
    696 /*}}}*/
    697 /*FUNCTION Node GetUpperNode {{{1*/
     676        return this->indexing.numberofdofs;
     677
     678}
     679/*}}}*/
     680/*FUNCTION Node GetSigma {{{2*/
     681double Node::GetSigma(){
     682        Vertex* vertex=NULL;
     683
     684        vertex=(Vertex*)hvertex.delivers();
     685        return vertex->sigma;
     686}
     687/*}}}*/
     688/*FUNCTION Node GetUpperNode {{{2*/
    698689Node* Node::GetUpperNode(){
     690        Node* upper_node=NULL;
     691        upper_node=(Node*)hupper_node.delivers();
    699692        return upper_node;
    700693}
    701694/*}}}*/
    702 /*FUNCTION Node GetX {{{1*/
    703 double Node::GetX(){return x[0];}
    704 /*}}}*/
    705 /*FUNCTION Node GetY {{{1*/
    706 double Node::GetY(){return x[1];}
    707 /*}}}*/
    708 /*FUNCTION Node GetZ {{{1*/
    709 double Node::GetZ(){return x[2];}
    710 /*}}}*/
    711 /*FUNCTION Node IsClone {{{1*/
     695/*FUNCTION Node GetX {{{2*/
     696double Node::GetX(){
     697        Vertex* vertex=NULL;
     698
     699        vertex=(Vertex*)hvertex.delivers();
     700        return vertex->x;
     701}
     702/*}}}*/
     703/*FUNCTION Node GetY {{{2*/
     704double Node::GetY(){
     705        Vertex* vertex=NULL;
     706
     707        vertex=(Vertex*)hvertex.delivers();
     708        return vertex->y;
     709}
     710/*}}}*/
     711/*FUNCTION Node GetZ {{{2*/
     712double Node::GetZ(){
     713        Vertex* vertex=NULL;
     714
     715        vertex=(Vertex*)hvertex.delivers();
     716        return vertex->z;
     717}
     718/*}}}*/
     719/*FUNCTION Node IsClone {{{2*/
    712720int   Node::IsClone(){
    713721       
    714         return clone;
    715 
    716 }
    717 /*}}}*/
    718 /*FUNCTION Node IsOnBed {{{1*/
     722        return indexing.clone;
     723
     724}
     725/*}}}*/
     726/*FUNCTION Node IsOnBed {{{2*/
    719727int   Node::IsOnBed(){
    720         return onbed;
    721 }
    722 /*}}}*/
    723 /*FUNCTION Node IsOnSheet {{{1*/
     728        return properties.onbed;
     729}
     730/*}}}*/
     731/*FUNCTION Node IsOnSheet {{{2*/
    724732int   Node::IsOnSheet(){
    725         return onsheet;
     733        return properties.onsheet;
    726734}               
    727735/*}}}*/
    728 /*FUNCTION Node IsOnShelf {{{1*/
     736/*FUNCTION Node IsOnShelf {{{2*/
    729737int   Node::IsOnShelf(){
    730         return onshelf;
    731 }
    732 /*}}}*/
    733 /*FUNCTION Node IsOnSurface {{{1*/
     738        return properties.onshelf;
     739}
     740/*}}}*/
     741/*FUNCTION Node IsOnSurface {{{2*/
    734742int   Node::IsOnSurface(){
    735         return onsurface;
    736 }
    737 /*}}}*/
    738 /*FUNCTION Node MyRank{{{1*/
     743        return properties.onsurface;
     744}
     745/*}}}*/
     746/*FUNCTION Node MyRank{{{2*/
    739747int    Node::MyRank(void){
    740748        extern int my_rank;
     
    743751}
    744752/*}}}*/
    745 /*FUNCTION Node SetClone {{{1*/
     753/*FUNCTION Node SetClone {{{2*/
    746754void  Node::SetClone(int* minranks){
    747755
     
    749757
    750758        if (minranks[id-1]==my_rank){
    751                 clone=0;
     759                indexing.clone=0;
    752760        }
    753761        else{
    754762                /*!there is a cpu with lower rank that has the same node,
    755763                therefore, I am a clone*/
    756                 clone=1;       
    757         }
    758 
    759 }
    760 /*}}}*/
    761 /*FUNCTION Node ShowBorderDofs{{{1*/
     764                indexing.clone=1;       
     765        }
     766
     767}
     768/*}}}*/
     769/*FUNCTION Node ShowBorderDofs{{{2*/
    762770void  Node::ShowBorderDofs(int* borderdofs,int* borderdofs1){
    763771
     
    766774       
    767775        /*Is this node on the partition border? */
    768         if(!partitionborder)return;
     776        if(!indexing.partitionborder)return;
    769777
    770778        /*Are we the cpu that created this node's dof list? */
    771         if(clone)return;
     779        if(indexing.clone)return;
    772780
    773781        /*Ok, we are on the partition border, and we did create the
    774782         * dofs for this node, plug the doflist into borderdofs: */
    775         for(j=0;j<numberofdofs;j++){
    776                 *(borderdofs+numberofdofs*(id-1)+j)=doflist[j];
    777         }
    778         *(borderdofs1+(id-1)+0)=doflist1[0];
     783        for(j=0;j<this->indexing.numberofdofs;j++){
     784                *(borderdofs+this->indexing.numberofdofs*(id-1)+j)=indexing.doflist[j];
     785        }
     786        *(borderdofs1+(id-1)+0)=this->GetVertexDof();
    779787
    780788        return;
    781789}
    782790/*}}}*/
    783 /*FUNCTION Node UpdateBorderDofs{{{1*/
     791/*FUNCTION Node UpdateBorderDofs{{{2*/
    784792void  Node::UpdateBorderDofs(int* allborderdofs,int* allborderdofs1){
    785793
     
    788796       
    789797        /*Is this node on the partition border? */
    790         if(!partitionborder)return;
     798        if(!indexing.partitionborder)return;
    791799       
    792800        /*Are we the cpu that created this node's dof list? */
    793         if(clone==0)return;
     801        if(indexing.clone==0)return;
    794802
    795803        /*Ok, we are on the partition border, but we did not create
    796804         * the dofs for this node. Therefore, our doflist is garbage right
    797805         * now. Go pick it up in the allborderdofs: */
    798         for(j=0;j<numberofdofs;j++){
    799                 doflist[j]=*(allborderdofs+numberofdofs*(id-1)+j);
    800         }
    801         doflist1[0]=*(allborderdofs1+(id-1)+0);
     806        for(j=0;j<this->indexing.numberofdofs;j++){
     807                indexing.doflist[j]=*(allborderdofs+this->indexing.numberofdofs*(id-1)+j);
     808        }
     809        this->SetVertexDof(*(allborderdofs1+(id-1)+0));
    802810        return;
    803811}
    804812/*}}}*/
    805 /*FUNCTION Node UpdateDofs{{{1*/
     813/*FUNCTION Node UpdateDofs{{{2*/
    806814void  Node::UpdateDofs(int dofcount,int dofcount1){
    807815       
     
    809817        extern int my_rank;
    810818       
    811         if(clone){
     819        if(indexing.clone){
    812820                /*This node is a clone, don't update the dofs!: */
    813821                return;
     
    815823
    816824        /*This node should update the dofs, go ahead: */
    817         for(i=0;i<numberofdofs;i++){
    818                 doflist[i]+=dofcount;
    819         }
    820         doflist1[0]+=dofcount1;
     825        for(i=0;i<this->indexing.numberofdofs;i++){
     826                indexing.doflist[i]+=dofcount;
     827        }
     828        this->SetVertexDof(this->GetVertexDof()+dofcount1);
    821829
    822830        return;
    823831}
    824832/*}}}*/
    825 /*FUNCTION Node UpdateFromInputs {{{1*/
     833/*FUNCTION Node UpdateFromInputs {{{2*/
    826834void  Node::UpdateFromInputs(void* vinputs){
    827        
    828         ParameterInputs* inputs=NULL;
    829         Node* node=this;
    830         int dof[1]={0};
    831 
    832         /*Recover parameter inputs: */
    833         inputs=(ParameterInputs*)vinputs;
    834 
    835         /*Update internal data if inputs holds new values: */
    836         inputs->Recover("x",&x[0],1,dof,1,(void**)&node);
    837         inputs->Recover("y",&x[1],1,dof,1,(void**)&node);
    838         inputs->Recover("z",&x[2],1,dof,1,(void**)&node);
    839 
    840        
    841 }
    842 /*}}}*/
    843 /*FUNCTION Node UpdateNodePosition {{{1*/
    844 void  Node::UpdateNodePosition(double* thickness,double* bed){
    845 
    846         int dof;
    847 
    848         dof=this->GetDofList1();
    849 
    850         /*sigma remains constant. z=bed+sigma*thickness*/
    851         this->x[2]=bed[dof]+sigma*thickness[dof];
    852 
    853 }
    854 /*}}}*/
     835
     836        ISSMERROR("not used yet!");
     837       
     838}
     839/*}}}*/
     840/*}}}*/
  • issm/trunk/src/c/objects/Node.h

    r3390 r3417  
    66#define _NODE_H_
    77
     8/*indefinitions: */
     9class Object;
     10class Vertex;
     11class Hook;
     12
    813#include "./Object.h"
     14#include "../DataSet/DataSet.h"
     15#include "./Hook.h"
     16#include "./Vertex.h"
     17#include "./DofIndexing.h"
     18#include "./NodeProperties.h"
    919#include "../toolkits/toolkits.h"
    10 
    11 #define MAXDOFSPERNODE 4
    12 #define PSSTRINGLENGTH 20
    1320
    1421class Node: public Object{
    1522
    1623        private:
    17                 /*raw data coming from the model processor: */
    18                 int         id; /*! id, to track it*/
    19                 int     partitionborder; /*! during parallel partitioning, does this grid belong to a partition border?*/
    20                 int     numberofdofs; //real number of dofs, between 0 and MAXDOFSPERNODE
    21                 int     clone;  /*!this nodes is one the partition border, and is cloned*/
    22                 double  x[3]; /*! coordinates*/
    23                 double  sigma; /*! sigma = (z-bed)/thickness*/
     24
     25                int         id;
     26                               
     27                DofIndexing    indexing;
     28                NodeProperties properties;
     29                Hook           hvertex;
     30                Hook           hupper_node;
     31
    2432               
    25                 int         onbed; /*! for 3d, on bedrock*/
    26                 int         onsurface; /*! for 3d, on surface*/
    27                 int         onshelf;
    28                 int         onsheet;
    29 
    30                 /*for dof constraining: */
    31                 int     mset[MAXDOFSPERNODE];
    32                 int     nset[MAXDOFSPERNODE];
    33                 int     fset[MAXDOFSPERNODE];
    34                 int     sset[MAXDOFSPERNODE];
    35 
    36                 int   upper_node_id;
    37                 Node* upper_node;
    38                 int   upper_node_offset;
    39 
    40                 /*data that is post processed : */
    41                 int doflist[MAXDOFSPERNODE]; //dof list on which we solve
    42                 int doflist1[1]; //1d dof list to recover input parameters
    43 
    4433        public:
    4534
     35                /*FUNCTION constructors, destructors {{{1*/
    4636                Node();
    47                 Node(int node_id,int node_partitionborder,int node_numdofs, double node_x[3],double sigma,int node_onbed,int node_onsurface,int upper_node_id,int onshelf,int onsheet);
     37                Node(int id,int vertex_id, int upper_node_id, int partitionborder,int numberofdofs, NodeProperties* node_properties);
     38                Node(int id,DofIndexing* indexing, NodeProperties* properties, Hook* vertex, Hook* upper_node);
     39                Node(int i, IoModel* iomodel);
    4840                ~Node();
    49 
     41                /*}}}*/
     42                /*FUNCTION object management {{{1*/
     43                void  Configure(void* pnodes, void* pvertices);
     44                void  DeepEcho();
     45                void  Demarshall(char** pmarshalled_dataset);
    5046                void  Echo();
    51                 void  DeepEcho();
     47                int   Enum();
     48                int   GetId(void);
     49                char* GetName();
     50                int   GetVertexDof(void);
    5251                void  Marshall(char** pmarshalled_dataset);
    5352                int   MarshallSize();
    54                 char* GetName();
    55                 void  Demarshall(char** pmarshalled_dataset);
    56                 int   Enum();
    57                 int   GetId(void);
    5853                int   MyRank(void);
     54                void  SetVertexDof(int in_dof);
     55                /*}}}*/
     56                /*FUNCTION numerical routines {{{1*/
    5957                void  DistributeDofs(int* pdofcount,int* pdofcount1);
    6058                void  UpdateDofs(int dofcount,int dofcount1);
     
    7977                Object* copy();
    8078                void  UpdateFromInputs(void* inputs);
    81                 void  Configure(void* pnodes);
    8279                Node* GetUpperNode();
    8380                int   IsOnBed();
     
    9087                void  FieldExtrude(Vec field,double* field_serial,char* field_name);
    9188                void  UpdateNodePosition(double* thickness,double* bed);
     89                /*}}}*/
    9290};
    9391
    9492#endif  /* _NODE_H_ */
    95 
  • issm/trunk/src/c/objects/Penta.cpp

    r3401 r3417  
    5151
    5252        return;
     53}
     54/*}}}*/
     55/*FUNCTION Penta other constructor {{{1*/
     56Penta::Penta(int i, IoModel* iomodel){ //i is the element index
     57
     58        int j;
     59        int offset;
     60        int penta_node_ids[6];
     61        double penta_h[6];
     62        double penta_s[6];
     63        double penta_b[6];
     64        double penta_k[6];
     65        double penta_melting[6];
     66        double penta_accumulation[6];
     67
     68        /*id: */
     69        this->id=i+1;
     70
     71        /*hooks: */
     72        for(j=0;j<6;j++){ //go recover node ids, needed to initialize the node hook.
     73                penta_node_ids[j]=(int)*(iomodel->elements+6*i+j); //ids for vertices are in the elements array from Matlab
     74        }
     75        penta_matice_id=i+1; //refers to the corresponding ice material object
     76        penta_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object
     77        penta_numpar_id=1; //refers to numerical parameters object
     78
     79        this->hnodes->Init(penta_node_ids,6);
     80        this->hmatice->Init(penta_matice_id,1);
     81        this->hmatpar->Init(penta_matpar_id,1);
     82        this->hnumpar->Init(penta_numpar_id,1);
     83
     84        /*properties: */
     85        for(j=0;j<6;j++){
     86
     87                offset=(int)*(iomodel->elements+6*i+j)-1; //get index of this vertex, in C numbering.
     88                penta_h[j]= *(iomodel->thickness+offset);
     89                penta_s[j]= *(iomodel->surface+offset);
     90                penta_b[j]=*(iomodel->bed+offset);
     91                penta_k[j]=*(iomodel->drag+offset);
     92                penta_melting[j]=*(iomodel->melting+offset);
     93                penta_accumulation[j]=*(iomodel->accumulation+offset);
     94        }
     95        penta_friction_type=(int)iomodel->drag_type;
     96        penta_p=iomodel->p[i];
     97        penta_q=iomodel->q[i];
     98        penta_shelf=(int)*(iomodel->elementoniceshelf+i);
     99        penta_onwater=(bool)*(iomodel->elementonwater+i);
     100        penta_onsurface=(int)*(iomodel->elementonsurface+i);
     101        penta_onwater=(bool)*(iomodel->elementonwater+i);
     102
     103        if (*(iomodel->elements_type+2*i+0)==macayealformulationenum()){ //elements of type 3 are macayeal type penta. we collapse the formulation on their base.
     104                penta_collapse=1;
     105        }
     106        else{
     107                penta_collapse=0;
     108        }
     109
     110        this->properties->Init(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);
     111
     112
    53113}
    54114/*}}}*/
  • issm/trunk/src/c/objects/Penta.h

    r3389 r3417  
    1111#include "./Numpar.h"
    1212#include "./Matice.h"
    13 #include "./Node.h"
    1413#include "./Tria.h"
    1514#include "./Hook.h"
    1615#include "./ElementProperties.h"
    1716#include "./ParameterInputs.h"
     17#include "./Node.h"
    1818
    19 class Numpar;
     19class Object;
    2020class Node;
    21 class Matice;
    22 class Matpar;
    23 class  ElementProperties;
     21class Hook;
     22class ElementProperties;
     23class DataSet;
    2424
    2525class Penta: public Element{
     
    4141                Penta(int penta_id,int* penta_node_ids, int penta_matice_id, int penta_matpar_id, int penta_numpar_id, ElementProperties* properties);
    4242                Penta(int penta_id,Hook* penta_hnodes, Hook* penta_hmatice, Hook* penta_hmatpar, Hook* penta_hnumpar, ElementProperties* penta_properties);
     43                Penta(int i, IoModel* iomodel);
    4344                ~Penta();
    4445                /*}}}*/
  • issm/trunk/src/c/objects/Tria.cpp

    r3399 r3417  
    5959
    6060        return;
     61}
     62/*}}}*/
     63/*FUNCTION Tria constructor  from iomodel{{{1*/
     64Tria::Tria(int i, IoModel* iomodel){ //i is the element index
     65
     66        int j;
     67        int offset;
     68        int tria_node_ids[3];
     69        double tria_h[3];
     70        double tria_s[3];
     71        double tria_b[3];
     72        double tria_k[3];
     73        double tria_melting[3];
     74        double tria_accumulation[3];
     75
     76        /*id: */
     77        this->id=i+1;
     78
     79        /*hooks: */
     80        for(j=0;j<3;j++){ //go recover node ids, needed to initialize the node hook.
     81                tria_node_ids[j]=(int)*(iomodel->elements+3*i+j); //ids for vertices are in the elements array from Matlab
     82        }
     83        tria_matice_id=i+1; //refers to the corresponding ice material object
     84        tria_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object
     85        tria_numpar_id=1; //refers to numerical parameters object
     86
     87        this->hnodes->Init(tria_node_ids,3);
     88        this->hmatice->Init(tria_matice_id,1);
     89        this->hmatpar->Init(tria_matpar_id,1);
     90        this->hnumpar->Init(tria_numpar_id,1);
     91
     92        /*properties: */
     93        for(j=0;j<3;j++){
     94
     95                offset=(int)*(iomodel->elements+3*i+j)-1; //get index of this vertex, in C numbering.
     96                tria_h[j]= *(iomodel->thickness+offset);
     97                tria_s[j]= *(iomodel->surface+offset);
     98                tria_b[j]=*(iomodel->bed+offset);
     99                tria_k[j]=*(iomodel->drag+offset);
     100                tria_melting[j]=*(iomodel->melting+offset);
     101                tria_accumulation[j]=*(iomodel->accumulation+offset);
     102        }
     103        tria_friction_type=(int)iomodel->drag_type;
     104        tria_p=iomodel->p[i];
     105        tria_q=iomodel->q[i];
     106        tria_shelf=(int)*(iomodel->elementoniceshelf+i);
     107        tria_onwater=(bool)*(iomodel->elementonwater+i);
     108       
     109        this->properties->Init(3,tria_h, tria_s, tria_b, tria_k, tria_melting, tria_accumulation, NULL,
     110                        tria_friction_type, tria_p, tria_q, tria_shelf, UNDEF,tria_onwater, UNDEF,UNDEF,UNDEF);
     111
     112
    61113}
    62114/*}}}*/
  • issm/trunk/src/c/objects/Tria.h

    r3402 r3417  
    77
    88
     9#include "./Object.h"
    910#include "./Element.h"
     11#include "./Hook.h"
     12#include "./Node.h"
     13#include "./ElementProperties.h"
    1014#include "../DataSet/DataSet.h"
    11 #include "./Object.h"
    12 #include "./Node.h"
    13 #include "./Matice.h"
    14 #include "./Matpar.h"
    15 #include "./Numpar.h"
    16 #include "./ParameterInputs.h"
    17 #include "./ElementProperties.h"
    18 #include "./Hook.h"
    1915
    2016class Object;
     17class Element;
     18class Hook;
     19class ElementProperties;
     20class DataSet;
     21class Node;
    2122
    2223class Tria: public Element{
     
    3940                Tria(int tria_id,int* tria_node_ids, int tria_matice_id, int tria_matpar_id, int tria_numpar_id, ElementProperties* tria_properties);
    4041                Tria(int tria_id,Hook* tria_hnodes, Hook* tria_hmatice, Hook* tria_hmatpar, Hook* tria_hnumpar, ElementProperties* tria_properties);
     42                Tria(int i, IoModel* iomodel);
    4143                ~Tria();
    4244                /*}}}*/
  • issm/trunk/src/c/objects/Vertex.cpp

    r3390 r3417  
    33 */
    44
     5/*Include files: {{{1*/
    56#ifdef HAVE_CONFIG_H
    67        #include "config.h"
     
    1617#include "../include/typedefs.h"
    1718#include "../include/macros.h"
     19/*}}}*/
    1820
    1921/*Object constructors and destructor*/
     
    2426/*}}}*/
    2527/*FUNCTION Vertex constructor {{{1*/
    26 Vertex::Vertex(int tria_id, double tria_x, double tria_y, double tria_z){
     28Vertex::Vertex(int tria_id, double tria_x, double tria_y, double tria_z, double tria_sigma, int partitionborder){
     29        this->Init(tria_id, tria_x, tria_y, tria_z, tria_sigma, partitionborder);
     30}
     31/*}}}*/
     32/*FUNCTION Vertex init, used by constructor {{{1*/
     33Vertex::Init(int tria_id, double tria_x, double tria_y, double tria_z, double tria_sigma, int partitionborder){
    2734
    2835        /*all the initialization has been done by the initializer, just fill in the id: */
     
    3138        this->y=tria_y;
    3239        this->z=tria_z;
    33 
    34         return;
     40        this->sigma=tria_sigma;
     41        this->dof=UNDEF;
     42
     43        return;
     44}
     45/*}}}*/
     46/*FUNCTION Vertex constructor  from iomodel{{{1*/
     47Vertex::Vertex(int i, IoModel* iomodel){
     48
     49        int partitionborder;
     50
     51        /*is this vertex on a partition border? */
     52        if(my_bordervertices[i])partitionborder=1;
     53        else partitionborder=0;
     54
     55        this->Init(i+1, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]),partitionborder);
     56
    3557}
    3658/*}}}*/
     
    7193        memcpy(&y,marshalled_dataset,sizeof(y));marshalled_dataset+=sizeof(y);
    7294        memcpy(&z,marshalled_dataset,sizeof(z));marshalled_dataset+=sizeof(z);
     95        memcpy(&sigma,marshalled_dataset,sizeof(sigma));marshalled_dataset+=sizeof(sigma);
     96        memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
     97        memcpy(&partitionborder,marshalled_dataset,sizeof(partitionborder));marshalled_dataset+=sizeof(partitionborder);
     98        memcpy(&clone,marshalled_dataset,sizeof(clone));marshalled_dataset+=sizeof(clone);
    7399
    74100        /*return: */
     
    86112        printf("   y: %g\n",y);
    87113        printf("   z: %g\n",z);
     114        printf("   sigma: %g\n",sigma);
     115        printf("   dof: %g\n",dof);
     116        printf("   partitionborder: %g\n",partitionborder);
     117        printf("   clone: %g\n",clone);
    88118
    89119        return;
     
    125155        memcpy(marshalled_dataset,&y,sizeof(y));marshalled_dataset+=sizeof(y);
    126156        memcpy(marshalled_dataset,&z,sizeof(z));marshalled_dataset+=sizeof(z);
     157        memcpy(marshalled_dataset,&sigma,sizeof(sigma));marshalled_dataset+=sizeof(sigma);
     158        memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
     159        memcpy(marshalled_dataset,&partitionborder,sizeof(partitionborder));marshalled_dataset+=sizeof(partitionborder);
     160        memcpy(marshalled_dataset,&clone,sizeof(clone));marshalled_dataset+=sizeof(clone);
    127161
    128162        *pmarshalled_dataset=marshalled_dataset;
     
    137171                sizeof(y)+
    138172                sizeof(z)+
     173                sizeof(sigma)+
     174                sizeof(dof)+
     175                sizeof(partitionborder)+
     176                sizeof(clone)+
    139177                +sizeof(int); //sizeof(int) for enum type
    140178}
     
    155193/*FUNCTION UpdateFromInputs {{{1*/
    156194void  Vertex::UpdateFromInputs(void* vinputs){
    157 
     195       
     196        ParameterInputs* inputs=NULL;
     197        Vertex* vertex=NULL;
     198        int dof[1]={0};
     199        double coord[3];
     200
     201        vertex=this;
     202
     203        coord[0]=this->x; coord[1]=this->y; coord[2]=this->z;
     204
     205        /*Recover parameter inputs: */
     206        inputs=(ParameterInputs*)vinputs;
     207
     208        /*Update internal data if inputs holds new values: */
     209        inputs->Recover("x",&coord[0],1,dof,1,(void**)&vertex);
     210        inputs->Recover("y",&coord[1],1,dof,1,(void**)&vertex);
     211        inputs->Recover("z",&coord[2],1,dof,1,(void**)&vertex);
     212       
    158213        ISSMERROR("not supported yet!");
    159214       
    160215}
    161216/*}}}*/
     217/*FUNCTION UpdateVertexPosition {{{1*/
     218void  Vertex::UpdatePosition(double* thickness,double* bed){
     219
     220        /*sigma remains constant. z=bed+sigma*thickness*/
     221        this->z=bed[dof]+sigma*thickness[this->dof];
     222
     223}
     224/*}}}*/
  • issm/trunk/src/c/objects/Vertex.h

    r3390 r3417  
    1010class Vertex: public Object{
    1111
    12         private:
     12        public:
    1313
    1414                int  id;
     
    1616                double y;
    1717                double z;
     18                double sigma; //sigma coordinate: (z-bed)/thickness
    1819
    19         public:
     20                /*dof management: */
     21                int    partitionborder;
     22                int    clone;
     23                int    dof; //dof to recover values in a vertex indexed vector
    2024
    2125                /*FUNCTION constructors, destructors {{{1*/
    2226                Vertex();
    23                 Vertex(int id, double x, double y, double z);
     27                Vertex(int id, double x, double y, double z, double sigma,int partitionborder);
     28                Init(int id, double x, double y, double z, double sigma,int partitionborder);
     29                Vertex(int i, IoModel* iomodel);
    2430                ~Vertex();
    2531                /*}}}*/
     
    3743                void  UpdateFromDakota(void* vinputs);
    3844                void  UpdateFromInputs(void* vinputs);
     45                void  UpdatePosition(double* thickness,double* bed);
     46
     47
    3948                /*}}}*/
    4049
  • issm/trunk/src/m/enum/BeamEnum.m

    r1714 r3417  
    77%      macro=BeamEnum()
    88
    9 macro=415;
     9macro=416;
  • issm/trunk/src/m/enum/NodeEnum.m

    r1714 r3417  
    77%      macro=NodeEnum()
    88
    9 macro=420;
     9macro=421;
  • issm/trunk/src/m/enum/PentaEnum.m

    r3383 r3417  
    77%      macro=PentaEnum()
    88
    9 macro=413;
     9macro=414;
  • issm/trunk/src/m/enum/SingEnum.m

    r1714 r3417  
    77%      macro=SingEnum()
    88
    9 macro=414;
     9macro=415;
  • issm/trunk/src/m/solutions/jpl/CreateFemModel.m

    r2333 r3417  
    99       
    1010        displaystring(md.verbose,'\n   reading data from model %s...',md.name);
    11         [m.elements,m.nodes,m.constraints,m.loads,m.materials,m.parameters]=ModelProcessor(md);
     11        [m.elements,m.nodes,m.vertices,m.constraints,m.loads,m.materials,m.parameters]=ModelProcessor(md);
    1212
    1313        displaystring(md.verbose,'%s','   generating degrees of freedom...');
    14         [m.nodes,m.part,m.tpart]=Dof(m.elements,m.nodes,m.parameters);
     14        [m.nodes,m.vertices,m.part,m.tpart]=Dof(m.elements,m.nodes,m.vertices, m.parameters);
    1515
    1616        displaystring(md.verbose,'%s','   generating single point constraints...');
     
    3030
    3131        displaystring(md.verbose,'%s','   configuring element and loads...');
    32         [m.elements,m.loads,m.nodes,m.parameters] = ConfigureObjects( m.elements, m.loads, m.nodes, m.materials,m.parameters);
     32        [m.elements,m.loads,m.nodes,m.vertices,m.parameters] = ConfigureObjects( m.elements, m.loads, m.nodes, m.materials,m.parameters);
    3333
    3434        displaystring(md.verbose,'%s','   processing parameters...');
  • issm/trunk/src/mex/Dof/Dof.cpp

    r2333 r3417  
    1212        /*input datasets: */
    1313        DataSet* nodes=NULL;
     14        DataSet* vertices=NULL;
    1415        DataSet* elements=NULL;
    1516        DataSet* params=NULL;
     
    2829        FetchData(&elements,ELEMENTS);
    2930        FetchData(&nodes,NODESIN);
     31        FetchData(&vertices,VERTICESIN);
    3032        FetchData(&params,PARAMS);
    3133
    3234        /*!Generate internal degree of freedom numbers: */
    33         Dofx(&partition, &tpartition,elements,nodes,params);
     35        Dofx(&partition, &tpartition,elements,nodes, vertices, params);
    3436
    3537        /*partition and tpartition should be incremented by 1: */
     
    3941        /*write output datasets: */
    4042        WriteData(NODES,nodes);
     43        WriteData(VERTICES,vertices);
    4144        WriteData(PARTITION,partition);
    4245        WriteData(TPARTITION,tpartition);
     
    4447        /*Free ressources: */
    4548        delete nodes;
     49        delete vertices;
    4650        delete elements;
    4751        delete params;
  • issm/trunk/src/mex/Dof/Dof.h

    r1 r3417  
    1919#define ELEMENTS (mxArray*)prhs[0]
    2020#define NODESIN (mxArray*)prhs[1]
    21 #define PARAMS (mxArray*)prhs[2]
     21#define VERTICESIN (mxArray*)prhs[2]
     22#define PARAMS (mxArray*)prhs[3]
    2223
    2324/* serial output macros: */
    2425#define NODES (mxArray**)&plhs[0]
    25 #define PARTITION (mxArray**)&plhs[1]
    26 #define TPARTITION (mxArray**)&plhs[2]
     26#define VERTICES (mxArray**)&plhs[1]
     27#define PARTITION (mxArray**)&plhs[2]
     28#define TPARTITION (mxArray**)&plhs[3]
    2729
    2830/* serial arg counts: */
    2931#undef NLHS
    30 #define NLHS  3
     32#define NLHS  4
    3133#undef NRHS
    32 #define NRHS  3
     34#define NRHS  4
    3335
    3436
  • issm/trunk/src/mex/ModelProcessor/ModelProcessor.cpp

    r2316 r3417  
    1414        DataSet* elements=NULL;
    1515        DataSet* nodes=NULL;
     16        DataSet* vertices=NULL;
    1617        DataSet* constraints=NULL;
    1718        DataSet* loads=NULL;
     
    3233
    3334        /*Create elements, nodes and materials: */
    34         CreateDataSets(&elements,&nodes,&materials,&constraints, &loads, &parameters, iomodel,MODEL);
     35        CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints, &loads, &parameters, iomodel,MODEL);
    3536       
    3637        /*Write output data: */
    3738        WriteData(ELEMENTS,elements);
    3839        WriteData(NODES,nodes);
     40        WriteData(VERTICES,vertices);
    3941        WriteData(CONSTRAINTS,constraints);
    4042        WriteData(LOADS,loads);
     
    4749        delete elements;
    4850        delete nodes;
     51        delete vertices;
    4952        delete constraints;
    5053        delete loads;
  • issm/trunk/src/mex/ModelProcessor/ModelProcessor.h

    r1 r3417  
    2626#define ELEMENTS (mxArray**)&plhs[0]
    2727#define NODES (mxArray**)&plhs[1]
    28 #define CONSTRAINTS (mxArray**)&plhs[2]
    29 #define LOADS (mxArray**)&plhs[3]
    30 #define MATERIALS (mxArray**)&plhs[4]
    31 #define PARAMETERS (mxArray**)&plhs[5]
     28#define VERTICES (mxArray**)&plhs[2]
     29#define CONSTRAINTS (mxArray**)&plhs[3]
     30#define LOADS (mxArray**)&plhs[4]
     31#define MATERIALS (mxArray**)&plhs[5]
     32#define PARAMETERS (mxArray**)&plhs[6]
    3233               
    3334/* serial arg counts: */
    3435#undef NLHS
    35 #define NLHS  6
     36#define NLHS  7
    3637#undef NRHS
    3738#define NRHS  1
Note: See TracChangeset for help on using the changeset viewer.