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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateElementsNodesAndMaterialsDiagnosticHoriz.cpp

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