Changeset 3632


Ignore:
Timestamp:
04/27/10 16:44:21 (15 years ago)
Author:
Eric.Larour
Message:

Temporary

Location:
issm/trunk/src/c/objects
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Beam.h

    r3622 r3632  
    2424class Beam: public Element{
    2525
    26         private:
     26        public:
    2727
    2828                /*ids:*/
     
    3636                Inputs* inputs;
    3737       
    38         public:
    3938
    4039                /*constructors, destructors: {{{1*/
  • issm/trunk/src/c/objects/Icefront.cpp

    r3622 r3632  
    2121/*FUNCTION Icefront::Icefront() {{{1*/
    2222Icefront::Icefront(){
    23         return;
    24 }
    25 /*}}}*/
    26 /*FUNCTION Icefront::Icefront(char icefront_type[ICEFRONTSTRING],int icefront_fill,int icefront_sid, ...) {{{1*/
    27 Icefront::Icefront(char icefront_type[ICEFRONTSTRING],int icefront_fill,int icefront_sid, int icefront_mparid, int icefront_eid, int icefront_element_type,
    28                 int icefront_node_ids[MAX_ICEFRONT_GRIDS],double icefront_h[MAX_ICEFRONT_GRIDS],double  icefront_b[MAX_ICEFRONT_GRIDS]){
    29        
    30         this->Init(icefront_type,icefront_fill,icefront_sid, icefront_mparid, icefront_eid, icefront_element_type,
    31                 icefront_node_ids,icefront_h,icefront_b);
    32 
    33 }
    34 /*}}}*/
    35 /*FUNCTION Icefront::Init {{{1*/
    36 void Icefront::Init(char icefront_type[ICEFRONTSTRING],int icefront_fill,int icefront_sid, int icefront_mparid, int icefront_eid, int icefront_element_type,
    37                 int icefront_node_ids[MAX_ICEFRONT_GRIDS],double icefront_h[MAX_ICEFRONT_GRIDS],double  icefront_b[MAX_ICEFRONT_GRIDS]){
    38 
    39         int i;
    40        
    41         strcpy(type,icefront_type);
    42         fill=icefront_fill;
    43         sid=icefront_sid;
    44        
    45         mparid=icefront_mparid;
    46        
    47         eid=icefront_eid;
    48         element_type=icefront_element_type;
    49         for(i=0;i<MAX_ICEFRONT_GRIDS;i++){
    50                 node_ids[i]=icefront_node_ids[i];
    51                 node_offsets[i]=UNDEF;
    52                 nodes[i]=NULL;
    53                 h[i]=icefront_h[i];
    54                 b[i]=icefront_b[i];
    55         }
    56        
    57         matpar=NULL;
    58         matpar_offset=UNDEF;
    59 
    60         element=NULL;
    61         element_offset=UNDEF;
     23        this->inputs=NULL;
     24        this->parameters=NULL;
     25}
     26/*}}}*/
     27/*FUNCTION Icefront::Icefront(int icefront_id,int* icefront_node_ids, int num_nodes, int icefront_element_id, int icefront_matpar_id){{{1*/
     28Icefront::Icefront(int icefront_id,int* icefront_node_ids, int num_nodes, int icefront_element_id, int icefront_matpar_id):
     29        hnodes(icefront_node_ids,num_nodes),
     30        helement(&icefront_matice_id,1),
     31        hmatpar(&icefront_matpar_id,1)
     32{
     33
     34        /*all the initialization has been done by the initializer, just fill in the id: */
     35        this->id=icefront_id;
     36        this->parameters=NULL;
     37        this->inputs=new Inputs();
     38}
     39/*}}}*/
     40/*FUNCTION Icefront::Icefront(int id, Hook* hnodes, Hook* hmatice, Hook* hmatpar, DataSet* parameters, Inputs* icefront_inputs) {{{1*/
     41Icefront::Icefront(int icefront_id,Hook* icefront_hnodes, Hook* icefront_helement, Hook* icefront_hmatpar, Parameters* icefront_parameters, Inputs* icefront_inputs):
     42        hnodes(icefront_hnodes),
     43        helement(icefront_helement),
     44        hmatpar(icefront_hmatpar)
     45{
     46
     47        /*all the initialization has been done by the initializer, just fill in the id: */
     48        this->id=icefront_id;
     49        if(icefront_inputs){
     50                this->inputs=(Inputs*)icefront_inputs->Copy();
     51        }
     52        else{
     53                this->inputs=new Inputs();
     54        }
     55        /*point parameters: */
     56        this->parameters=icefront_parameters;
    6257}
    6358/*}}}*/
     
    6661
    6762        int segment_width;
    68         int element_type;
    6963        int i1,i2,i3,i4;
    7064        int element;
    7165
    7266        /*icefront intermediary data: */
    73         char icefront_type[ICEFRONTSTRING];
     67        int  icefront_node_ids[MAX_ICEFRONT_GRIDS];
     68        int  num_nodes;
     69        int  icefront_mparid;
     70        int  icefront_eid;
    7471        int  icefront_fill;
    75         int  icefront_element_type;
    76         int  icefront_eid;
    77         int  icefront_mparid;
    78         int  icefront_node_ids[MAX_ICEFRONT_GRIDS];
    79         double icefront_h[MAX_ICEFRONT_GRIDS];
    80         double  icefront_b[MAX_ICEFRONT_GRIDS];
    8172
    8273        /*First, retrieve element index and element type: */
    8374        if (strcmp(iomodel->meshtype,"2d")==0){
    8475                segment_width=4;
    85                 element_type=TriaEnum;
    8676        }
    8777        else{
    8878                segment_width=6;
    89                 element_type=PentaEnum;
    9079        }
    9180        element=(int)(*(iomodel->pressureload+segment_width*i+segment_width-2)-1); //element is in the penultimate column (grid1 grid2 ... elem fill)
    9281
     82        /*Setup all ids, so we can get our hooks setup: */
    9383        icefront_mparid=iomodel->numberofelements+1; //matlab indexing
    94         icefront_mparid=iomodel->numberofelements+1; //matlab indexing
    95         icefront_fill=(int)*(iomodel->pressureload+segment_width*i+segment_width-1);
    9684        icefront_eid=(int) *(iomodel->pressureload+segment_width*i+segment_width-2); //matlab indexing
    97         icefront_element_type=element_type;
    98 
    99         i1=(int)*(iomodel->pressureload+segment_width*i+0);
    100         i2=(int)*(iomodel->pressureload+segment_width*i+1);
    101 
    102         icefront_node_ids[0]=i1;
    103         icefront_node_ids[1]=i2;
    104 
    105         icefront_h[0]=iomodel->thickness[i1-1];
    106         icefront_h[1]=iomodel->thickness[i2-1];
    107 
    108         icefront_b[0]=iomodel->bed[i1-1];
    109         icefront_b[1]=iomodel->bed[i2-1];
     85
     86        icefront_node_ids[0]=(int)*(iomodel->pressureload+segment_width*i+0);
     87        icefront_node_ids[1]=(int)*(iomodel->pressureload+segment_width*i+1);
    11088
    11189        if (iomodel->sub_analysis_type==HorizAnalysisEnum){
    11290                if ((int)*(iomodel->elements_type+2*element+0)==MacAyealFormulationEnum){ //this is a collapsed 3d element, icefront will be 2d
    113                         strcpy(icefront_type,"segment");
     91                        num_nodes=2;
    11492                }
    11593                else if ((int)*(iomodel->elements_type+2*element+0)==PattynFormulationEnum){ //this is a real 3d element, icefront will be 3d.
    116                         strcpy(icefront_type,"quad");
    117                         i3=(int)*(iomodel->pressureload+segment_width*i+2);
    118                         i4=(int)*(iomodel->pressureload+segment_width*i+3);
    119                         icefront_node_ids[2]=i3;
    120                         icefront_node_ids[3]=i4;
    121 
    122                         icefront_h[2]=iomodel->thickness[i3-1];
    123                         icefront_h[3]=iomodel->thickness[i4-1];
    124 
    125                         icefront_b[2]=iomodel->bed[i3-1];
    126                         icefront_b[3]=iomodel->bed[i4-1];
     94                        num_nodes=4;
     95                        icefront_node_ids[2]=(int)*(iomodel->pressureload+segment_width*i+2);
     96                        icefront_node_ids[3]=(int)*(iomodel->pressureload+segment_width*i+3);
    12797                }
    12898                else{
     
    132102        else if (iomodel->sub_analysis_type==StokesAnalysisEnum){
    133103                //We have a Stokes element, so we need a 3d Icefront
    134                 strcpy(icefront_type,"quad");
    135                 i3=(int)*(iomodel->pressureload+segment_width*i+2);
    136                 i4=(int)*(iomodel->pressureload+segment_width*i+3);
    137                 icefront_node_ids[2]=i3;
    138                 icefront_node_ids[3]=i4;
    139 
    140                 icefront_h[2]=iomodel->thickness[i3-1];
    141                 icefront_h[3]=iomodel->thickness[i4-1];
    142 
    143                 icefront_b[2]=iomodel->bed[i3-1];
    144                 icefront_b[3]=iomodel->bed[i4-1];
     104                num_nodes=4;
     105                icefront_node_ids[2]=(int)*(iomodel->pressureload+segment_width*i+2);
     106                icefront_node_ids[3]=(int)*(iomodel->pressureload+segment_width*i+3);
    145107        }
    146108        else ISSMERROR("Not supported yet!");
    147109
    148         this->Init(icefront_type,icefront_fill,icefront_id,icefront_mparid,icefront_eid,icefront_element_type,icefront_node_ids,icefront_h,icefront_b);
     110        /*Ok, get the hooks setup: */
     111        this->hnodes.Init(icefront_node_ids,num_nodes);
     112        this->helement.Init(&icefront_element_id,1);
     113        this->hmatpar.Init(&icefront_matpar_id,1);
     114
     115        //intialize inputs, and add as many inputs per element as requested:
     116        this->inputs=new Inputs();
     117               
     118        icefront_fill=(int)*(iomodel->pressureload+segment_width*i+segment_width-1);
     119        this->inputs->AddInput(new IntInput(FillEnum,icefront_fill));
     120
     121        //this->parameters: we still can't point to it, it may not even exist. Configure will handle this.
     122        this->parameters=NULL;
     123
    149124}
    150125
     
    158133
    159134/*Object marshall*/
     135/*FUNCTION Icefront Configure {{{1*/
     136void  Icefront::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin);
     137       
     138/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
     139         * datasets, using internal ids and offsets hidden in hooks: */
     140        hnodes.configure(nodesin);
     141        helement.configure(elementsin);
     142        hmatpar.configure(materialsin);
     143
     144        /*point parameters to real dataset: */
     145        this->parameters=parametersin;
     146}
     147/*}}}*/
     148/*FUNCTION Icefront copy {{{1*/
     149Object* Icefront::copy() {
     150        return new Icefront(this->id,&this->hnodes,&this->helement,&this->hmatpar,this->parameters,this->inputs);
     151}
     152/*}}}*/
     153/*FUNCTION Icefront DeepEcho {{{1*/
     154void Icefront::DeepEcho(void){
     155
     156        printf("Icefront:\n");
     157        printf("   id: %i\n",id);
     158        hnodes.Echo();
     159        helement.Echo();
     160        hmatpar.Echo();
     161        printf("   parameters\n");
     162        parameters->Echo();
     163        printf("   inputs\n");
     164        inputs->Echo();
     165}               
     166/*}}}*/
    160167/*FUNCTION Icefront Demarshall {{{1*/
    161168void  Icefront::Demarshall(char** pmarshalled_dataset){
    162169
    163         int i;
    164170        char* marshalled_dataset=NULL;
     171        int   i;
    165172
    166173        /*recover marshalled_dataset: */
     
    170177         *object data (thanks to DataSet::Demarshall):*/
    171178
    172         memcpy(&type,marshalled_dataset,sizeof(type));marshalled_dataset+=sizeof(type);
    173         memcpy(&fill,marshalled_dataset,sizeof(fill));marshalled_dataset+=sizeof(fill);
    174         memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid);
    175        
    176         memcpy(&mparid,marshalled_dataset,sizeof(mparid));marshalled_dataset+=sizeof(mparid);
    177         memcpy(&matpar_offset,marshalled_dataset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset);
    178 
    179         memcpy(&element_type,marshalled_dataset,sizeof(element_type));marshalled_dataset+=sizeof(element_type);
    180         memcpy(&eid,marshalled_dataset,sizeof(eid));marshalled_dataset+=sizeof(eid);
    181         memcpy(&element_offset,marshalled_dataset,sizeof(element_offset));marshalled_dataset+=sizeof(element_offset);
    182 
    183         memcpy(&node_ids,marshalled_dataset,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids);
    184         memcpy(&node_offsets,marshalled_dataset,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets);
    185        
    186         memcpy(&h,marshalled_dataset,sizeof(h));marshalled_dataset+=sizeof(h);
    187         memcpy(&b,marshalled_dataset,sizeof(b));marshalled_dataset+=sizeof(b);
    188 
    189         for(i=0;i<MAX_ICEFRONT_GRIDS;i++)nodes[i]=NULL;
    190         matpar=NULL;
    191         element=NULL;
     179        memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
     180
     181        /*demarshall hooks: */
     182        hnodes.Demarshall(&marshalled_dataset);
     183        helement.Demarshall(&marshalled_dataset);
     184        hmatpar.Demarshall(&marshalled_dataset);
     185       
     186        /*demarshall inputs: */
     187        inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
     188
     189        /*parameters: may not exist even yet, so let Configure handle it: */
     190        this->parameters=NULL;
    192191
    193192        /*return: */
     
    196195}
    197196/*}}}*/
     197/*FUNCTION Icefront Echo {{{1*/
     198void Icefront::Echo(void){
     199
     200        this->DeepEcho();
     201}
     202/*}}}*/
     203/*FUNCTION Icefront Enum {{{1*/
     204int Icefront::Enum(void){
     205
     206        return IcefrontEnum;
     207
     208}
     209/*}}}*/
     210/*FUNCTION Icefront GetId {{{1*/
     211int    Icefront::GetId(void){ return sid; }
     212/*}}}*/
     213/*FUNCTION Icefront GetName {{{1*/
     214char* Icefront::GetName(void){
     215        return "icefront";
     216}
     217/*}}}*/
    198218/*FUNCTION Icefront Marshall {{{1*/
    199219void  Icefront::Marshall(char** pmarshalled_dataset){
    200220
     221
    201222        char* marshalled_dataset=NULL;
    202223        int   enum_type=0;
     224        char* marshalled_inputs=NULL;
     225        int   marshalled_inputs_size;
    203226
    204227        /*recover marshalled_dataset: */
    205228        marshalled_dataset=*pmarshalled_dataset;
    206229
    207         /*get enum type of Icefront: */
    208         enum_type=IcefrontEnum;
    209        
     230        /*get enum type of Tria: */
     231        enum_type=TriaEnum;
     232
    210233        /*marshall enum: */
    211234        memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    212        
    213         /*marshall Icefront data: */
    214         memcpy(marshalled_dataset,&type,sizeof(type));marshalled_dataset+=sizeof(type);
    215         memcpy(marshalled_dataset,&fill,sizeof(fill));marshalled_dataset+=sizeof(fill);
    216         memcpy(marshalled_dataset,&sid,sizeof(sid));marshalled_dataset+=sizeof(sid);
    217        
    218         memcpy(marshalled_dataset,&mparid,sizeof(mparid));marshalled_dataset+=sizeof(mparid);
    219         memcpy(marshalled_dataset,&matpar_offset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset);
    220        
    221         memcpy(marshalled_dataset,&element_type,sizeof(element_type));marshalled_dataset+=sizeof(element_type);
    222         memcpy(marshalled_dataset,&eid,sizeof(eid));marshalled_dataset+=sizeof(eid);
    223         memcpy(marshalled_dataset,&element_offset,sizeof(element_offset));marshalled_dataset+=sizeof(element_offset);
    224        
    225         memcpy(marshalled_dataset,&node_ids,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids);
    226         memcpy(marshalled_dataset,&node_offsets,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets);
    227        
    228         memcpy(marshalled_dataset,&h,sizeof(h));marshalled_dataset+=sizeof(h);
    229         memcpy(marshalled_dataset,&b,sizeof(b));marshalled_dataset+=sizeof(b);
     235
     236        /*marshall Tria data: */
     237        memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
     238
     239        /*Marshall hooks: */
     240        hnodes.Marshall(&marshalled_dataset);
     241        helement.Marshall(&marshalled_dataset);
     242        hmatpar.Marshall(&marshalled_dataset);
     243
     244        /*Marshall inputs: */
     245        marshalled_inputs_size=inputs->MarshallSize();
     246        marshalled_inputs=inputs->Marshall();
     247        memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
     248        marshalled_dataset+=marshalled_inputs_size;
     249
     250        /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/
     251
     252        xfree((void**)&marshalled_inputs);
    230253
    231254        *pmarshalled_dataset=marshalled_dataset;
     
    236259int   Icefront::MarshallSize(){
    237260
    238         return sizeof(type)+
    239           sizeof(fill)+
    240                 sizeof(sid)+
    241                 sizeof(mparid)+
    242                 sizeof(matpar_offset)+
    243                 sizeof(eid)+
    244                 sizeof(element_offset)+
    245                 sizeof(element_type)+
    246                 sizeof(node_ids)+
    247                 sizeof(node_offsets)+
    248                 sizeof(h)+
    249                 sizeof(b)+
    250                 sizeof(int); //sizeof(int) for enum type
     261        return sizeof(id)
     262                +hnodes.MarshallSize()
     263                +helement.MarshallSize()
     264                +hmatpar.MarshallSize()
     265                +inputs->MarshallSize()
     266                +sizeof(int); //sizeof(int) for enum type
     267}
     268/*}}}*/
     269/*FUNCTION Icefront MyRank {{{1*/
     270int    Icefront::MyRank(void){
     271        extern int my_rank;
     272        return my_rank;
    251273}
    252274/*}}}*/
    253275
    254276/*Object functions*/
    255 /*FUNCTION Icefront Configure {{{1*/
    256 
    257 void  Icefront::Configure(void* pelementsin,void* pnodesin,void* pmaterialsin){
    258 
    259         DataSet* elementsin=NULL;
    260         DataSet* nodesin=NULL;
    261         DataSet* materialsin=NULL;
    262 
    263         /*Recover pointers :*/
    264         elementsin=(DataSet*)pelementsin;
    265         nodesin=(DataSet*)pnodesin;
    266         materialsin=(DataSet*)pmaterialsin;
    267        
    268         /*Link this load with its nodes: */
    269         if (strcmp(type,"segment")==0){
    270                 ResolvePointers((Object**)nodes,node_ids,node_offsets,2,nodesin);
    271         }
    272         else{
    273                 ResolvePointers((Object**)nodes,node_ids,node_offsets,4,nodesin);
    274         }
    275 
    276        
    277         /*Same for materials: */
    278         ResolvePointers((Object**)&matpar,&mparid,&matpar_offset,1,materialsin);
    279 
    280 
    281         /*Same for element: */
    282         ResolvePointers((Object**)&element,&eid,&element_offset,1,elementsin);
    283 
    284 }
    285 /*}}}*/
    286 /*FUNCTION Icefront copy {{{1*/
    287 Object* Icefront::copy() {
    288         return new Icefront(*this);
    289 }
    290 /*}}}*/
    291277/*FUNCTION Icefront CreateKMatrix {{{1*/
    292278
     
    704690}
    705691/*}}}*/
    706 /*FUNCTION Icefront DeepEcho {{{1*/
    707 void Icefront::DeepEcho(void){
    708 
    709         int i;
    710        
    711         printf("Icefront:\n");
    712         printf("   type: %s\n",type);
    713         printf("   fill: %i\n",fill);
    714         printf("   sid: %i\n",sid);
    715        
    716         printf("   mparid: %i\n",mparid);
    717         printf("   matpar_offset: %i\n",matpar_offset);
    718         printf("   matpar: \n");
    719        
    720         printf("   element_type: %i\n",element_type);
    721         printf("   eid: %i\n",eid);
    722         printf("   element_offset: %i\n",eid);
    723         printf("   element\n");
    724                
    725         if (strcmp(type,"segment")==0){
    726                 printf("   node_ids=[%i,%i]\n",node_ids[0],node_ids[1]);
    727                 printf("   node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1]);
    728                 printf("   h=[%g,%g]\n",h[0],h[1]);
    729                 printf("   b=[%g,%g]\n",b[0],b[1]);
    730                 for(i=0;i<2;i++){
    731                         if(nodes[i])nodes[i]->Echo();
    732                 }
    733         }
    734         else{
    735                 printf("   node_ids=[%i,%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2],node_ids[3]);
    736                 printf("   node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2],node_offsets[3]);
    737                 printf("   h=[%g,%g,%g,%g]\n",h[0],h[1],h[2],h[3]);
    738                 printf("   b=[%g,%g,%g,%g]\n",b[0],b[1],b[2],b[3]);
    739                 for(i=0;i<4;i++){
    740                         if(nodes[i])nodes[i]->Echo();
    741                 }
    742         }
    743 
    744         return;
    745 }               
    746 /*}}}*/
    747692/*FUNCTION Icefront DistributeNumDofs {{{1*/
    748693void  Icefront::DistributeNumDofs(int* numdofspernode,int analysis_type,int sub_analysis_type){return;}
    749694               
    750 /*}}}*/
    751 /*FUNCTION Icefront Echo {{{1*/
    752 void Icefront::Echo(void){
    753 
    754         int i;
    755        
    756         printf("Icefront:\n");
    757         printf("   type: %s\n",type);
    758         printf("   fill: %i\n",fill);
    759         printf("   sid: %i\n",sid);
    760        
    761         printf("   mparid: %i\n",mparid);
    762         printf("   matpar_offset: %i\n",matpar_offset);
    763         printf("   matpar: \n");
    764        
    765         printf("   element_type: %i\n",element_type);
    766         printf("   eid: %i\n",eid);
    767         printf("   element_offset: %i\n",eid);
    768         printf("   element\n");
    769                
    770         if (strcmp(type,"segment")==0){
    771                 printf("   node_ids=[%i,%i]\n",node_ids[0],node_ids[1]);
    772                 printf("   node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1]);
    773                 printf("   h=[%g,%g]\n",h[0],h[1]);
    774                 printf("   b=[%g,%g]\n",b[0],b[1]);
    775                 for(i=0;i<2;i++){
    776                         if(nodes[i])nodes[i]->Echo();
    777                 }
    778         }
    779         else{
    780                 printf("   node_ids=[%i,%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2],node_ids[3]);
    781                 printf("   node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2],node_offsets[3]);
    782                 printf("   h=[%g,%g,%g,%g]\n",h[0],h[1],h[2],h[3]);
    783                 printf("   b=[%g,%g,%g,%g]\n",b[0],b[1],b[2],b[3]);
    784                 for(i=0;i<4;i++){
    785                         if(nodes[i])nodes[i]->Echo();
    786                 }
    787         }
    788 
    789         return;
    790 }
    791 /*}}}*/
    792 /*FUNCTION Icefront Enum {{{1*/
    793 int Icefront::Enum(void){
    794 
    795         return IcefrontEnum;
    796 
    797 }
    798695/*}}}*/
    799696/*FUNCTION Icefront GetDofList{{{1*/
     
    826723        *pnumberofdofspernode=numberofdofspernode;
    827724
    828 }
    829 /*}}}*/
    830 /*FUNCTION Icefront GetId {{{1*/
    831 int    Icefront::GetId(void){ return sid; }
    832 /*}}}*/
    833 /*FUNCTION Icefront GetName {{{1*/
    834 char* Icefront::GetName(void){
    835         return "icefront";
    836 }
    837 /*}}}*/
    838 /*FUNCTION Icefront MyRank {{{1*/
    839 int    Icefront::MyRank(void){
    840         extern int my_rank;
    841         return my_rank;
    842725}
    843726/*}}}*/
     
    14331316}
    14341317/*}}}*/
    1435 /*FUNCTION Icefront UpdateFromInputs {{{1*/
    1436 void  Icefront::UpdateFromInputs(void* vinputs){
    1437 
    1438         int i;
    1439         int numberofdofspernode;
    1440 
    1441         /*element: */
    1442         double* h_param=NULL;
    1443         double* b_param=NULL;
    1444         int  dofs[1]={0};
    1445 
    1446         ParameterInputs* inputs=NULL;   
    1447 
    1448         inputs=(ParameterInputs*)vinputs;
    1449 
    1450         if(strcmp(type,"quad")==0){
    1451                 inputs->Recover("thickness",&h[0],1,dofs,4,(void**)nodes);
    1452                 inputs->Recover("bed",&b[0],1,dofs,4,(void**)nodes);
    1453         }
    1454         else{
    1455                 inputs->Recover("thickness",&h[0],1,dofs,2,(void**)nodes);
    1456                 inputs->Recover("bed",&h[0],1,dofs,2,(void**)nodes);
    1457         }
    1458 
    1459 
    1460 }
    1461 /*}}}*/
  • issm/trunk/src/c/objects/Icefront.h

    r3622 r3632  
    66#define _ICEFRONT_H_
    77
    8 class Element;
    9 class Load;
    10 class Matpar;
    11 class Element;
    12 class Node;
    13 
    148#include "./Load.h"
    15 #include "./Matpar.h"
    16 #include "./Element.h"
    17 #include "./Node.h"
    18 #include "../ModelProcessorx/IoModel.h"
    199
    2010#define MAX_ICEFRONT_GRIDS 4 //max number of grids for a certain load
     
    2313class Icefront: public Load {
    2414
    25         private:
    26                 char  type[ICEFRONTSTRING];
    27                 int   fill;
    28                 int     sid;
     15        public:
     16                int     id;
    2917       
    30                 /*material: */
    31                 int     mparid; //material id
    32                 Matpar* matpar;
    33                 int     matpar_offset;
    34        
    35                 /*element of icefront: */
    36                 int        element_type;
    37                 int      eid;  //id of element on ice front
    38                 Element* element;
    39                 int      element_offset;
     18                Hook* hnodes; //2 or 4 nodes
     19                Hook* helement; //tria or penta
     20                Hook* hmatpar;
    4021
    41                 /*nodes: */
    42                 int   node_ids[MAX_ICEFRONT_GRIDS]; //node ids
    43                 Node* nodes[MAX_ICEFRONT_GRIDS]; //node pointers
    44                 int   node_offsets[MAX_ICEFRONT_GRIDS]; //node offsets in nodes dataset
    45 
    46                 /*properties: */
    47                 double          h[MAX_ICEFRONT_GRIDS]; //thickness
    48                 double          b[MAX_ICEFRONT_GRIDS]; //bed
    49 
    50         public:
     22                Parameters* parameters;
     23                Inputs*     inputs;
    5124
    5225                /*constructors: {{{1*/
    5326                Icefront();
    54                 Icefront(char type[ICEFRONTSTRING],int fill,int sid, int mparid, int eid, int element_type, int node_ids[MAX_ICEFRONT_GRIDS],double h[MAX_ICEFRONT_GRIDS],double        b[MAX_ICEFRONT_GRIDS]);
    55                 void Init(char type[ICEFRONTSTRING],int fill,int sid, int mparid, int eid, int element_type, int node_ids[MAX_ICEFRONT_GRIDS],double h[MAX_ICEFRONT_GRIDS],double       b[MAX_ICEFRONT_GRIDS]);
    56                 Icefront(int sid, int i, IoModel* iomodel);
     27                Icefront(int icefront_id,int* icefront_node_ids, int num_nodes, int icefront_element_id, int icefront_matpar_id);
     28                Icefront(int icefront_id,Hook* icefront_hnodes, Hook* icefront_helement,Hook* icefront_hmatpar, Parameters* icefront_parameters, Inputs* icefront_inputs);
     29                Icefront(int id,int i, IoModel* iomodel);
    5730                ~Icefront();
    5831                /*}}}*/
    5932                /*object management: {{{1*/
    60                 void  Configure(void* elements,void* nodes,void* materials);
     33                void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* vertices,DataSet* materials,Parameters* parameters);
    6134                Object* copy();
    6235                void  DeepEcho();
     
    7346                /*numerics: {{{1*/
    7447                void  DistributeNumDofs(int* numdofspernode,int analysis_type,int sub_analysis_type);
    75                 void  CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type);
    76                 void  UpdateFromInputs(void* inputs);
    77                 void  CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type);
    78                 void  CreatePVectorDiagnosticHoriz( Vec pg, void* inputs, int analysis_type,int sub_analysis_type);
    79                 void  CreatePVectorDiagnosticHorizSegment( Vec pg,void* inputs, int analysis_type,int sub_analysis_type);
    80                 void  CreatePVectorDiagnosticHorizQuad( Vec pg,void* inputs, int analysis_type,int sub_analysis_type);
    81                 void  CreatePVectorDiagnosticStokes( Vec pg,void* inputs, int analysis_type,int sub_analysis_type);
     48                void  CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type);
     49                void  CreatePVector(Vec pg, int analysis_type,int sub_analysis_type);
     50                void  CreatePVectorDiagnosticHoriz( Vec pg, int analysis_type,int sub_analysis_type);
     51                void  CreatePVectorDiagnosticHorizSegment( Vec pg,int analysis_type,int sub_analysis_type);
     52                void  CreatePVectorDiagnosticHorizQuad( Vec pg, int analysis_type,int sub_analysis_type);
     53                void  CreatePVectorDiagnosticStokes( Vec pg, int analysis_type,int sub_analysis_type);
    8254                void  GetDofList(int* doflist,int* pnumberofdofs);
    8355                void  SegmentPressureLoad(double* pe_g,double rho_water,double rho_ice,double gravity, double* thickness_list, double* bed_list, double* normal,double length);
     
    8658                void  QuadPressureLoadStokes(double* pe_g,double rho_water,double rho_ice,double gravity, double* thickness_list, double* bed_list,
    8759                                              double* normal1,double* normal2,double* normal3,double* normal4,double* xyz_list);
    88                 void  PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type);
    89                 void  PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type);
     60                void  PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type);
     61                void  PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type);
    9062                /*}}}*/
    9163};
  • issm/trunk/src/c/objects/Load.h

    r3463 r3632  
    1313#include "./Object.h"
    1414#include "../toolkits/toolkits.h"
     15#include "../DataSet/DataSet.h"
     16#include "../DataSet/Parameters.h"
    1517
    1618class Load: public Object{
     
    2628                virtual char* GetName()=0;
    2729                virtual void  Demarshall(char** pmarshalled_dataset)=0;
    28                 virtual void  Configure(void* elements,void* nodes,void* materials)=0;
    29                 virtual void  CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type)=0;
    30                 virtual void  CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type)=0;
    31                 virtual void  UpdateFromInputs(void* inputs)=0;
    32                 virtual void  PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type)=0;
    33                 virtual void  PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type)=0;
     30                virtual void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* vertices,DataSet* materials,Parameters* parameters)=0;
     31                virtual void  CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type)=0;
     32                virtual void  CreatePVector(Vec pg, int analysis_type,int sub_analysis_type)=0;
     33                virtual void  PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type)=0;
     34                virtual void  PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type)=0;
    3435
    3536                int           Enum();
  • issm/trunk/src/c/objects/Model.cpp

    r3620 r3632  
    6161       
    6262        _printf_("   fill model with matlab workspace data\n");
    63         IoModelInit(&iomodel,MODEL);
     63        iomodel=new IoModel(MODEL);
    6464
    6565        _printf_("   specifying analysis\n");
     
    9999
    100100        _printf_("   free ressources:\n");
    101         DeleteIoModel(&iomodel);
     101        delete iomodel;
    102102
    103103        /*Use all the data created to create an femmodel: */
     
    136136       
    137137        _printf_("   fill model with matlab workspace data\n");
    138         IoModelInit(&iomodel,MODEL);
     138        iomodel=new IoModel(MODEL);
    139139
    140140        _printf_("   specifying analysis\n");
     
    177177
    178178        _printf_("   free ressources:\n");
    179         DeleteIoModel(&iomodel);
     179        delete iomodel;
    180180
    181181        /*Use all the data created to create an femmodel: */
  • issm/trunk/src/c/objects/Node.cpp

    r3622 r3632  
    2525/*FUNCTION Node::Node() default constructor {{{2*/
    2626Node::Node(){
     27        this->inputs=NULL;
    2728        return;
    2829}
    2930/*}}}*/
    3031/*FUNCTION Node::Node(int id, int vertex_id, int uppernode_id, int numdofs, NodeProperties*) {{{2*/
    31 Node::Node(int node_id,int node_vertex_id, int node_upper_node_id, int node_numdofs, NodeProperties* node_properties):
     32Node::Node(int node_id,int node_vertex_id, int node_upper_node_id, int node_numdofs):
    3233        indexing(node_numdofs),
    33         properties(node_properties),
    3434    hvertex(&node_vertex_id,1),
    3535    hupper_node(&node_upper_node_id,1){
    3636
    3737        this->id=node_id;
    38 
    39         return;
    40 }
    41 /*}}}*/
    42 /*FUNCTION Node::Node(int id, DofIndexing* indexing, NodeProperties* properties, Hook* vertex, Hook* uppernode){{{2*/
    43 Node::Node(int node_id,DofIndexing* node_indexing, NodeProperties* node_properties, Hook* node_vertex, Hook* node_upper_node):
     38        this->inputs=new Inputs();
     39}
     40/*}}}*/
     41/*FUNCTION Node::Node(int id, DofIndexing* indexing, Hook* vertex, Hook* uppernode,Inputs* inputs){{{2*/
     42Node::Node(int node_id,DofIndexing* node_indexing, Hook* node_vertex, Hook* node_upper_node,Inputs* node_inputs):
    4443            indexing(node_indexing),
    45                 properties(node_properties),
    4644                hvertex(node_vertex),
    4745                hupper_node(node_upper_node) {
     
    5048            this->id=node_id;
    5149
     50                if(node_inputs){
     51                        this->inputs=(Inputs*)node_inputs->Copy();
     52                }
     53                else{
     54                        this->inputs=new Inputs();
     55                }
    5256}
    5357/*}}}*/
     
    6872
    6973        this->indexing.Init(numdofs);
    70 
    71         /*properties: */
    72         this->properties.Init(i,iomodel);
    7374
    7475        /*hooks: */
     
    159160                }
    160161        }
     162       
     163       
     164        //intialize inputs, and add as many inputs per element as requested:
     165        this->inputs=new Inputs();
     166        if (iomodel->gridonbed) this->inputs->AddInput(new BoolInput(NodeOnBedEnum,(IssmBool)iomodel->gridonbed[i]));
     167        if (iomodel->gridonsurface) this->inputs->AddInput(new BoolInput(NodeOnSurfaceEnum,(IssmBool)iomodel->gridonsurface[i]));
     168        if (iomodel->gridoniceshelf) this->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,(IssmBool)iomodel->gridoniceshelf[i]));
     169        if (iomodel->gridonicesheet) this->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,(IssmBool)iomodel->gridonicesheet[i]));
     170
    161171}
    162172/*}}}*/
     
    178188        this->indexing.Init(numdofs);
    179189
    180         /*properties (come from vertex number i): */
    181         this->properties.Init(
    182                                 (int)iomodel->gridonbed[i],
    183                                 (int)iomodel->gridonsurface[i],
    184                                 (int)iomodel->gridoniceshelf[i],
    185                                 (int)iomodel->gridonicesheet[i]);
    186 
     190       
    187191        /*hooks: */
    188192        vertex_id=i+1; //matlab indexing
     
    203207        this->hvertex.Init(&vertex_id,1);
    204208        this->hupper_node.Init(&upper_node_id,1);
     209       
     210        //intialize inputs, and add as many inputs per element as requested:
     211        this->inputs=new Inputs();
     212        if (iomodel->gridonbed) this->inputs->AddInput(new BoolInput(NodeOnBedEnum,(IssmBool)iomodel->gridonbed[i]));
     213        if (iomodel->gridonsurface) this->inputs->AddInput(new BoolInput(NodeOnSurfaceEnum,(IssmBool)iomodel->gridonsurface[i]));
     214        if (iomodel->gridoniceshelf) this->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,(IssmBool)iomodel->gridoniceshelf[i]));
     215        if (iomodel->gridonicesheet) this->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,(IssmBool)iomodel->gridonicesheet[i]));
     216
    205217
    206218}
     
    208220/*FUNCTION Node::~Node(){{{2*/
    209221Node::~Node(){
     222        delete inputs;
    210223        return;
    211224}
     
    214227/*Object management: {{{1*/
    215228/*FUNCTION Node::Configure {{{2*/
    216 void  Node::Configure(void* pnodes, void* pvertices){
     229void  Node::Configure(DataSet* nodesin){
    217230
    218231        int i;
    219232
    220         DataSet* nodesin=NULL;
    221         DataSet* verticesin=NULL;
    222 
    223         /*Recover pointers :*/
    224         nodesin=(DataSet*)pnodes;
    225         verticesin=(DataSet*)pvertices;
    226 
    227233        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    228          * datasets, using internal ids and ofthis->indexing.f_sets hidden in hooks: */
    229         hvertex.configure(verticesin);
     234         * datasets, using internal ids and offsets hidden in hooks: */
     235        hvertex.configure(nodesin);
    230236        hupper_node.configure(nodesin);
    231237
    232238}
    233 /*}}}*/
    234239/*FUNCTION Node::copy {{{2*/
    235240Object* Node::copy() {
    236241               
    237         return new Node(this->id,&this->indexing, &this->properties, &this->hvertex,&this->hupper_node);
     242        return new Node(this->id,&this->indexing, &this->hvertex,&this->hupper_node,this->inputs);
    238243
    239244}
     
    246251        printf("   id: %i\n",id);
    247252        indexing.DeepEcho();
    248         properties.DeepEcho();
    249253        printf("Vertex:\n");
    250254        hvertex.DeepEcho();
     
    252256        //Do not Deepecho the upper_node otherwise DeepEcho will go crazy!
    253257        hupper_node.Echo();
     258        printf("   inputs\n");
     259        inputs->DeepEcho();
    254260
    255261}
     
    270276        /*demarshall objects: */
    271277        indexing.Demarshall(&marshalled_dataset);
    272         properties.Demarshall(&marshalled_dataset);
    273278        hvertex.Demarshall(&marshalled_dataset);
    274279        hupper_node.Demarshall(&marshalled_dataset);
    275        
     280
     281        /*demarshall inputs: */
     282        inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
     283
    276284        /*return: */
    277285        *pmarshalled_dataset=marshalled_dataset;
     
    285293        printf("   id: %i\n",id);
    286294        indexing.Echo();
    287         properties.Echo();
    288295        hvertex.Echo();
    289296        hupper_node.Echo();
     297        printf("   inputs\n");
     298        inputs->DeepEcho();
     299
    290300
    291301}
     
    348358        char* marshalled_dataset=NULL;
    349359        int   enum_type=0;
     360        char* marshalled_inputs=NULL;
     361        int   marshalled_inputs_size;
    350362
    351363        /*recover marshalled_dataset: */
     
    363375        /*marshall objects: */
    364376        indexing.Marshall(&marshalled_dataset);
    365         properties.Marshall(&marshalled_dataset);
    366377        hvertex.Marshall(&marshalled_dataset);
    367378        hupper_node.Marshall(&marshalled_dataset);
    368379
     380        /*Marshall inputs: */
     381        marshalled_inputs_size=inputs->MarshallSize();
     382        marshalled_inputs=inputs->Marshall();
     383        memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
     384        marshalled_dataset+=marshalled_inputs_size;
     385
     386        /*Free ressources:*/
     387        xfree((void**)&marshalled_inputs);
     388
    369389        *pmarshalled_dataset=marshalled_dataset;
    370390        return;
     
    375395
    376396        return sizeof(id)+
    377                 +indexing.MarshallSize()+
    378                 +properties.MarshallSize()+
    379                 +hvertex.MarshallSize()+
    380                 +hupper_node.MarshallSize()+
     397                indexing.MarshallSize()+
     398                hvertex.MarshallSize()+
     399                hupper_node.MarshallSize()+
     400                inputs->MarshallSize()+
    381401                sizeof(int); //sizeof(int) for enum type
    382402}
     
    513533        int          dofx,dofy;
    514534        int          isnodeonsurface;
     535
     536        bool onbed;
     537        bool onsurface;
    515538       
    516539        Node* node=NULL;
     
    519542        double thickness;
    520543
     544        /*recover parameters: */
     545        inputs->GetParameterValue(&onbed,NodeOnBedEnum);
     546        inputs->GetParameterValue(&onsurface,NodeOnSurfaceEnum);
     547
    521548        /*Are we on the base, not on the surface, and not on a clone node?:*/
    522549       
    523         if(properties.onbed==1 & indexing.clone==0 &properties.onsurface==0){
     550        if(onbed==1 & indexing.clone==0 & onsurface==0){
    524551                       
    525552                vertexdof=this->GetVertexDof();
     
    636663        int   i;
    637664
     665        bool onbed;
     666
     667        /*recover parameters: */
     668        inputs->GetParameterValue(&onbed,NodeOnBedEnum);
     669
    638670        /*Is this node on bed? :*/
    639         if (properties.onbed){
     671        if (onbed){
    640672
    641673                if (strcmp(field_name,"velocity")==0){
     
    802834/*FUNCTION Node::IsOnBed {{{2*/
    803835int   Node::IsOnBed(){
    804         return properties.onbed;
     836
     837        bool onbed;
     838
     839        /*recover parameters: */
     840        inputs->GetParameterValue(&onbed,NodeOnBedEnum);
     841
     842        return onbed;
    805843}
    806844/*}}}*/
    807845/*FUNCTION Node::IsOnSheet {{{2*/
    808846int   Node::IsOnSheet(){
    809         return properties.onsheet;
     847
     848        bool onsheet;
     849
     850        /*recover parameters: */
     851        inputs->GetParameterValue(&onsheet,NodeOnIceSheetEnum);
     852
     853        return onsheet;
    810854}               
    811855/*}}}*/
    812856/*FUNCTION Node::IsOnShelf {{{2*/
    813857int   Node::IsOnShelf(){
    814         return properties.onshelf;
     858       
     859        bool onshelf;
     860
     861        /*recover parameters: */
     862        inputs->GetParameterValue(&onshelf,NodeOnIceShelfEnum);
     863
     864        return onshelf;
    815865}
    816866/*}}}*/
    817867/*FUNCTION Node::IsOnSurface {{{2*/
    818868int   Node::IsOnSurface(){
    819         return properties.onsurface;
     869
     870        bool onsurface;
     871
     872        /*recover parameters: */
     873        inputs->GetParameterValue(&onsurface,NodeOnSurfaceEnum);
     874
     875        return onsurface;
    820876}
    821877/*}}}*/
  • issm/trunk/src/c/objects/Node.h

    r3556 r3632  
    77
    88/*indefinitions: */
    9 class Object;
    10 class Vertex;
    11 struct IoModel;
    12 class Hook;
    13 class DofIndexing;
    14 class NodeProperties;
    15 class Node;
    16 class DofObject;
    17 
    189#include "./Object.h"
    1910#include "./DofObject.h"
    20 #include "../DataSet/DataSet.h"
     11#include "../DataSet/Inputs.h"
    2112#include "./Hook.h"
    22 #include "./Vertex.h"
    2313#include "./DofIndexing.h"
    24 #include "./NodeProperties.h"
    25 #include "../toolkits/toolkits.h"
    2614#include "../ModelProcessorx/IoModel.h"
    2715
     
    3321                               
    3422                DofIndexing    indexing;
    35                 NodeProperties properties;
    3623                Hook           hvertex;
    3724                Hook           hupper_node;
    38 
     25                Inputs*  inputs; //properties of this node
    3926               
    4027        public:
     
    4229                /*FUNCTION constructors, destructors {{{1*/
    4330                Node();
    44                 Node(int id,int vertex_id, int upper_node_id, int numberofdofs, NodeProperties* node_properties);
    45                 Node(int id,DofIndexing* indexing, NodeProperties* properties, Hook* vertex, Hook* upper_node);
    46                 Node(int i, IoModel* iomodel);
    47                 Node(int i,int j,IoModel* iomodel);
     31                Node(int id,int vertex_id, int upper_node_id, int numberofdofs);
     32                Node(int id,DofIndexing* indexing, Hook* vertex, Hook* upper_node, Inputs* inputs);
     33                Node(int id, int i, IoModel* iomodel);
     34                Node(int id, int i,int j,IoModel* iomodel);
    4835                ~Node();
    4936                /*}}}*/
    5037                /*FUNCTION object management {{{1*/
    51                 void  Configure(void* pnodes, void* pvertices);
     38                void  Configure(DataSet* nodes);
    5239                void  DeepEcho();
    5340                void  Demarshall(char** pmarshalled_dataset);
  • issm/trunk/src/c/objects/Pengrid.cpp

    r3623 r3632  
    3535/*FUNCTION Pengrid::Pengrid(int id, int node_ids int matpar_id){{{1*/
    3636Pengrid::Pengrid(int pengrid_id,int pengrid_node_id, int pengrid_element_id,int pengrid_matpar_id):
    37         hnode(pengrid_node_id,1),
    38         helement(pengrid_element_id,1),
    39         hmatice(&pengrid_matice_id,1),
     37        hnode(&pengrid_node_id,1),
     38        helement(&pengrid_element_id,1),
    4039        hmatpar(&pengrid_matpar_id,1)
    4140{
     
    7675}
    7776/*}}}*/
    78 Pengrid::Pengrid(int    pengrid_id, int pengrid_node_id,int pengrid_mparid, int pengrid_dof, int pengrid_active, double pengrid_penalty_offset,int pengrid_thermal_steadystate,int pengrid_stabilize_constraints){
    79        
    80         id=pengrid_id;
    81         node_id=pengrid_node_id;
    82         mparid=pengrid_mparid;
    83         dof=pengrid_dof;
    84         active=pengrid_active;
    85         penalty_offset =pengrid_penalty_offset;
    86         thermal_steadystate=pengrid_thermal_steadystate;
    87         stabilize_constraints=pengrid_stabilize_constraints;
    88 
    89         node_offset=UNDEF;
    90         node=NULL;
    91         matpar=NULL;
    92         matpar_offset=UNDEF;
    93 
    94 
    95         return;
    96 }
    97 /*}}}1*/
    9877/*FUNCTION Pengrid::Pengrid(int index, int id, IoModel* iomodel){{{1*/
    9978Pengrid::Pengrid(int id, int index, IoModel* iomodel){ //i is the element index
     
    11291        pengrid_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object
    11392
    114         this->hnode.Init(pengrid_node_ids,1);
    115         this->helement.Init(pengrid_element_id,1);
     93        this->hnode.Init(&pengrid_node_id,1);
     94        this->helement.Init(&pengrid_element_id,1);
    11695        this->hmatpar.Init(&pengrid_matpar_id,1);
    11796
     
    136115/*Object management*/
    137116/*FUNCTION Pengrid::Configure {{{1*/
    138 void  Pengrid::Configure(DataSet* elementsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin){
     117void  Pengrid::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin){
    139118
    140119        /*Take care of hooking up all objects for this load, ie links the objects in the hooks to their respective
     
    310289
    311290        /*dynamic objects pointed to by hooks: */
    312         Node node=NULL;
     291        Node* node=NULL;
    313292
    314293        /*recover objects from hooks: */
    315         node=(Node**)hnode.deliverp();
     294        node=(Node*)hnode.delivers();
    316295       
    317296        node->GetDofList(&doflist_per_node[0],&numberofdofspernode);
     
    356335        //   The penalty is stable if it doesn't change during to successive iterations.   
    357336
    358         int found=0;
     337        int    found=0;
    359338        const int numgrids=1;
    360 
    361 
    362339        double pressure;
    363340        double temperature;
     
    365342        double meltingpoint;
    366343        int    new_active;
    367         int  dofs1[1]={0};
    368         int  unstable=0;
    369         int  reset_penalties=0;
    370        
    371         ParameterInputs* inputs=NULL;
    372 
     344        int    unstable=0;
     345        int    reset_penalties=0;
     346        int    stabilize_constraints;
     347
     348        /*pointers: */
     349        Node* node=NULL;
     350        Penta* penta=NULL;
     351        Matpar*  matpar=NULL;
     352       
    373353        /*check that pengrid is not a clone (penalty to be added only once)*/
    374354        if (node->IsClone()){
     
    378358        }
    379359
    380         //First recover beta, pressure and temperature vectors;
    381         found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node);
    382         if(!found)ISSMERROR(" could not find pressure in inputs!");
    383 
    384         found=inputs->Recover("temperature",&temperature,1,dofs1,numgrids,(void**)&node);
    385         if(!found)ISSMERROR(" could not find temperature in inputs!");
    386        
    387         found=inputs->Recover("reset_penalties",&reset_penalties);
    388 
    389         if(reset_penalties)zigzag_counter=0;
    390 
    391         //Compute pressure melting point
     360        /*recover pointers: */
     361        node=(Node*)hnode.delivers();
     362        penta=(Penta*)helement.delivers();
     363        matpar=(Matpar*)hmatpar.delivers();
     364
     365        //First recover pressure and temperature values, using the element: */
     366        penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum);
     367        penta->inputs->GetParameterValueAtNode(&temperature,node,TemperatureEnum);
     368
     369        //Recover our data:
     370        inputs->GetParameterValue(&reset_penalties,ResetPenaltiesEnum);
    392371        meltingpoint=matpar->GetMeltingPoint();
    393372        beta=matpar->GetBeta();
    394 
     373        parameters->FindParam(&stabilize_constraints,"stabilize_constraints");
     374       
     375        if(reset_penalties)zigzag_counter=0;
     376
     377        //Compute pressure melting point
    395378        t_pmp=meltingpoint-beta*pressure;
    396379
     
    466449        int found=0;
    467450        double Ke[4][4]={0.0};
    468        
    469         ParameterInputs* inputs=NULL;
    470 
    471         /*recover pointers: */
    472         inputs=(ParameterInputs*)vinputs;
     451        double penalty_offset;
     452
     453        /*pointers: */
     454        Node* node=NULL;
     455        Penta* penta=NULL;
    473456
    474457        /*Get dof list: */
    475458        GetDofList(&doflist[0],&numberofdofspernode);
    476        
    477         /*recover slope: */
    478         found=inputs->Recover("bedslopex",&slope[0],1,dofs1,numgrids,(void**)&node);
    479         if(!found)ISSMERROR(" bedslopex needed in inputs!");
    480         found=inputs->Recover("bedslopey",&slope[1],1,dofs2,numgrids,(void**)&node);
    481         if(!found)ISSMERROR(" bedslopey needed in inputs!");
     459
     460        /*recover pointers: */
     461        node=(Node*)hnode.delivers();
     462        penta=(Penta*)helement.delivers();
     463
     464        //recover slope: */
     465        penta->inputs->GetParameterValueAtNode(&slope[0],node,BedSlopexEnum);
     466        penta->inputs->GetParameterValueAtNode(&slope[1],node,BedSlopeyEnum);
     467       
     468        /*recover parameters: */
     469        parameters->FindParam(&penalty_offset,"penalty_offset");
    482470
    483471        //Create elementary matrix: add penalty to contrain wb (wb=ub*db/dx+vb*db/dy)
     
    507495        double temperature;
    508496        double beta,t_pmp;
    509 
    510         ParameterInputs* inputs=NULL;
     497        double penalty_offset;
     498
     499        /*pointers: */
     500        Node* node=NULL;
     501        Penta* penta=NULL;
     502        Matpar*  matpar=NULL;
     503
     504        /*recover pointers: */
     505        node=(Node*)hnode.delivers();
     506        penta=(Penta*)helement.delivers();
     507        matpar=(Matpar*)hmatpar.delivers();
    511508
    512509        /*check that pengrid is not a clone (penalty to be added only once)*/
    513510        if (node->IsClone()) return;
    514511
    515         /*recover pointers: */
    516         inputs=(ParameterInputs*)vinputs;
    517 
    518         found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node);
    519         if(!found)ISSMERROR(" could not find pressure in inputs!");
    520 
    521         found=inputs->Recover("temperature",&temperature,1,dofs1,numgrids,(void**)&node);
    522         if(!found)ISSMERROR(" could not find temperature in inputs!");
     512        //First recover pressure and temperature values, using the element: */
     513        penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum);
     514        penta->inputs->GetParameterValueAtNode(&temperature,node,TemperatureEnum);
     515
     516        /*recover parameters: */
     517        parameters->FindParam(&penalty_offset,"penalty_offset");
    523518
    524519        /*Get dof list: */
     
    549544        int       doflist[numdof];
    550545        int       numberofdofspernode;
    551 
    552         ParameterInputs* inputs=NULL;
    553 
    554         /*recover pointers: */
    555         inputs=(ParameterInputs*)vinputs;
    556 
    557 
    558         if(!active)return;
     546        double    penalty_offset;
     547
     548        if(!this->active)return;
     549
     550        /*recover parameters: */
     551        parameters->FindParam(&penalty_offset,"penalty_offset");
    559552
    560553        /*Get dof list: */
     
    610603        double latentheat;
    611604        double t_pmp;
    612         double dt;
    613 
    614         ParameterInputs* inputs=NULL;
     605        double dt,penalty_offset;
     606
     607        /*pointers: */
     608        Node* node=NULL;
     609        Penta* penta=NULL;
     610        Matpar*  matpar=NULL;
     611
     612        /*recover pointers: */
     613        node=(Node*)hnode.delivers();
     614        penta=(Penta*)helement.delivers();
     615        matpar=(Matpar*)hmatpar.delivers();
    615616
    616617        /*check that pengrid is not a clone (penalty to be added only once)*/
    617618        if (node->IsClone()) return;
    618619
    619         /*recover pointers: */
    620         inputs=(ParameterInputs*)vinputs;
    621 
    622620        /*Get dof list: */
    623621        GetDofList(&doflist[0],&numberofdofspernode);
    624622
    625         //First recover pressure,melting offset and temperature vectors
    626         found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node);
    627         if(!found)ISSMERROR(" could not find pressure in inputs!");
    628 
    629         found=inputs->Recover("temperature",&temperature,1,dofs1,numgrids,(void**)&node);
    630         if(!found)ISSMERROR(" could not find temperature in inputs!");
    631 
    632         found=inputs->Recover("melting_offset",&melting_offset);
    633         if(!found)ISSMERROR(" could not find melting_offset in inputs!");
    634 
    635         found=inputs->Recover("dt",&dt);
    636         if(!found)ISSMERROR(" could not find dt in inputs!");
     623        //First recover pressure and temperature values, using the element: */
     624        penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum);
     625        penta->inputs->GetParameterValueAtNode(&temperature,node,TemperatureEnum);
     626        inputs->GetParameterValue(&melting_offset,MeltingOffsetEnum);
     627        parameters->FindParam(&dt,"dt");
     628        parameters->FindParam(&penalty_offset,"penalty_offset");
    637629
    638630        meltingpoint=matpar->GetMeltingPoint();
     
    679671        double beta;
    680672        double t_pmp;
    681 
    682         ParameterInputs* inputs=NULL;
     673        double penalty_offset;
     674
     675        /*pointers: */
     676        Node* node=NULL;
     677        Penta* penta=NULL;
     678        Matpar*  matpar=NULL;
    683679
    684680        /*recover pointers: */
    685         inputs=(ParameterInputs*)vinputs;
    686 
    687         if(!active)return;
     681        node=(Node*)hnode.delivers();
     682        penta=(Penta*)helement.delivers();
     683        matpar=(Matpar*)hmatpar.delivers();
     684
     685        if(!this->active)return;
    688686
    689687        /*Get dof list: */
    690688        GetDofList(&doflist[0],&numberofdofspernode);
    691689
    692         //First recover pressure
    693         found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node);
    694         if(!found)ISSMERROR(" could not find pressure in inputs!");
     690        //First recover pressure  and penalty_offset
     691        penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum);
     692        parameters->FindParam(&penalty_offset,"penalty_offset");
    695693
    696694        //Compute pressure melting point
  • issm/trunk/src/c/objects/Pengrid.h

    r3623 r3632  
    3838                /*}}}*/
    3939                /*FUNCTION object management {{{1*/
    40                 void  Configure(void* elements,void* nodes,void* materials);
     40                void  Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin);
    4141                Object* copy();
    4242                void  DeepEcho();
  • issm/trunk/src/c/objects/Penpair.cpp

    r3594 r3632  
    5555/*Object marshall*/
    5656/*FUNCTION Penpair::Configure {{{1*/
    57 
    58 void  Penpair::Configure(void* pelementsin,void* pnodesin,void* pmaterialsin){
    59 
    60         DataSet* nodesin=NULL;
    61 
    62         /*Recover pointers :*/
    63         nodesin=(DataSet*)pnodesin;
     57void  Penpair::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin){
    6458
    6559        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
     
    151145}
    152146/*}}}1*/
    153 /*FUNCTION Penpair::UpdateFromInputs {{{1*/
    154 void  Penpair::UpdateFromInputs(void* inputs){
    155        
    156 }
    157 /*}}}1*/
    158147
    159148/*Object functions*/
    160149/*FUNCTION Penpair::CreateKMatrix {{{1*/
    161150
    162 void  Penpair::CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type){
     151void  Penpair::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){
    163152
    164153        /*No loads applied, do nothing: */
     
    168157/*}}}1*/
    169158/*FUNCTION Penpair::CreatePVector {{{1*/
    170 void  Penpair::CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type){
     159void  Penpair::CreatePVector(Vec pg, int analysis_type,int sub_analysis_type){
    171160
    172161        /*No loads applied, do nothing: */
     
    196185/*}}}1*/
    197186/*FUNCTION Penpair::PenaltyCreateKMatrix {{{1*/
    198 void  Penpair::PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type){
     187void  Penpair::PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type){
    199188       
    200189        /*If you code this piece, don't forget that a penalty will be inactive if it is dealing with clone nodes*/
     
    204193/*}}}1*/
    205194/*FUNCTION Penpair::PenaltyCreatePVector {{{1*/
    206 void  Penpair::PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type){
     195void  Penpair::PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type){
    207196        /*No loads applied, do nothing: */
    208197        return;
  • issm/trunk/src/c/objects/Penpair.h

    r3594 r3632  
    3434                int   GetId();
    3535                int   MyRank();
    36                 void  Configure(void* elements,void* nodes,void* materials);
    37                 void  CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type);
    38                 void  CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type);
    39                 void  UpdateFromInputs(void* inputs);
    40                 void  PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type);
    41                 void  PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type);
     36                void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* vertices,DataSet* materials,Parameters* parameters);
     37                void  CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type);
     38                void  CreatePVector(Vec pg, int analysis_type,int sub_analysis_type);
     39                void  PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type);
     40                void  PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type);
    4241                Object* copy();
    4342
  • issm/trunk/src/c/objects/Penta.h

    r3622 r3632  
    2727class Penta: public Element{
    2828
    29         private:
     29        public:
    3030
    3131                int id;
     
    3636                Parameters* parameters; //pointer to solution parameters
    3737                Inputs* inputs;
    38 
    39         public:
    4038
    4139                /*FUNCTION constructors, destructors {{{1*/
  • issm/trunk/src/c/objects/Sing.h

    r3622 r3632  
    1818class Sing: public Element{
    1919
    20         private:
     20        public:
    2121
    2222                /*ids:*/
     
    3030                Inputs* inputs;
    3131
    32         public:
    3332
    3433                /*constructors, destructors: {{{1*/
  • issm/trunk/src/c/objects/Tria.cpp

    r3622 r3632  
    6363}
    6464/*}}}*/
    65 /*FUNCTION Tria::Tria(int id, int i, IoModel* iomodel){{{1*/
     65/*FUNCTION Tria::Tria(int id, int index, IoModel* iomodel){{{1*/
    6666Tria::Tria(int tria_id, int index, IoModel* iomodel){ //i is the element index
    6767
     
    154154/*FUNCTION Tria::Configure {{{1*/
    155155void  Tria::Configure(DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin){
    156 
    157         int i;
    158156
    159157        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
  • issm/trunk/src/c/objects/Tria.h

    r3622 r3632  
    1717class Tria: public Element{
    1818
    19         private:
     19        public:
    2020
    2121                int  id;
     
    2727                Parameters* parameters; //pointer to solution parameters
    2828                Inputs*  inputs;
    29        
    30         public:
    3129
    3230                /*FUNCTION constructors, destructors {{{1*/
Note: See TracChangeset for help on using the changeset viewer.