Changeset 3805


Ignore:
Timestamp:
05/18/10 11:25:43 (15 years ago)
Author:
Eric.Larour
Message:

New Penta Hook

Location:
issm/trunk/src/c/objects/Elements
Files:
2 added
5 edited

Legend:

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

    r3791 r3805  
    33 */
    44
     5/*Headers:*/
     6/*{{{1*/
    57#ifdef HAVE_CONFIG_H
    68#include "config.h"
     
    1618#include "../../include/include.h"
    1719#include "../../DataSet/DataSet.h"
     20/*}}}*/
    1821
    1922/*Object constructors and destructor*/
    2023/*FUNCTION Penta::Penta(){{{1*/
    2124Penta::Penta(){
     25        this->nodes=NULL;
     26        this->matice=NULL;
     27        this->matpar=NULL;
     28       
    2229        this->inputs=NULL;
    2330        this->parameters=NULL;
    2431}
    2532/*}}}*/
    26 /*FUNCTION Penta::Penta(int id, Hook* hnodes, Hook* hmatice, Hook* hmatpar, Parameters* parameters, Inputs* penta_inputs) {{{1*/
    27 Penta::Penta(int penta_id,Hook* penta_hnodes, Hook* penta_hmatice, Hook* penta_hmatpar, Parameters* penta_parameters, Inputs* penta_inputs):
    28         hnodes(penta_hnodes),
    29         hmatice(penta_hmatice),
    30         hmatpar(penta_hmatpar)
    31 {
    32 
    33         /*all the initialization has been done by the initializer, just fill in the id: */
    34         this->id=penta_id;
    35         if(penta_inputs){
    36                 this->inputs=(Inputs*)penta_inputs->Copy();
    37         }
    38         else{
    39                 this->inputs=new Inputs();
    40         }
    41         /*point parameters: */
    42         this->parameters=penta_parameters;
     33/*FUNCTION Penta::~Penta(){{{1*/
     34Penta::~Penta(){
     35        delete inputs;
     36        this->parameters=NULL;
    4337}
    4438/*}}}*/
     
    6357        penta_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object
    6458
    65         this->hnodes.Init(&penta_node_ids[0],6);
    66         this->hmatice.Init(&penta_matice_id,1);
    67         this->hmatpar.Init(&penta_matpar_id,1);
     59        this->InitHookNodes(penta_node_ids); this->nodes=NULL;
     60        this->InitHookMatice(penta_matice_id);this->matice=NULL;
     61        this->InitHookMatpar(penta_matpar_id);this->matpar=NULL;
    6862
    6963        //intialize inputs, and add as many inputs per element as requested:
     
    181175}
    182176/*}}}*/
    183 /*FUNCTION Penta::~Penta(){{{1*/
    184 Penta::~Penta(){
    185         delete inputs;
    186         this->parameters=NULL;
     177/*FUNCTION Penta::copy {{{1*/
     178Object* Penta::copy() {
     179
     180        Penta* penta=NULL;
     181
     182        penta=new Penta();
     183
     184        /*copy fields: */
     185        penta->id=this->id;
     186        if(this->inputs){
     187                penta->inputs=(Inputs*)this->inputs->Copy();
     188        }
     189        else{
     190                penta->inputs=new Inputs();
     191        }
     192        /*point parameters: */
     193        penta->parameters=this->parameters;
     194
     195        /*now deal with hooks and objects: */
     196        penta->hnodes.copy(&this->hnodes);
     197        penta->hmatice.copy(&this->hmatice);
     198        penta->hmatpar.copy(&this->hmatpar);
     199
     200        /*recover objects: */
     201        penta->nodes=(Node**)penta->hnodes.deliverp();
     202        penta->matice=(Matice*)penta->hmatice.delivers();
     203        penta->matpar=(Matpar*)penta->hmatpar.delivers();
     204
     205        return penta;
    187206}
    188207/*}}}*/
     
    192211void  Penta::Configure(DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin){
    193212
    194         int i;
    195 
    196213        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    197214         * datasets, using internal ids and offsets hidden in hooks: */
    198         hnodes.configure(nodesin);
    199         hmatice.configure(materialsin);
    200         hmatpar.configure(materialsin);
     215        this->hnodes.configure(nodesin);
     216        this->hmatice.configure(materialsin);
     217        this->hmatpar.configure(materialsin);
     218
     219        /*Now, go pick up the objects inside the hooks: */
     220        this->nodes=(Node**)this->hnodes.deliverp();
     221        this->matice=(Matice*)this->hmatice.delivers();
     222        this->matpar=(Matpar*)this->hmatpar.delivers();
    201223
    202224        /*point parameters to real dataset: */
     
    205227}
    206228/*}}}*/
    207 /*FUNCTION copy {{{1*/
    208 Object* Penta::copy() {
    209         return new Penta(this->id,&this->hnodes,&this->hmatice,&this->hmatpar,this->parameters,this->inputs);
    210 }
    211 /*}}}*/
    212 /*FUNCTION Demarshall {{{1*/
     229/*FUNCTION Penta::Demarshall {{{1*/
    213230void  Penta::Demarshall(char** pmarshalled_dataset){
    214231
     
    229246        hmatpar.Demarshall(&marshalled_dataset);
    230247
     248        /*pointers are garbabe, until configuration is carried out: */
     249        nodes=NULL;
     250        matice=NULL;
     251        matpar=NULL;
     252       
    231253        /*demarshall inputs: */
    232254        inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
     
    240262}
    241263/*}}}*/
    242 /*FUNCTION DeepEcho{{{1*/
    243 
     264/*FUNCTION Penta::DeepEcho{{{1*/
    244265void Penta::DeepEcho(void){
    245266
    246267        printf("Penta:\n");
    247268        printf("   id: %i\n",id);
    248         hnodes.DeepEcho();
    249         hmatice.DeepEcho();
    250         hmatpar.DeepEcho();
     269        nodes[0]->DeepEcho();
     270        nodes[1]->DeepEcho();
     271        nodes[2]->DeepEcho();
     272        nodes[3]->DeepEcho();
     273        nodes[4]->DeepEcho();
     274        nodes[5]->DeepEcho();
     275        matice->DeepEcho();
     276        matpar->DeepEcho();
    251277        printf("   parameters\n");
    252278        parameters->DeepEcho();
    253279        printf("   inputs\n");
    254280        inputs->DeepEcho();
    255 
     281       
    256282        return;
    257283}
    258284/*}}}*/
    259 /*FUNCTION Echo{{{1*/
     285/*FUNCTION Penta::Echo{{{1*/
    260286
    261287void Penta::Echo(void){
    262 
    263         printf("Penta:\n");
    264         printf("   id: %i\n",id);
    265         hnodes.Echo();
    266         hmatice.Echo();
    267         hmatpar.Echo();
    268         printf("   parameters\n");
    269         parameters->Echo();
    270         printf("   inputs\n");
    271         inputs->Echo();
    272 
     288        this->DeepEcho();
    273289}
    274290/*}}}*/
     
    553569        double stokesreconditioning;
    554570
    555         /*dynamic objects pointed to by hooks: */
    556         Node**  nodes=NULL;
    557         Matpar* matpar=NULL;
    558         Matice* matice=NULL;
    559 
    560571        /*Check analysis_types*/
    561572        if (analysis_type!=DiagnosticAnalysisEnum || sub_analysis_type!=StokesAnalysisEnum) ISSMERROR("Not supported yet!");
    562 
    563         /*recover objects from hooks: */
    564         nodes=(Node**)hnodes.deliverp();
    565         matpar=(Matpar*)hmatpar.delivers();
    566         matice=(Matice*)hmatice.delivers();
    567573
    568574        /*recover some inputs: */
     
    652658        /*inputs: */
    653659        bool onwater;
    654 
    655         /*dynamic objects pointed to by hooks: */
    656         Node**  nodes=NULL;
    657         Matpar* matpar=NULL;
    658 
    659         /*recover objects from hooks: */
    660         nodes=(Node**)hnodes.deliverp();
    661         matpar=(Matpar*)hmatpar.delivers();
    662660
    663661        /*retrieve inputs :*/
     
    938936        /*Collapsed formulation: */
    939937        Tria*  tria=NULL;
    940 
    941         /*dynamic objects pointed to by hooks: */
    942         Node**  nodes=NULL;
    943         Matice* matice=NULL;
    944 
    945         /*recover objects from hooks: */
    946         nodes=(Node**)hnodes.deliverp();
    947         matice=(Matice*)hmatice.delivers();
    948938
    949939        /*inputs: */
     
    11741164        double stokesreconditioning;
    11751165
    1176         /*dynamic objects pointed to by hooks: */
    1177         Node**  nodes=NULL;
    1178         Matpar* matpar=NULL;
    1179         Matice* matice=NULL;
    1180 
    11811166        /*inputs: */
    11821167        bool onwater;
     
    11911176        /*If on water, skip stiffness: */
    11921177        if(onwater)return;
    1193 
    1194         /*recover objects from hooks: */
    1195         nodes=(Node**)hnodes.deliverp();
    1196         matpar=(Matpar*)hmatpar.delivers();
    1197         matice=(Matice*)hmatice.delivers();
    1198 
    11991178
    12001179        /*recovre material parameters: */
     
    14381417        double  Bprime[NDOF1][numgrids];
    14391418        double  DL_scalar;
    1440 
    1441         /*dynamic objects pointed to by hooks: */
    1442         Node**  nodes=NULL;
    1443 
    1444         /*recover objects from hooks: */
    1445         nodes=(Node**)hnodes.deliverp();
    14461419
    14471420        /*Collapsed formulation: */
     
    16881661        double dt,artdiff,epsvel;
    16891662
    1690         /*dynamic objects pointed to by hooks: */
    1691         Node**  nodes=NULL;
    1692         Matpar* matpar=NULL;
    1693 
    16941663        /*Collapsed formulation: */
    16951664        Tria*  tria=NULL;
     
    17081677        /*If on water, skip: */
    17091678        if(onwater)return;
    1710 
    1711         /*recover objects from hooks: */
    1712         nodes=(Node**)hnodes.deliverp();
    1713         matpar=(Matpar*)hmatpar.delivers();
    17141679
    17151680        /* Get node coordinates and dof list: */
     
    20251990        double  pe_g_gaussian[numdof];
    20261991
    2027         /*dynamic objects pointed to by hooks: */
    2028         Node**  nodes=NULL;
    2029         Matpar* matpar=NULL;
    2030 
    20311992        /*Spawning: */
    20321993        Tria* tria=NULL;
     
    20442005        /*If on water, skip load: */
    20452006        if(onwater)return;
    2046 
    2047         /*recover objects from hooks: */
    2048         nodes=(Node**)hnodes.deliverp();
    2049         matpar=(Matpar*)hmatpar.delivers();
    2050 
    20512007
    20522008        /*Figure out if this pentaelem is collapsed. If so, then bailout, except if it is at the
     
    22052161        Tria*            tria=NULL;
    22062162
    2207         /*dynamic objects pointed to by hooks: */
    2208         Node**  nodes=NULL;
    2209         Matpar* matpar=NULL;
    2210         Matice* matice=NULL;
    2211 
    22122163        /*parameters: */
    22132164        double stokesreconditioning;
     
    22282179        /*If on water, skip load: */
    22292180        if(onwater)return;
    2230 
    2231         /*recover objects from hooks: */
    2232         nodes=(Node**)hnodes.deliverp();
    2233         matpar=(Matpar*)hmatpar.delivers();
    2234         matice=(Matice*)hmatice.delivers();
    2235 
    22362181
    22372182        /*recovre material parameters: */
     
    24382383        int     dofs2[1]={1};
    24392384
    2440         /*dynamic objects pointed to by hooks: */
    2441         Node**  nodes=NULL;
    2442 
    24432385        /*inputs: */
    24442386        bool onwater;
    24452387        bool onbed;
    2446 
    2447         /*recover objects from hooks: */
    2448         nodes=(Node**)hnodes.deliverp();
    24492388
    24502389        /*retrieve inputs :*/
     
    26572596        double dt;
    26582597
    2659         /*dynamic objects pointed to by hooks: */
    2660         Node**  nodes=NULL;
    2661         Matpar* matpar=NULL;
    2662         Matice* matice=NULL;
    2663 
    26642598        /*inputs: */
    26652599        bool onwater;
     
    26772611        /*If on water, skip: */
    26782612        if(onwater)return;
    2679 
    2680         /*recover objects from hooks: */
    2681         nodes=(Node**)hnodes.deliverp();
    2682         matpar=(Matpar*)hmatpar.delivers();
    2683         matice=(Matice*)hmatice.delivers();
    26842613
    26852614        /* Get node coordinates and dof list: */
     
    28332762        int   i;
    28342763        int   extrude=0;
    2835 
    2836         /*dynamic objects pointed to by hooks: */
    2837         Node**  nodes=NULL;
    2838 
    2839         /*recover objects from hooks: */
    2840         nodes=(Node**)hnodes.deliverp();
    28412764
    28422765        /*inputs: */
     
    33943317        int numberofdofspernode;
    33953318
    3396         /*dynamic objects pointed to by hooks: */
    3397         Node**  nodes=NULL;
    3398 
    3399         /*recover objects from hooks: */
    3400         nodes=(Node**)hnodes.deliverp();
    3401 
    34023319        for(i=0;i<6;i++){
    34033320                nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode);
     
    34163333       
    34173334        int i;
    3418         /*dynamic objects pointed to by hooks: */
    3419         Node**  nodes=NULL;
    3420 
    3421         /*recover objects from hooks: */
    3422         nodes=(Node**)hnodes.deliverp();
    34233335
    34243336        for(i=0;i<6;i++){
     
    37273639void* Penta::GetMatPar(){
    37283640
    3729         /*dynamic objects pointed to by hooks: */
    3730         Matpar* matpar=NULL;
    3731 
    3732         /*recover objects from hooks: */
    3733         matpar=(Matpar*)hmatpar.delivers();
    3734 
    37353641        return matpar;
    37363642}
     
    39843890        int i;
    39853891        Node** pnodes=NULL;
    3986         /*dynamic objects pointed to by hooks: */
    3987         Node**  nodes=NULL;
    3988        
    3989         /*recover objects from hooks: */
    3990         nodes=(Node**)hnodes.deliverp();
    39913892       
    39923893        /*virtual object: */
  • issm/trunk/src/c/objects/Elements/Penta.h

    r3783 r3805  
    88/*Headers:*/
    99/*{{{1*/
    10 
    11 #include "../Elements/Element.h"
     10#include "./Element.h"
     11#include "./PentaHook.h"
    1212class  Object;
    13 class  Hook;
    14 class  Parameters;
    15 class  Inputs;
    16 
     13class Parameters;
     14class Inputs;
    1715class IoModel;
     16class Node;
     17class Matice;
     18class Matpar;
    1819
    1920#include "../../shared/Exceptions/exceptions.h"
     
    2223/*}}}*/
    2324
    24 class Penta: public Element{
     25class Penta: public Element,public PentaHook{
    2526
    2627        public:
    2728
    2829                int id;
    29                 Hook hnodes;  //hook to 6 nodes
    30                 Hook hmatice; //hook to 1 matice
    31                 Hook hmatpar; //hook to 1 matpar
     30               
     31                Node** nodes; // 6 nodes
     32                Matice* matice;  // 1 material ice
     33                Matpar* matpar;  // 1 material parameter
    3234
    3335                Parameters* parameters; //pointer to solution parameters
     
    3638                /*FUNCTION constructors, destructors {{{1*/
    3739                Penta();
    38                 Penta(int penta_id,Hook* penta_hnodes, Hook* penta_hmatice, Hook* penta_hmatpar, Parameters* penta_parameters, Inputs* inputs);
    3940                Penta(int penta_id,int i, IoModel* iomodel);
    4041                ~Penta();
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r3803 r3805  
    6666        tria_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object
    6767
    68         this->InitHookNodes(tria_node_ids);
    69         this->InitHookMatice(tria_matice_id);
    70         this->InitHookMatpar(tria_matpar_id);
     68        this->InitHookNodes(tria_node_ids); this->nodes=NULL;
     69        this->InitHookMatice(tria_matice_id);this->matice=NULL;
     70        this->InitHookMatpar(tria_matpar_id);this->matpar=NULL;
    7171
    7272        //intialize inputs, and add as many inputs per element as requested:
  • issm/trunk/src/c/objects/Elements/Tria.h

    r3791 r3805  
    2727                int  id;
    2828
    29                 Node** nodes;
    30                 Matice* matice;
    31                 Matpar* matpar;
    32 
     29                Node** nodes; // 3 nodes
     30                Matice* matice;  // 1 material ice
     31                Matpar* matpar;  // 1 material parameter
     32 
    3333                Parameters* parameters; //pointer to solution parameters
    3434                Inputs*  inputs;
     
    3636                /*FUNCTION constructors, destructors {{{1*/
    3737                Tria();
    38                 Tria(int tria_id,Node* tria_nodes, Matice* tria_matice, Matpar* tria_matpar, Parameters* parameters, Inputs* tria_inputs);
    3938                Tria(int tria_id,int i, IoModel* iomodel);
    4039                ~Tria();
  • issm/trunk/src/c/objects/Elements/TriaHook.h

    r3791 r3805  
    1111
    1212        public:
    13                 Hook hnodes;
    14                 Hook hmatice;
    15                 Hook hmatpar;
     13                Hook hnodes; // 3 nodes
     14                Hook hmatice; // 1 ice material
     15                Hook hmatpar; // 1 material parameter
    1616
    1717
Note: See TracChangeset for help on using the changeset viewer.