source: issm/oecreview/Archive/14312-15392/ISSM-14760-14761.diff@ 15393

Last change on this file since 15393 was 15393, checked in by Mathieu Morlighem, 12 years ago

NEW: adding Archive/14312-15392 for oecreview

File size: 33.8 KB
  • ../trunk-jpl/src/c/Container/Elements.cpp

     
    4646        for ( object=objects.begin() ; object < objects.end(); object++ ){
    4747
    4848                element=dynamic_cast<Element*>((*object));
    49                 element->Configure(elements,loads,nodes,materials,parameters);
     49                element->Configure(elements,loads,nodes,vertices,materials,parameters);
    5050
    5151        }
    5252
  • ../trunk-jpl/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp

     
    1313int     ConfigureObjectsx( Elements* elements, Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
    1414
    1515        /*Intermediary*/
     16        int i;
    1617        int noerr=1;
    17         int i;
    18         Element* element=NULL;
    19         Load* load=NULL;
    20         Node* node=NULL;
    21         Material* material=NULL;
    2218        int configuration_type;
     19        Element  *element  = NULL;
     20        Load     *load     = NULL;
     21        Node     *node     = NULL;
     22        Material *material = NULL;
    2323
    2424        /*Get analysis type: */
    2525        parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
     
    2727        if(VerboseMProcessor()) _pprintLine_("      Configuring elements...");
    2828        for (i=0;i<elements->Size();i++){
    2929                element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
    30                 element->Configure(elements,loads,nodes,materials,parameters);
     30                element->Configure(elements,loads,nodes,vertices,materials,parameters);
    3131        }
    3232        if(VerboseMProcessor()) _pprintLine_("      Configuring loads...");
    3333        for (i=0;i<loads->Size();i++){
  • ../trunk-jpl/src/c/classes/objects/Loads/Icefront.h

     
    2525                int analysis_type;
    2626
    2727                /*hooks: */
    28                 Hook* hnodes;
    29                 Hook* helement;
    30                 Hook* hmatpar;
     28                Hook *hnodes;
     29                Hook *hvertices;
     30                Hook *helement;
     31                Hook *hmatpar;
    3132
    3233                /*Corresponding fields*/
    3334                Matpar   *matpar;
    3435                Node    **nodes;
     36                Vertex  **vertices;
    3537                Element  *element;
    3638
    3739                /*inputs and parameters: */
    38                 Inputs* inputs;
    39                 Parameters* parameters;
     40                Inputs     *inputs;
     41                Parameters *parameters;
    4042
    4143                /*Icefront constructors, destructors: {{{*/
    4244                Icefront();
  • ../trunk-jpl/src/c/classes/objects/Loads/Numericalflux.cpp

     
    2525/*Numericalflux constructors and destructor*/
    2626/*FUNCTION Numericalflux::Numericalflux(){{{*/
    2727Numericalflux::Numericalflux(){
    28         this->inputs=NULL;
    29         this->parameters=NULL;
    30         this->helement=NULL;
    31         this->element=NULL;
    32         this->hnodes=NULL;
    33         this->nodes=NULL;
     28        this->inputs     = NULL;
     29        this->parameters = NULL;
     30        this->helement   = NULL;
     31        this->element    = NULL;
     32        this->hnodes     = NULL;
     33        this->hvertices  = NULL;
     34        this->nodes      = NULL;
    3435}
    3536/*}}}*/
    3637/*FUNCTION Numericalflux::Numericalflux(int id, int i, IoModel* iomodel, int analysis_type) {{{*/
     
    4748        /*numericalflux constructor data: */
    4849        int   numericalflux_elem_ids[2];
    4950        int   numericalflux_mparid;
     51        int   numericalflux_vertex_ids[2];
    5052        int   numericalflux_node_ids[4];
    5153        int   numericalflux_type;
    5254
     
    8284        /*1: Get vertices ids*/
    8385        i1=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+0]);
    8486        i2=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+1]);
     87        numericalflux_vertex_ids[0]=i1;
     88        numericalflux_vertex_ids[1]=i2;
    8589
     90        /*2: Get node ids*/
    8691        if (numericalflux_type==InternalEnum){
    8792
    8893                /*Now, we must get the nodes of the 4 nodes located on the edge*/
     
    125130        this->analysis_type=in_analysis_type;
    126131
    127132        /*Hooks: */
    128         this->hnodes  =new Hook(numericalflux_node_ids,num_nodes);
    129         this->helement=new Hook(numericalflux_elem_ids,1); // take only the first element for now
     133        this->hnodes    =new Hook(numericalflux_node_ids,num_nodes);
     134        this->hvertices =new Hook(numericalflux_vertex_ids,2);
     135        this->helement  =new Hook(numericalflux_elem_ids,1); // take only the first element for now
    130136
    131137        //intialize  and add as many inputs per element as requested:
    132138        this->inputs=new Inputs();
     
    144150        this->parameters=NULL;
    145151        delete helement;
    146152        delete hnodes;
     153        delete hvertices;
    147154}
    148155/*}}}*/
    149156
     
    154161        _printLine_("   id: " << id);
    155162        _printLine_("   analysis_type: " << EnumToStringx(analysis_type));
    156163        hnodes->Echo();
     164        hvertices->Echo();
    157165        helement->Echo();
    158166        _printLine_("   parameters: " << parameters);
    159167        _printLine_("   inputs: " << inputs);
     
    166174        _printLine_("   id: " << id);
    167175        _printLine_("   analysis_type: " << EnumToStringx(analysis_type));
    168176        hnodes->DeepEcho();
     177        hvertices->DeepEcho();
    169178        helement->DeepEcho();
    170179        _printLine_("   parameters");
    171180        if(parameters)
     
    209218        numericalflux->parameters=this->parameters;
    210219
    211220        /*now deal with hooks and objects: */
    212         numericalflux->hnodes=(Hook*)this->hnodes->copy();
    213         numericalflux->helement=(Hook*)this->helement->copy();
     221        numericalflux->hnodes    = (Hook*)this->hnodes->copy();
     222        numericalflux->hvertices = (Hook*)this->hvertices->copy();
     223        numericalflux->helement  = (Hook*)this->helement->copy();
    214224
    215225        /*corresponding fields*/
    216         numericalflux->nodes  =(Node**)numericalflux->hnodes->deliverp();
    217         numericalflux->element=(Element*)numericalflux->helement->delivers();
     226        numericalflux->nodes    = (Node**)numericalflux->hnodes->deliverp();
     227        numericalflux->vertices = (Vertex**)numericalflux->hvertices->deliverp();
     228        numericalflux->element  = (Element*)numericalflux->helement->delivers();
    218229
    219230        return numericalflux;
    220231}
     
    227238        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    228239         * datasets, using internal ids and offsets hidden in hooks: */
    229240        hnodes->configure(nodesin);
     241        hvertices->configure(verticesin);
    230242        helement->configure(elementsin);
    231243
    232244        /*Initialize hooked fields*/
    233         this->nodes  =(Node**)hnodes->deliverp();
    234         this->element=(Element*)helement->delivers();
     245        this->nodes    = (Node**)hnodes->deliverp();
     246        this->vertices = (Vertex**)hvertices->deliverp();
     247        this->element  = (Element*)helement->delivers();
    235248
    236249        /*point parameters to real dataset: */
    237250        this->parameters=parametersin;
    238 
    239251}
    240252/*}}}*/
    241253/*FUNCTION Numericalflux::SetCurrentConfiguration {{{*/
  • ../trunk-jpl/src/c/classes/objects/Loads/Numericalflux.h

     
    2525                /*Hooks*/
    2626                Hook *helement;
    2727                Hook *hnodes;
     28                Hook *hvertices;
    2829
    2930                /*Corresponding fields*/
    3031                Element     *element;
     32                Vertex     **vertices;
    3133                Node       **nodes;
    3234                Parameters  *parameters;
    3335                Inputs      *inputs;
     
    3840                ~Numericalflux();
    3941                /*}}}*/
    4042                /*Object virtual functions definitions:{{{ */
    41                 void  Echo();
    42                 void  DeepEcho();
    43                 int   Id();
    44                 int   ObjectEnum();
    45                 Object* copy();
     43                void    Echo();
     44                void    DeepEcho();
     45                int     Id();
     46                int     ObjectEnum();
     47                Object *copy();
    4648                /*}}}*/
    4749                /*Update virtual functions resolution: {{{*/
    48                 void    InputUpdateFromVector(IssmDouble* vector, int name, int type){/*Do nothing*/}
    49                 void    InputUpdateFromVector(int* vector, int name, int type){_error_("Not implemented yet!");}
    50                 void    InputUpdateFromVector(bool* vector, int name, int type){_error_("Not implemented yet!");}
    51                 void    InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){/*Do nothing*/}
    52                 void    InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){/*Do nothing*/}
    53                 void    InputUpdateFromVectorDakota(int* vector, int name, int type){_error_("Not implemented yet!");}
    54                 void    InputUpdateFromVectorDakota(bool* vector, int name, int type){_error_("Not implemented yet!");}
    55                 void    InputUpdateFromConstant(IssmDouble constant, int name){/*Do nothing*/};
    56                 void    InputUpdateFromConstant(int constant, int name){/*Do nothing*/};
    57                 void    InputUpdateFromConstant(bool constant, int name){_error_("Not implemented yet!");}
    58                 void    InputUpdateFromSolution(IssmDouble* solution){_error_("Not implemented yet!");}
    59                 void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
     50                void InputUpdateFromVector(IssmDouble* vector, int name, int type){/*Do nothing*/}
     51                void InputUpdateFromVector(int* vector, int name, int type){_error_("Not implemented yet!");}
     52                void InputUpdateFromVector(bool* vector, int name, int type){_error_("Not implemented yet!");}
     53                void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){/*Do nothing*/}
     54                void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){/*Do nothing*/}
     55                void InputUpdateFromVectorDakota(int* vector, int name, int type){_error_("Not implemented yet!");}
     56                void InputUpdateFromVectorDakota(bool* vector, int name, int type){_error_("Not implemented yet!");}
     57                void InputUpdateFromConstant(IssmDouble constant, int name){/*Do nothing*/};
     58                void InputUpdateFromConstant(int constant, int name){/*Do nothing*/};
     59                void InputUpdateFromConstant(bool constant, int name){_error_("Not implemented yet!");}
     60                void InputUpdateFromSolution(IssmDouble* solution){_error_("Not implemented yet!");}
     61                void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
    6062                /*}}}*/
    6163                /*Load virtual functions definitions: {{{*/
    62                 void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    63                 void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    64                 void  CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
    65                 void  CreatePVector(Vector<IssmDouble>* pf);
    66                 void  GetNodesSidList(int* sidlist);
    67                 int   GetNumberOfNodes(void);
    68                 void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("Not implemented yet");};
    69                 bool  IsPenalty(void);
    70                 void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax){_error_("Not implemented yet");};
    71                 void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* kfs, IssmDouble kmax);
    72                 void  PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax);
    73                 void  SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum);
    74                 bool  InAnalysis(int analysis_type);
     64                void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
     65                void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
     66                void CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
     67                void CreatePVector(Vector<IssmDouble>* pf);
     68                void GetNodesSidList(int* sidlist);
     69                int  GetNumberOfNodes(void);
     70                void CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("Not implemented yet");};
     71                bool IsPenalty(void);
     72                void PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax){_error_("Not implemented yet");};
     73                void PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* kfs, IssmDouble kmax);
     74                void PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax);
     75                void SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum);
     76                bool InAnalysis(int analysis_type);
    7577                /*}}}*/
    7678                /*Numericalflux management:{{{*/
    77                 void  GetNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]);
     79                void           GetNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]);
    7880                ElementMatrix* CreateKMatrixPrognostic(void);
    7981                ElementMatrix* CreateKMatrixPrognosticInternal(void);
    8082                ElementMatrix* CreateKMatrixPrognosticBoundary(void);
  • ../trunk-jpl/src/c/classes/objects/Loads/Icefront.cpp

     
    3131
    3232        this->hnodes=NULL;
    3333        this->nodes= NULL;
     34        this->hvertices=NULL;
     35        this->vertices= NULL;
    3436        this->helement=NULL;
    3537        this->element= NULL;
    3638        this->hmatpar=NULL;
     
    5052        int  icefront_eid;
    5153        int  icefront_mparid;
    5254        int  icefront_node_ids[NUMVERTICESQUA]; //initialize with largest size
     55        int  icefront_vertex_ids[NUMVERTICESQUA]; //initialize with largest size
    5356        int  icefront_fill;
    5457
    5558        /*find parameters: */
     
    7376        if (in_icefront_type==MacAyeal2dIceFrontEnum || in_icefront_type==MacAyeal3dIceFrontEnum){
    7477                icefront_node_ids[0]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+0));
    7578                icefront_node_ids[1]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+1));
     79                icefront_vertex_ids[0]=reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+0));
     80                icefront_vertex_ids[1]=reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+1));
    7681        }
    7782        else if (in_icefront_type==PattynIceFrontEnum || in_icefront_type==StokesIceFrontEnum){
    7883                icefront_node_ids[0]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+0));
    7984                icefront_node_ids[1]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+1));
    8085                icefront_node_ids[2]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+2));
    8186                icefront_node_ids[3]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+3));
     87                icefront_vertex_ids[0]=reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+0));
     88                icefront_vertex_ids[1]=reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+1));
     89                icefront_vertex_ids[2]=reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+2));
     90                icefront_vertex_ids[3]=reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+3));
    8291        }
    8392        else _error_("in_icefront_type " << EnumToStringx(in_icefront_type) << " not supported yet!");
    8493
     
    96105
    97106        /*Hooks: */
    98107        this->hnodes=new Hook(icefront_node_ids,num_nodes);
     108        this->hvertices=new Hook(icefront_vertex_ids,num_nodes);
    99109        this->helement=new Hook(&icefront_eid,1);
    100110        this->hmatpar=new Hook(&icefront_mparid,1);
    101111
     
    105115        this->inputs->AddInput(new IntInput(IceFrontTypeEnum,in_icefront_type));
    106116
    107117        //parameters and hooked fields: we still can't point to them, they may not even exist. Configure will handle this.
    108         this->parameters=NULL;
    109         this->nodes= NULL;
    110         this->element= NULL;
    111         this->matpar= NULL;
     118        this->parameters = NULL;
     119        this->nodes      = NULL;
     120        this->vertices   = NULL;
     121        this->element    = NULL;
     122        this->matpar     = NULL;
    112123}
    113124
    114125/*}}}*/
     
    117128        delete inputs;
    118129        this->parameters=NULL;
    119130        delete hnodes;
     131        delete hvertices;
    120132        delete helement;
    121133        delete hmatpar;
    122134}
     
    129141        _printLine_("   id: " << id);
    130142        _printLine_("   analysis_type: " << EnumToStringx(analysis_type));
    131143        hnodes->Echo();
     144        hvertices->Echo();
    132145        helement->Echo();
    133146        hmatpar->Echo();
    134147        _printLine_("   parameters: " << parameters);
     
    144157        _printLine_("   id: " << id);
    145158        _printLine_("   analysis_type: " << EnumToStringx(analysis_type));
    146159        hnodes->DeepEcho();
     160        hvertices->DeepEcho();
    147161        helement->DeepEcho();
    148162        hmatpar->DeepEcho();
    149163        _printLine_("   parameters: " << parameters);
     
    182196        icefront->parameters=this->parameters;
    183197
    184198        /*now deal with hooks and objects: */
    185         icefront->hnodes=(Hook*)this->hnodes->copy();
    186         icefront->helement=(Hook*)this->helement->copy();
    187         icefront->hmatpar=(Hook*)this->hmatpar->copy();
     199        icefront->hnodes    = (Hook*)this->hnodes->copy();
     200        icefront->hvertices = (Hook*)this->hvertices->copy();
     201        icefront->helement  = (Hook*)this->helement->copy();
     202        icefront->hmatpar   = (Hook*)this->hmatpar->copy();
    188203
    189204        /*corresponding fields*/
    190         icefront->nodes  =(Node**)icefront->hnodes->deliverp();
    191         icefront->element=(Element*)icefront->helement->delivers();
    192         icefront->matpar =(Matpar*)icefront->hmatpar->delivers();
     205        icefront->nodes    = (Node**)icefront->hnodes->deliverp();
     206        icefront->vertices = (Vertex**)icefront->hvertices->deliverp();
     207        icefront->element  = (Element*)icefront->helement->delivers();
     208        icefront->matpar   = (Matpar*)icefront->hmatpar->delivers();
    193209
    194210        return icefront;
    195211
     
    203219        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    204220         * datasets, using internal ids and offsets hidden in hooks: */
    205221        hnodes->configure(nodesin);
     222        hvertices->configure(verticesin);
    206223        helement->configure(elementsin);
    207224        hmatpar->configure(materialsin);
    208225
    209226        /*Initialize hooked fields*/
    210         this->nodes  =(Node**)hnodes->deliverp();
    211         this->element=(Element*)helement->delivers();
    212         this->matpar =(Matpar*)hmatpar->delivers();
     227        this->nodes    = (Node**)hnodes->deliverp();
     228        this->vertices = (Vertex**)hvertices->deliverp();
     229        this->element  = (Element*)helement->delivers();
     230        this->matpar   = (Matpar*)hmatpar->delivers();
    213231
    214232        /*point parameters to real dataset: */
    215233        this->parameters=parametersin;
  • ../trunk-jpl/src/c/classes/objects/Elements/Element.h

     
    2626
    2727                virtual        ~Element(){};
    2828
    29                 virtual void   Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters)=0;
     29                virtual void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
    3030                virtual void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters)=0;
    3131                virtual void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum)=0;
    3232                virtual void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>*  Kfs)=0;
  • ../trunk-jpl/src/c/classes/objects/Elements/Tria.cpp

     
    3030
    3131        int i;
    3232
    33         this->nodes=NULL;
    34         this->material=NULL;
    35         this->matpar=NULL;
     33        this->nodes    = NULL;
     34        this->vertices = NULL;
     35        this->material = NULL;
     36        this->matpar   = NULL;
    3637        for(i=0;i<3;i++)this->horizontalneighborsids[i]=UNDEF;
    37         this->inputs=NULL;
    38         this->parameters=NULL;
    39         this->results=NULL;
     38        this->inputs     = NULL;
     39        this->parameters = NULL;
     40        this->results    = NULL;
    4041
    4142}
    4243/*}}}*/
     
    6162                this->results=new Results();
    6263
    6364                /*initialize pointers:*/
    64                 this->nodes=NULL;
    65                 this->material=NULL;
    66                 this->matpar=NULL;
     65                this->nodes    = NULL;
     66                this->vertices = NULL;
     67                this->material = NULL;
     68                this->matpar   = NULL;
    6769
    6870}
    6971/*}}}*/
     
    9092        tria->numanalyses=this->numanalyses;
    9193        tria->hnodes=new Hook*[tria->numanalyses];
    9294        for(i=0;i<tria->numanalyses;i++)tria->hnodes[i]=(Hook*)this->hnodes[i]->copy();
     95        tria->hvertices=(Hook*)this->hvertices->copy();
    9396        tria->hmaterial=(Hook*)this->hmaterial->copy();
    9497        tria->hmatpar=(Hook*)this->hmatpar->copy();
    9598
     
    114117        /*recover objects: */
    115118        tria->nodes=xNew<Node*>(3); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
    116119        for(i=0;i<3;i++)tria->nodes[i]=this->nodes[i];
     120        tria->vertices=(Vertex**)tria->hvertices->deliverp();
    117121        tria->material=(Material*)tria->hmaterial->delivers();
    118122        tria->matpar=(Matpar*)tria->hmatpar->delivers();
    119123
     
    886890}
    887891/*}}}*/
    888892/*FUNCTION Tria::Configure {{{*/
    889 void  Tria::Configure(Elements* elementsin, Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){
     893void  Tria::Configure(Elements* elementsin, Loads* loadsin,Nodes* nodesin,Vertices *verticesin,Materials* materialsin, Parameters* parametersin){
    890894
    891895        /*go into parameters and get the analysis_counter: */
    892896        int analysis_counter;
     
    898902        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    899903         * datasets, using internal ids and offsets hidden in hooks: */
    900904        if(this->hnodes[analysis_counter]) this->hnodes[analysis_counter]->configure(nodesin);
     905        this->hvertices->configure(verticesin);
    901906        this->hmaterial->configure(materialsin);
    902907        this->hmatpar->configure(materialsin);
    903908
    904909        /*Now, go pick up the objects inside the hooks: */
    905910        if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
    906911        else this->nodes=NULL;
    907         this->material=(Material*)this->hmaterial->delivers();
    908         this->matpar=(Matpar*)this->hmatpar->delivers();
     912        this->vertices = (Vertex**)this->hvertices->deliverp();
     913        this->material = (Material*)this->hmaterial->delivers();
     914        this->matpar   = (Matpar*)this->hmatpar->delivers();
    909915
    910916        /*point parameters to real dataset: */
    911917        this->parameters=parametersin;
  • ../trunk-jpl/src/c/classes/objects/Elements/TriaHook.cpp

     
    2323/*FUNCTION TriaHook::TriaHook(){{{*/
    2424TriaHook::TriaHook(){
    2525        numanalyses=UNDEF;
    26         this->hnodes=NULL;
    27         this->hmaterial=NULL;
    28         this->hmatpar=NULL;
     26        this->hnodes    = NULL;
     27        this->hvertices = NULL;
     28        this->hmaterial = NULL;
     29        this->hmatpar   = NULL;
    2930}
    3031/*}}}*/
    3132/*FUNCTION TriaHook::~TriaHook(){{{*/
     
    3536        for(i=0;i<this->numanalyses;i++){
    3637                if (this->hnodes[i]) delete this->hnodes[i];
    3738        }
    38         delete [] this->hnodes;
     39        delete [] hnodes;
     40        delete hvertices;
    3941        delete hmaterial;
    4042        delete hmatpar;
    4143
    4244}
    4345/*}}}*/
    44 /*FUNCTION TriaHook::TriaHook(int in_numanalyses,int material_id, int matpar_id){{{*/
    45 TriaHook::TriaHook(int in_numanalyses,int material_id, IoModel* iomodel){
     46/*FUNCTION TriaHook::TriaHook(int in_numanalyses,int element_id, int matpar_id){{{*/
     47TriaHook::TriaHook(int in_numanalyses,int element_id, IoModel* iomodel){
    4648
    4749        /*intermediary: */
    4850        int matpar_id;
     51        int material_id;
     52        int tria_vertex_ids[3];
    4953
    50         /*retrieve parameters: */
     54        /*retrieve material_id: */
    5155        iomodel->Constant(&matpar_id,MeshNumberofelementsEnum); matpar_id++;
    5256
    53         this->numanalyses=in_numanalyses;
    54         this->hnodes= new Hook*[in_numanalyses];
    55         this->hmaterial=new Hook(&material_id,1);
    56         this->hmatpar=new Hook(&matpar_id,1);
     57        /*retrive material_id*/
     58        material_id = element_id;
    5759
     60        /*retrieve vertices ids*/
     61        for(int i=0;i<3;i++){
     62                tria_vertex_ids[i]=reCast<int>(iomodel->Data(MeshElementsEnum)[3*(element_id-1)+i]);
     63        }
     64
     65        this->numanalyses = in_numanalyses;
     66        this->hnodes      = new Hook*[in_numanalyses];
     67        this->hvertices   = new Hook(&tria_vertex_ids[0],3);
     68        this->hmaterial   = new Hook(&material_id,1);
     69        this->hmatpar     = new Hook(&matpar_id,1);
     70
    5871        //Initialize hnodes as NULL
    5972        for(int i=0;i<this->numanalyses;i++){
    6073                this->hnodes[i]=NULL;
  • ../trunk-jpl/src/c/classes/objects/Elements/Tria.h

     
    3131                int          id;
    3232                int          sid;
    3333
    34                 Node       **nodes;                       // 3 nodes
     34                Node       **nodes;                       // nodes
     35                Vertex     **vertices;                    // 3 vertices
    3536                Material    *material;                    // 1 material ice
    3637                Matpar      *matpar;                      // 1 material parameter
    3738                int          horizontalneighborsids[3];
     
    7374                void   ComputeBasalStress(Vector<IssmDouble>* sigma_b);
    7475                void   ComputeStrainRate(Vector<IssmDouble>* eps);
    7576                void   ComputeStressTensor();
    76                 void   Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
     77                void   Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
    7778                void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
    7879                void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum);
    7980                void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
  • ../trunk-jpl/src/c/classes/objects/Elements/TriaHook.h

     
    1111class TriaHook{
    1212
    1313        public:
    14                 int    numanalyses; //number of analysis types
    15                 Hook** hnodes; // 3 nodes for each analysis type
    16                 Hook*  hmaterial; // 1 ice material
    17                 Hook*  hmatpar; // 1 material parameter
     14                int    numanalyses;   //number of analysis types
     15                Hook **hnodes;        // nodes for each analysis type
     16                Hook  *hvertices;     // 3 vertices
     17                Hook  *hmaterial;     // 1 ice material
     18                Hook  *hmatpar;       // 1 material parameter
    1819
    1920                /*FUNCTION constructors, destructors {{{*/
    2021                TriaHook();
  • ../trunk-jpl/src/c/classes/objects/Elements/Penta.cpp

     
    2626/*FUNCTION Penta::Penta(){{{*/
    2727Penta::Penta(){
    2828
    29         int i;
    30 
    31         this->nodes=NULL;
    32         this->material=NULL;
    33         this->matpar=NULL;
    34         this->verticalneighbors=NULL;
    35         this->inputs=NULL;
    36         this->parameters=NULL;
    37         this->results=NULL;
    38         for(i=0;i<3;i++)this->horizontalneighborsids[i]=UNDEF;
     29        this->nodes             = NULL;
     30        this->vertices          = NULL;
     31        this->material          = NULL;
     32        this->matpar            = NULL;
     33        this->verticalneighbors = NULL;
     34        this->inputs            = NULL;
     35        this->parameters        = NULL;
     36        this->results           = NULL;
     37        for(int i=0;i<3;i++)this->horizontalneighborsids[i]=UNDEF;
    3938}
    4039/*}}}*/
    4140/*FUNCTION Penta::~Penta(){{{*/
     
    8382        this->results=new Results();
    8483
    8584        /*initialize pointers:*/
    86         this->nodes=NULL;
    87         this->material=NULL;
    88         this->matpar=NULL;
    89         this->verticalneighbors=NULL;
     85        this->nodes             = NULL;
     86        this->vertices          = NULL;
     87        this->material          = NULL;
     88        this->matpar            = NULL;
     89        this->verticalneighbors = NULL;
    9090}
    9191/*}}}*/
    9292/*FUNCTION Penta::copy {{{*/
     
    106106        penta->numanalyses=this->numanalyses;
    107107        penta->hnodes=new Hook*[penta->numanalyses];
    108108        for(i=0;i<penta->numanalyses;i++)penta->hnodes[i]=(Hook*)this->hnodes[i]->copy();
     109        penta->hvertices=(Hook*)this->hvertices->copy();
    109110        penta->hmaterial=(Hook*)this->hmaterial->copy();
    110111        penta->hmatpar=(Hook*)this->hmatpar->copy();
    111112        penta->hneighbors=(Hook*)this->hneighbors->copy();
     
    131132        /*recover objects: */
    132133        penta->nodes=xNew<Node*>(6); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
    133134        for(i=0;i<6;i++)penta->nodes[i]=this->nodes[i];
     135        penta->vertices=(Vertex**)penta->hvertices->deliverp();
    134136        penta->material=(Material*)penta->hmaterial->delivers();
    135137        penta->matpar=(Matpar*)penta->hmatpar->delivers();
    136138        penta->verticalneighbors=(Penta**)penta->hneighbors->deliverp();
     
    372374}
    373375/*}}}*/
    374376                /*FUNCTION Penta::Configure {{{*/
    375 void  Penta::Configure(Elements* elementsin, Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){
     377void  Penta::Configure(Elements* elementsin, Loads* loadsin, Nodes* nodesin,Vertices* verticesin, Materials* materialsin, Parameters* parametersin){
    376378
    377379        int analysis_counter;
    378380
     
    385387        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    386388         * datasets, using internal ids and offsets hidden in hooks: */
    387389        if (this->hnodes[analysis_counter]) this->hnodes[analysis_counter]->configure(nodesin);
     390        this->hvertices->configure(verticesin);
    388391        this->hmaterial->configure(materialsin);
    389392        this->hmatpar->configure(materialsin);
    390393        this->hneighbors->configure(elementsin);
     
    392395        /*Now, go pick up the objects inside the hooks: */
    393396        if (this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
    394397        else this->nodes=NULL;
    395         this->material=(Material*)this->hmaterial->delivers();
    396         this->matpar=(Matpar*)this->hmatpar->delivers();
    397         this->verticalneighbors=(Penta**)this->hneighbors->deliverp();
     398        this->vertices          = (Vertex**)this->hvertices->deliverp();
     399        this->material          = (Material*)this->hmaterial->delivers();
     400        this->matpar            = (Matpar*)this->hmatpar->delivers();
     401        this->verticalneighbors = (Penta**)this->hneighbors->deliverp();
    398402
    399403        /*point parameters to real dataset: */
    400404        this->parameters=parametersin;
     
    28482852
    28492853        /*recover nodes, material and matpar: */
    28502854        tria->nodes=(Node**)tria->hnodes[analysis_counter]->deliverp();
     2855        tria->vertices=(Vertex**)tria->hvertices->deliverp();
    28512856        tria->matpar=(Matpar*)tria->hmatpar->delivers();
    28522857
    28532858        return tria;
  • ../trunk-jpl/src/c/classes/objects/Elements/PentaHook.cpp

     
    2323/*FUNCTION PentaHook::PentaHook(){{{*/
    2424PentaHook::PentaHook(){
    2525        numanalyses=UNDEF;
    26         this->hnodes=NULL;
    27         this->hmaterial=NULL;
    28         this->hmatpar=NULL;
    29         this->hneighbors=NULL;
     26        this->hnodes     = NULL;
     27        this->hvertices  = NULL;
     28        this->hmaterial  = NULL;
     29        this->hmatpar    = NULL;
     30        this->hneighbors = NULL;
    3031}
    3132/*}}}*/
    3233/*FUNCTION PentaHook::~PentaHook(){{{*/
     
    3839                if (this->hnodes[i]) delete this->hnodes[i];
    3940        }
    4041        delete [] this->hnodes;
     42        delete hvertices;
    4143        delete hmaterial;
    4244        delete hmatpar;
    4345        delete hneighbors;
    4446}
    4547/*}}}*/
    46 /*FUNCTION PentaHook::PentaHook(int in_numanalyses,int material_id, int matpar_id){{{*/
    47 PentaHook::PentaHook(int in_numanalyses,int material_id, IoModel* iomodel){
     48/*FUNCTION PentaHook::PentaHook(int in_numanalyses,int element_id, int matpar_id){{{*/
     49PentaHook::PentaHook(int in_numanalyses,int element_id, IoModel* iomodel){
    4850
    4951        /*intermediary: */
    5052        int matpar_id;
     53        int material_id;
     54        int penta_vertex_ids[3];
    5155
    52         /*retrieve parameters: */
     56        /*retrieve material_id: */
    5357        iomodel->Constant(&matpar_id,MeshNumberofelementsEnum); matpar_id++;
    5458
    55         this->numanalyses=in_numanalyses;
    56         this->hnodes=new Hook*[in_numanalyses];
    57         this->hmaterial=new Hook(&material_id,1);
    58         this->hmatpar=new Hook(&matpar_id,1);
    59         this->hneighbors=NULL;
     59        /*retrive material_id*/
     60        material_id = element_id;
    6061
     62        /*retrieve vertices ids*/
     63        for(int i=0;i<6;i++){
     64                penta_vertex_ids[i]=reCast<int>(iomodel->Data(MeshElementsEnum)[6*(element_id-1)+i]);
     65        }
     66
     67
     68        this->numanalyses = in_numanalyses;
     69        this->hnodes      = new Hook*[in_numanalyses];
     70        this->hvertices   = new Hook(&penta_vertex_ids[0],6);
     71        this->hmaterial   = new Hook(&material_id,1);
     72        this->hmatpar     = new Hook(&matpar_id,1);
     73        this->hneighbors  = NULL;
     74
    6175        //Initialize hnodes as NULL
    6276        for(int i=0;i<this->numanalyses;i++){
    6377                this->hnodes[i]=NULL;
     
    98112        }
    99113        // do not spawn hmaterial. material will be taken care of by Penta
    100114        triahook->hmaterial=NULL;
     115        triahook->hvertices=(Hook*)this->hvertices->Spawn(indices,3);
    101116        triahook->hmatpar=(Hook*)this->hmatpar->copy();
    102117}
    103118/*}}}*/
  • ../trunk-jpl/src/c/classes/objects/Elements/Penta.h

     
    3333                int          id;
    3434                int          sid;
    3535
    36                 Node       **nodes;                       // 6 nodes
     36                Node       **nodes;                       // set of nodes
     37                Vertex     **vertices;                    // 6 vertices
    3738                Material    *material;                    // 1 material ice
    3839                Matpar      *matpar;                      // 1 material parameter
    3940                Penta      **verticalneighbors;           // 2 neighbors: first one under, second one above
     
    7778                void   ComputeBasalStress(Vector<IssmDouble>* sigma_b);
    7879                void   ComputeStrainRate(Vector<IssmDouble>* eps);
    7980                void   ComputeStressTensor();
    80                 void   Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
     81                void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    8182                void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
    8283                void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum);
    8384                void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
  • ../trunk-jpl/src/c/classes/objects/Elements/PentaHook.h

     
    1313
    1414        public:
    1515                int    numanalyses;   //number of analysis types
    16                 Hook **hnodes;        // 6 nodes for each analysis type
     16                Hook **hnodes;        // set of nodes for each analysis type
     17                Hook  *hvertices;     // 6 vertices for each analysis type
    1718                Hook  *hmaterial;     // 1 ice material
    1819                Hook  *hmatpar;       // 1 material parameter
    1920                Hook  *hneighbors;    // 2 elements, first down, second up
Note: See TracBrowser for help on using the repository browser.