Changeset 19254


Ignore:
Timestamp:
04/03/15 18:53:41 (10 years ago)
Author:
schlegel
Message:

CHG: complete implementation of Marshall in Objects

Location:
issm/trunk-jpl/src/c
Files:
64 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.cpp

    r18931 r19254  
    7777}
    7878/*}}}*/
     79void    SpcDynamic::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     80
     81        MARSHALLING_ENUM(SpcDynamicEnum);
     82
     83        MARSHALLING(sid);
     84        MARSHALLING(nodeid);
     85        MARSHALLING(dof);
     86        MARSHALLING(value);
     87        MARSHALLING(analysis_type);
     88        MARSHALLING(isset);
     89        MARSHALLING(penalty);
     90
     91}
     92/*}}}*/
    7993
    8094/*Constraint virtual functions definitions: */
  • TabularUnified issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.h

    r19198 r19254  
    3535                int     Id();
    3636                int     ObjectEnum();
    37                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     37                void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3838
    3939                /*Constraint virtual functions definitions*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.cpp

    r19216 r19254  
    7979}
    8080/*}}}*/
    81 void     SpcStatic::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     81void    SpcStatic::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
    8282
    8383        MARSHALLING_ENUM(SpcStaticEnum);
  • TabularUnified issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.cpp

    r18966 r19254  
    8585}
    8686/*}}}*/
     87void    SpcTransient::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     88
     89        MARSHALLING_ENUM(SpcStaticEnum);
     90
     91        MARSHALLING(sid);
     92        MARSHALLING(nodeid);
     93        MARSHALLING(dof);
     94        MARSHALLING(analysis_type);
     95        MARSHALLING(penalty);
     96        MARSHALLING(nsteps);
     97        if(nsteps){
     98                MARSHALLING_DYNAMIC(values,IssmDouble,nsteps);
     99                MARSHALLING_DYNAMIC(times,IssmDouble,nsteps);
     100        }
     101        else{
     102                values=NULL;
     103                times=NULL;
     104        }
     105
     106}
     107/*}}}*/
    87108
    88109/*Constraint virtual functions definitions:*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.h

    r19198 r19254  
    3636                int     Id();
    3737                int     ObjectEnum();
    38                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     38                void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3939                /*}}}*/
    4040                /*Constraint virtual functions definitions: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Element.cpp

    r19241 r19254  
    15281528       
    15291529        _assert_(this);
    1530         if(marshall_direction==MARSHALLING_BACKWARD) inputs=new Inputs();
     1530        if(marshall_direction==MARSHALLING_BACKWARD){
     1531                inputs=new Inputs();
     1532                nodes = NULL;
     1533        }
    15311534
    15321535        MARSHALLING_ENUM(ElementEnum);
     
    15361539        MARSHALLING(element_type);
    15371540        MARSHALLING_DYNAMIC(element_type_list,int,numanalyses);
     1541        inputs->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    15381542
    15391543}
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp

    r19237 r19254  
    126126        }
    127127        this->hvertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    128         this->hmatpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     128        this->hmaterial->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    129129        this->hmatpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    130130        if(this->hneighbors)this->hneighbors->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    131131
    132132        /*Free ressources: */
    133         xDelete<bool>(hnodesi_null);
     133        if(hnodesi_null) xDelete<bool>(hnodesi_null);
    134134
    135135}
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r19237 r19254  
    120120
    121121        return penta;
     122
     123}
     124/*}}}*/
     125void Penta::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     126
     127        MARSHALLING_ENUM(PentaEnum);
     128
     129        /*Call parent classes: */
     130        ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     131        Element::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
     132        PentaRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     133
     134        vertices = (Vertex**)this->hvertices->deliverp();
     135        material = (Material*)this->hmaterial->delivers();
     136        matpar   = (Matpar*)this->hmatpar->delivers();
     137        verticalneighbors = (Penta**)this->hneighbors->deliverp();
    122138
    123139}
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Penta.h

    r19237 r19254  
    4242                Object *copy();
    4343                int     ObjectEnum();
    44                 void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
     44                void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    4545                /*}}}*/
    4646                /*Penta routines:{{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/PentaRef.h

    r18925 r19254  
    3333                int  TensorInterpolation(int fe_stokes);
    3434                int  VelocityInterpolation(int fe_stokes);
     35                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
    3536};
    3637#endif
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Seg.cpp

    r18924 r19254  
    4747/*}}}*/
    4848Object* Seg::copy(){/*{{{*/
    49         _error_("not implemented yet");
     49
     50        int i;
     51        Seg* seg=NULL;
     52
     53        seg=new Seg();
     54
     55        //deal with TriaRef mother class
     56        int nanalyses = this->numanalyses;
     57        if(nanalyses > 0){
     58                seg->element_type_list=xNew<int>(nanalyses);
     59                for(i=0;i<nanalyses;i++){
     60                        if (this->element_type_list[i]) seg->element_type_list[i]=this->element_type_list[i];
     61                        else seg->element_type_list[i] = 0;
     62                }
     63        }
     64        else seg->element_type_list = NULL;
     65        seg->element_type=this->element_type;
     66        seg->numanalyses=nanalyses;
     67
     68        //deal with ElementHook mother class
     69        if (this->hnodes){
     70                seg->hnodes=xNew<Hook*>(seg->numanalyses);
     71                for(i=0;i<seg->numanalyses;i++){
     72                        if (this->hnodes[i]) seg->hnodes[i] = (Hook*)(this->hnodes[i]->copy());
     73                        else seg->hnodes[i] = NULL;
     74                }
     75        }
     76        else seg->hnodes = NULL;
     77
     78        seg->hvertices = (Hook*)this->hvertices->copy();
     79        seg->hmaterial = (Hook*)this->hmaterial->copy();
     80        seg->hmatpar   = (Hook*)this->hmatpar->copy();
     81        seg->hneighbors = NULL;
     82
     83        /*deal with Element fields: */
     84        seg->id  = this->id;
     85        seg->sid = this->sid;
     86        if(this->inputs) seg->inputs = (Inputs*)(this->inputs->Copy());
     87        else seg->inputs=new Inputs();
     88
     89        /*point parameters: */
     90        seg->parameters=this->parameters;
     91
     92        /*recover objects: */
     93        if (this->nodes){
     94                unsigned int num_nodes = 3;
     95                seg->nodes = xNew<Node*>(num_nodes); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
     96                for(i=0;i<num_nodes;i++) if(this->nodes[i]) seg->nodes[i]=this->nodes[i]; else seg->nodes[i] = NULL;
     97        }
     98        else seg->nodes = NULL;
     99
     100        seg->vertices = (Vertex**)this->hvertices->deliverp();
     101        seg->material = (Material*)this->hmaterial->delivers();
     102        seg->matpar   = (Matpar*)this->hmatpar->delivers();
     103
     104        return seg;
     105
     106
     107}
     108/*}}}*/
     109void Seg::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     110
     111        MARSHALLING_ENUM(SegEnum);
     112
     113        /*Call parent classes: */
     114        ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     115        Element::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
     116        SegRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     117
     118        vertices = (Vertex**)this->hvertices->deliverp();
     119        material = (Material*)this->hmaterial->delivers();
     120        matpar   = (Matpar*)this->hmatpar->delivers();
     121
    50122}
    51123/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Seg.h

    r19237 r19254  
    3838                int     ObjectEnum();
    3939                Object *copy();
    40                 void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
     40                void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    4141                /*}}}*/
    4242                /*Element virtual functions definitions: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/SegRef.h

    r18925 r19254  
    2525                void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss,int finiteelement);
    2626                int  NumberofNodes(int finiteelement);
     27                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
    2728};
    2829#endif
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp

    r18923 r19254  
    9292
    9393        /*recover objects: */
    94         unsigned int num_nodes = 3;
     94        unsigned int num_nodes = 4;
    9595        tetra->nodes = xNew<Node*>(num_nodes); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
    9696        for(i=0;i<num_nodes;i++) if(this->nodes[i]) tetra->nodes[i]=this->nodes[i]; else tetra->nodes[i] = NULL;
     
    101101
    102102        return tetra;
     103}
     104/*}}}*/
     105void Tetra::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     106
     107        MARSHALLING_ENUM(TetraEnum);
     108
     109        /*Call parent classes: */
     110        ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     111        Element::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
     112        TetraRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     113
     114        vertices = (Vertex**)this->hvertices->deliverp();
     115        material = (Material*)this->hmaterial->delivers();
     116        matpar   = (Matpar*)this->hmatpar->delivers();
     117
    103118}
    104119/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tetra.h

    r19237 r19254  
    3838                int     ObjectEnum();
    3939                Object *copy();
    40                 void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
     40                void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    4141                /*}}}*/
    4242                /*Element virtual functions definitions: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/TetraRef.h

    r18925 r19254  
    2929                int  TensorInterpolation(int fe_stokes);
    3030                int  VelocityInterpolation(int fe_stokes);
     31                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
    3132};
    3233#endif
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r19237 r19254  
    107107        else tria->nodes = NULL;
    108108       
    109 
    110109        tria->vertices = (Vertex**)this->hvertices->deliverp();
    111110        tria->material = (Material*)this->hmaterial->delivers();
     
    130129}
    131130/*}}}*/
    132 
    133131
    134132/*Other*/
  • TabularUnified issm/trunk-jpl/src/c/classes/FemModel.cpp

    r19240 r19254  
    8484        xDelete<char>(outbinfilename);
    8585        xDelete<char>(petscfilename);
     86        xDelete<char>(restartfilename);
    8687        xDelete<char>(rootpath);
    8788
     
    625626        this->Marshall(NULL,&femmodel_size,MARSHALLING_SIZE);
    626627        femmodel_buffer=xNew<char>(femmodel_size);
    627 
    628628        /*Keep track of initial position of femmodel_buffer: */
    629629        femmodel_buffer_ini=femmodel_buffer;
     
    662662        restartfid=pfopen(restartfilename,"r",false);
    663663
    664         if(restartfid==NULL)return; //could not find the file, so no restart possible.
     664        if(restartfid==NULL){
     665                xDelete<char>(restartfilename);
     666                return; //could not find the file, so no restart possible.
     667        }
    665668
    666669        /*Figure out size of buffer to be read: */
     
    673676
    674677        /*Read buffer from file: */
    675         fread_return=fread(femmodel_buffer,femmodel_size,1,restartfid); if(fread_return!=1)_error_("error reading the buffer from marshalled file!");
     678        fread_return=fread(femmodel_buffer,femmodel_size,sizeof(char),restartfid); if(fread_return!=1)_error_("error reading the buffer from marshalled file!");
    676679        femmodel_buffer_ini=femmodel_buffer; //keep track of the initial position, so as to free later.
    677680
    678681        /*Create new FemModel by demarshalling the buffer: */
    679682        this->Marshall(&femmodel_buffer,NULL,MARSHALLING_BACKWARD);
     683
     684        /*Reset position of buffer: */
     685        femmodel_buffer=femmodel_buffer_ini;
    680686
    681687        /*Done, close file :*/
     
    690696void FemModel::Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
    691697
     698        int       i;
     699        int       analysis_type;
     700
    692701        if(marshall_direction==MARSHALLING_BACKWARD){
    693                 delete profiler; profiler=new Profiler;
    694                 delete elements; elements=new Elements();
    695                 delete nodes; nodes=new Nodes();
    696                 delete vertices; vertices=new Vertices();
    697                 delete constraints; constraints=new Constraints();
     702                delete profiler; profiler=new Profiler();
    698703                delete loads; loads=new Loads();
    699704                delete materials; materials=new Materials();
    700705                delete parameters; parameters=new Parameters();
     706                delete constraints; constraints=new Constraints();
    701707                delete results; results=new Results();
     708                delete nodes; nodes=new Nodes();
     709                delete vertices; vertices=new Vertices();
     710                delete elements; elements=new Elements();
    702711                xDelete<int>(analysis_type_list);
    703712        }
     
    707716        MARSHALLING(solution_type);
    708717        MARSHALLING(analysis_counter);
    709         MARSHALLING_DYNAMIC(analysis_type_list,int,analysis_counter);
     718        MARSHALLING(nummodels);
     719        MARSHALLING_DYNAMIC(analysis_type_list,int,nummodels);
    710720
    711721        profiler->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    712         elements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    713         nodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    714         vertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    715         constraints->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    716722        loads->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    717723        materials->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    718724        parameters->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     725        constraints->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    719726        results->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     727        nodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     728        vertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     729        elements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     730
     731        if(marshall_direction==MARSHALLING_BACKWARD){
     732                //reset hooks for elements, loads and nodes:
     733                elements->ResetHooks();
     734                loads->ResetHooks();
     735                materials->ResetHooks();
     736
     737                //do the post-processing of the datasets to get an FemModel that can actually run analyses:
     738                for(i=0;i<nummodels;i++){
     739                        analysis_type=analysis_type_list[i];
     740                        SetCurrentConfiguration(analysis_type);
     741                        if(i==0) VerticesDofx(vertices,parameters); //only call once, we only have one set of vertices
     742                        SpcNodesx(nodes,constraints,parameters,analysis_type);
     743                        NodesDofx(nodes,parameters,analysis_type);
     744                        ConfigureObjectsx(elements,loads,nodes,vertices,materials,parameters);
     745                }
     746        }
    720747
    721748}
  • TabularUnified issm/trunk-jpl/src/c/classes/Hook.cpp

    r19238 r19254  
    126126        MARSHALLING_ENUM(HookEnum);
    127127        MARSHALLING(num);
    128         MARSHALLING_DYNAMIC(ids,int,num);
    129         MARSHALLING_DYNAMIC(offsets,int,num);
     128        if (num<=0){
     129                /*Empty hook*/
     130                this->ids     = NULL;
     131                this->objects = NULL;
     132                this->offsets = NULL;
     133                this->num = 0;
     134        }
     135        else{
     136                MARSHALLING_DYNAMIC(ids,int,num);
     137                MARSHALLING_DYNAMIC(offsets,int,num);
     138                MARSHALLING_DYNAMIC(objects,Object*,num);
     139        }
    130140
    131141}
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp

    r18450 r19254  
    3838}
    3939/*}}}*/
    40 int    BoolInput::Id(void){ return -1; }/*{{{*/
     40int  BoolInput::Id(void){ return -1; }/*{{{*/
    4141/*}}}*/
    42 int BoolInput::ObjectEnum(void){/*{{{*/
     42int  BoolInput::ObjectEnum(void){/*{{{*/
    4343
    4444        return BoolInputEnum;
     
    4949
    5050        return new BoolInput(this->enum_type,this->value);
     51
     52}
     53/*}}}*/
     54void BoolInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     55
     56        MARSHALLING_ENUM(BoolInputEnum);
     57
     58        MARSHALLING(enum_type);
     59        MARSHALLING(value);
    5160
    5261}
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h

    r19198 r19254  
    2727                int     ObjectEnum();
    2828                Object *copy();
    29                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     29                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3030                /*}}}*/
    3131                /*BoolInput management: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp

    r18521 r19254  
    7171}
    7272/*}}}*/
    73 int    ControlInput::Id(void){ return -1; }/*{{{*/
    74 /*}}}*/
    75 int ControlInput::ObjectEnum(void){/*{{{*/
     73int  ControlInput::Id(void){ return -1; }/*{{{*/
     74/*}}}*/
     75int  ControlInput::ObjectEnum(void){/*{{{*/
    7676
    7777        return ControlInputEnum;
     
    9696}
    9797/*}}}*/
     98void ControlInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     99
     100        MARSHALLING_ENUM(ControlInputEnum);
     101
     102        MARSHALLING(enum_type);
     103        MARSHALLING(control_id);
     104
     105        if (marshall_direction == MARSHALLING_BACKWARD){
     106                switch(enum_type){
     107                        case TriaInputEnum:
     108                                values     =new TriaInput();
     109                                savedvalues=new TriaInput();
     110                                minvalues  =new TriaInput();
     111                                maxvalues  =new TriaInput();
     112                                gradient   =new TriaInput();
     113                                break;
     114                        case PentaInputEnum:
     115                                values     =new PentaInput();
     116                                savedvalues=new PentaInput();
     117                                minvalues  =new PentaInput();
     118                                maxvalues  =new PentaInput();
     119                                gradient   =new PentaInput();
     120                                break;
     121                        default:
     122                                _error_("Input of Enum " << EnumToStringx(enum_type) << " not supported yet by ControlInput");
     123                }
     124        }
     125        if(values) this->values->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     126        if(savedvalues) this->savedvalues->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     127        if(minvalues) this->minvalues->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     128        if(maxvalues) this->maxvalues->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     129        if(gradient) this->gradient->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     130}
     131/*}}}*/
    98132
    99133/*ControlInput management*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h

    r19198 r19254  
    3535                int   ObjectEnum();
    3636                Object* copy();
    37                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     37                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3838                /*}}}*/
    3939                /*ControlInput management: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp

    r18521 r19254  
    7171
    7272        return (Object*)output;
     73}
     74/*}}}*/
     75void DatasetInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     76
     77        MARSHALLING_ENUM(DatasetInputEnum);
     78
     79        MARSHALLING(enum_type);
     80        MARSHALLING(numids);
     81        MARSHALLING_DYNAMIC(ids,int,numids)
     82        if (marshall_direction == MARSHALLING_BACKWARD) inputs = new Inputs();
     83        inputs->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     84
    7385}
    7486/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h

    r19198 r19254  
    3232                int   ObjectEnum();
    3333                Object* copy();
    34                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     34                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3535                /*}}}*/
    3636                /*DatasetInput management: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp

    r18064 r19254  
    5252}
    5353/*}}}*/
     54void DoubleInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     55
     56        MARSHALLING_ENUM(DoubleInputEnum);
     57
     58        MARSHALLING(enum_type);
     59        MARSHALLING(value);
     60
     61}
     62/*}}}*/
    5463
    5564/*DoubleInput management*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h

    r19198 r19254  
    3030                int   ObjectEnum();
    3131                Object* copy();
    32                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     32                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3333                /*}}}*/
    3434                /*DoubleInput management: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp

    r18064 r19254  
    3434}
    3535/*}}}*/
    36 int    IntInput::Id(void){ return -1; }/*{{{*/
     36int  IntInput::Id(void){ return -1; }/*{{{*/
    3737/*}}}*/
    38 int IntInput::ObjectEnum(void){/*{{{*/
     38int  IntInput::ObjectEnum(void){/*{{{*/
    3939
    4040        return IntInputEnum;
     
    4545
    4646        return new IntInput(this->enum_type,this->value);
     47
     48}
     49/*}}}*/
     50void IntInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     51
     52        MARSHALLING_ENUM(IntInputEnum);
     53
     54        MARSHALLING(enum_type);
     55        MARSHALLING(value);
    4756
    4857}
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/IntInput.h

    r19198 r19254  
    3131                int   ObjectEnum();
    3232                Object* copy();
    33                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     33                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3434                /*}}}*/
    3535                /*IntInput management: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp

    r18472 r19254  
    2828        if (numnodes > 0){
    2929                this->values=xNew<IssmDouble>((unsigned int)numnodes);
    30                 for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i];
     30                for(int i=0;i<numnodes;i++) values[i]=in_values[i];
    3131        }
    3232        else{
     
    5353}
    5454/*}}}*/
    55 int    PentaInput::Id(void){ return -1; }/*{{{*/
    56 /*}}}*/
    57 int PentaInput::ObjectEnum(void){/*{{{*/
     55int  PentaInput::Id(void){ return -1; }/*{{{*/
     56/*}}}*/
     57int  PentaInput::ObjectEnum(void){/*{{{*/
    5858
    5959        return PentaInputEnum;
     
    6565        return new PentaInput(this->enum_type,this->values,this->interpolation_type);
    6666
     67}
     68/*}}}*/
     69void PentaInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     70
     71        MARSHALLING_ENUM(PentaInputEnum);
     72
     73        MARSHALLING(enum_type);
     74        MARSHALLING(interpolation_type);
     75
     76        int numnodes = this->NumberofNodes(this->interpolation_type);
     77        if(numnodes > 0){
     78                MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
     79        }
     80        else this->values = NULL;
    6781}
    6882/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h

    r19198 r19254  
    3232                int     ObjectEnum();
    3333                Object *copy();
    34                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     34                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3535
    3636                /*PentaInput management*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp

    r18078 r19254  
    4545}
    4646/*}}}*/
    47 int    SegInput::Id(void){ return -1; }/*{{{*/
     47int  SegInput::Id(void){ return -1; }/*{{{*/
    4848/*}}}*/
    49 int SegInput::ObjectEnum(void){/*{{{*/
     49int  SegInput::ObjectEnum(void){/*{{{*/
    5050
    5151        return SegInputEnum;
     
    5757        return new SegInput(this->enum_type,this->values,this->interpolation_type);
    5858
     59}
     60/*}}}*/
     61void SegInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     62
     63        MARSHALLING_ENUM(SegInputEnum);
     64
     65        MARSHALLING(enum_type);
     66        MARSHALLING(interpolation_type);
     67
     68        int numnodes = this->NumberofNodes(this->interpolation_type);
     69        if(numnodes > 0){
     70                MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
     71        }
     72        else this->values = NULL;
    5973}
    6074/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/SegInput.h

    r19198 r19254  
    3232                int     ObjectEnum();
    3333                Object *copy();
    34                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     34                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3535
    3636                /*SegInput management:*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/TetraInput.cpp

    r18237 r19254  
    2828        if (numnodes > 0){
    2929                this->values=xNew<IssmDouble>((unsigned int)numnodes);
    30                 for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i];
     30                for(int i=0;i<numnodes;i++) values[i]=in_values[i];
    3131        }
    3232        else{
     
    5353}
    5454/*}}}*/
    55 int    TetraInput::Id(void){ return -1; }/*{{{*/
    56 /*}}}*/
    57 int TetraInput::ObjectEnum(void){/*{{{*/
     55int  TetraInput::Id(void){ return -1; }/*{{{*/
     56/*}}}*/
     57int  TetraInput::ObjectEnum(void){/*{{{*/
    5858
    5959        return TetraInputEnum;
     
    6565        return new TetraInput(this->enum_type,this->values,this->interpolation_type);
    6666
     67}
     68/*}}}*/
     69void TetraInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     70
     71        MARSHALLING_ENUM(TetraInputEnum);
     72
     73        MARSHALLING(enum_type);
     74        MARSHALLING(interpolation_type);
     75
     76        int numnodes = this->NumberofNodes(this->interpolation_type);
     77        if(numnodes > 0){
     78                MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
     79        }
     80        else this->values = NULL;
    6781}
    6882/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h

    r19198 r19254  
    3232                int     ObjectEnum();
    3333                Object *copy();
    34                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     34                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3535
    3636                /*TetraInput management:*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp

    r18450 r19254  
    102102        return (Object*)output;
    103103
     104}
     105/*}}}*/
     106void TransientInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     107
     108        if (marshall_direction == MARSHALLING_BACKWARD) inputs = new Inputs();
     109
     110        MARSHALLING_ENUM(TransientInputEnum);
     111
     112        MARSHALLING(enum_type);
     113        MARSHALLING(numtimesteps);
     114        MARSHALLING_DYNAMIC(this->timesteps,IssmDouble,numtimesteps);
     115        inputs->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    104116}
    105117/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h

    r19198 r19254  
    3737                int   ObjectEnum();
    3838                Object* copy();
    39                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     39                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    4040                /*}}}*/
    4141                /*TransientInput management: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp

    r18237 r19254  
    2828        if (numnodes > 0){
    2929                this->values=xNew<IssmDouble>((unsigned int)numnodes);
    30                 for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i];
     30                for(int i=0;i<numnodes;i++) values[i]=in_values[i];
    3131        }
    3232        else{
     
    6464        return new TriaInput(this->enum_type,this->values,this->interpolation_type);
    6565
     66}
     67/*}}}*/
     68void TriaInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     69
     70        MARSHALLING_ENUM(TriaInputEnum);
     71
     72        MARSHALLING(enum_type);
     73        MARSHALLING(interpolation_type);
     74
     75        int numnodes = this->NumberofNodes(this->interpolation_type);
     76        if(numnodes > 0){
     77                MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
     78        }
     79        else this->values = NULL;
    6680}
    6781/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h

    r19198 r19254  
    3232                int     ObjectEnum();
    3333                Object *copy();
    34                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     34                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3535
    3636                /*TriaInput management:*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp

    r18926 r19254  
    156156
    157157        return numericalflux;
     158}
     159/*}}}*/
     160void    Numericalflux::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     161
     162        _assert_(this);
     163
     164        /*ok, marshall operations: */
     165        MARSHALLING_ENUM(NumericalfluxEnum);
     166        MARSHALLING(id);
     167        MARSHALLING(analysis_type);
     168        MARSHALLING(flux_type);
     169
     170        if(marshall_direction==MARSHALLING_BACKWARD){
     171                this->hnodes      = new Hook();
     172                this->hvertices   = new Hook();
     173                this->helement    = new Hook();
     174        }
     175
     176        this->hnodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     177        this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     178        this->hvertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     179
     180        /*corresponding fields*/
     181        nodes    =(Node**)this->hnodes->deliverp();
     182        vertices =(Vertex**)this->hvertices->deliverp();
     183        element  =(Element*)this->helement->delivers();
     184
    158185}
    159186/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h

    r19198 r19254  
    4545                int     Id();
    4646                int     ObjectEnum();
    47                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     47                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    4848                /*}}}*/
    4949                /*Update virtual functions resolution: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp

    r18946 r19254  
    105105
    106106        //let's not forget internals
    107         pengrid->active=this->active=0;
    108         pengrid->zigzag_counter=this->zigzag_counter=0;
     107        pengrid->active=this->active;
     108        pengrid->zigzag_counter=this->zigzag_counter;
    109109
    110110        return pengrid;
     111
     112}
     113/*}}}*/
     114void    Pengrid::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     115
     116        _assert_(this);
     117
     118        /*ok, marshall operations: */
     119        MARSHALLING_ENUM(PengridEnum);
     120        MARSHALLING(id);
     121        MARSHALLING(analysis_type);
     122
     123        if(marshall_direction==MARSHALLING_BACKWARD){
     124                this->hnode      = new Hook();
     125                this->helement   = new Hook();
     126                this->hmatpar    = new Hook();
     127        }
     128
     129        this->hnode->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     130        this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     131        this->hmatpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     132
     133        /*corresponding fields*/
     134        node   =(Node*)this->hnode->delivers();
     135        matpar =(Matpar*)this->hmatpar->delivers();
     136        element=(Element*)this->helement->delivers();
     137
     138        MARSHALLING(active);
     139        MARSHALLING(zigzag_counter);
    111140
    112141}
  • TabularUnified issm/trunk-jpl/src/c/classes/Loads/Pengrid.h

    r19198 r19254  
    5555                int   ObjectEnum();
    5656                Object* copy();
    57                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     57                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    5858                /*}}}*/
    5959                /*Update virtual functions resolution: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Loads/Penpair.cpp

    r18926 r19254  
    6363
    6464        return penpair;
     65
     66}
     67/*}}}*/
     68void    Penpair::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     69
     70        _assert_(this);
     71
     72        /*ok, marshall operations: */
     73        MARSHALLING_ENUM(PenpairEnum);
     74        MARSHALLING(id);
     75        MARSHALLING(analysis_type);
     76
     77        if(marshall_direction==MARSHALLING_BACKWARD){
     78                this->hnodes = new Hook();
     79        }
     80        this->hnodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     81
     82        /*corresponding fields*/
     83        nodes = (Node**)this->hnodes->deliverp();
    6584
    6685}
  • TabularUnified issm/trunk-jpl/src/c/classes/Loads/Penpair.h

    r19198 r19254  
    3636                int      Id();
    3737                int      ObjectEnum();
    38                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     38                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3939                /*}}}*/
    4040                /*Update virtual functions resolution: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp

    r18946 r19254  
    150150
    151151        return riftfront;
     152
     153}
     154/*}}}*/
     155void    Riftfront::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     156
     157        _assert_(this);
     158
     159        /*ok, marshall operations: */
     160        MARSHALLING_ENUM(RiftfrontEnum);
     161        MARSHALLING(id);
     162        MARSHALLING(analysis_type);
     163        MARSHALLING(type);
     164        MARSHALLING(fill);
     165        MARSHALLING(friction);
     166        MARSHALLING(fractionincrement);
     167        MARSHALLING(shelf);
     168
     169        if(marshall_direction==MARSHALLING_BACKWARD){
     170                this->hnodes      = new Hook();
     171                this->hmatpar     = new Hook();
     172                this->helements   = new Hook();
     173        }
     174
     175        this->hnodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     176        this->hmatpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     177        this->helements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     178
     179        /*corresponding fields*/
     180        nodes     =(Node**)this->hnodes->deliverp();
     181        matpar    =(Matpar*)this->hmatpar->delivers();
     182        elements  =(Element**)this->helements->deliverp();
     183
     184        MARSHALLING(penalty_lock);
     185        MARSHALLING(active);
     186        MARSHALLING(frozen);
     187        MARSHALLING(state);
     188        MARSHALLING(counter);
     189        MARSHALLING(prestable);
     190        MARSHALLING(material_converged);
     191        MARSHALLING(normal[0]);
     192        MARSHALLING(normal[1]);
     193        MARSHALLING(length);
     194        MARSHALLING(fraction);
    152195
    153196}
  • TabularUnified issm/trunk-jpl/src/c/classes/Loads/Riftfront.h

    r19198 r19254  
    6262                int      Id();
    6363                int      ObjectEnum();
    64                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     64                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    6565                /*}}}*/
    6666                /*Update virtual functions resolution: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Materials/Matice.cpp

    r19216 r19254  
    122122}
    123123/*}}}*/
    124 void       Matice::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     124void      Matice::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
    125125
    126126        if(marshall_direction==MARSHALLING_BACKWARD)helement=new Hook();
     
    130130        MARSHALLING(isdamaged);
    131131        this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    132 
     132        this->element=(Element*)this->helement->delivers();
    133133
    134134}
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/BoolParam.cpp

    r19216 r19254  
    6363}
    6464/*}}}*/
    65 
    6665               
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.cpp

    r19222 r19254  
    128128        MARSHALLING(enum_type);
    129129        MARSHALLING(M);
    130         MARSHALLING_DYNAMIC(mdim_array,int,M);
    131         MARSHALLING_DYNAMIC(ndim_array,int,M);
    132 
    133         if(marshall_direction==MARSHALLING_BACKWARD)if(M)array=xNew<IssmDouble*>(M);
    134 
    135         for(int i=0;i<M;i++){
    136                 MARSHALLING_DYNAMIC(array[i],IssmDouble,mdim_array[i]*ndim_array[i]);
    137         }
    138                
     130        if(M){
     131                MARSHALLING_DYNAMIC(mdim_array,int,M);
     132                MARSHALLING_DYNAMIC(ndim_array,int,M);
     133                if(marshall_direction==MARSHALLING_BACKWARD && M) array=xNew<IssmDouble*>(M);
     134                for(int i=0;i<M;i++){
     135                        MARSHALLING_DYNAMIC(array[i],IssmDouble,mdim_array[i]*ndim_array[i]);
     136                }
     137        }
     138        else{
     139                array=NULL;
     140                mdim_array=NULL;
     141                ndim_array=NULL;
     142        }
    139143
    140144}
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp

    r19217 r19254  
    2525        M=in_M;
    2626
    27         values=xNew<IssmDouble>(M);
    28         xMemCpy<IssmDouble>(values,in_values,M);
     27        if(M){
     28                values=xNew<IssmDouble>(M);
     29                xMemCpy<IssmDouble>(values,in_values,M);
     30        }
     31        else values=NULL;
    2932}
    3033/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/FileParam.cpp

    r19222 r19254  
    4141}
    4242/*}}}*/
    43 int    FileParam::Id(void){ return -1; }/*{{{*/
     43int  FileParam::Id(void){ return -1; }/*{{{*/
    4444/*}}}*/
    45 int FileParam::ObjectEnum(void){/*{{{*/
     45int  FileParam::ObjectEnum(void){/*{{{*/
    4646
    4747        return FileParamEnum;
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/GenericParam.h

    r19198 r19254  
    5252                // use the default copy constructor instead
    5353                Object* copy() { return new GenericParam<P>(*this); };
    54                                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     54                                         void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
    5555                /*}}}*/
    5656                /*Param vritual function definitions: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/IntMatParam.cpp

    r19222 r19254  
    5959}
    6060/*}}}*/
    61 int    IntMatParam::Id(void){ return -1; }/*{{{*/
     61int  IntMatParam::Id(void){ return -1; }/*{{{*/
    6262/*}}}*/
    63 int IntMatParam::ObjectEnum(void){/*{{{*/
     63int  IntMatParam::ObjectEnum(void){/*{{{*/
    6464
    6565        return IntMatParamEnum;
     
    8383}
    8484/*}}}*/
    85 
    8685
    8786/*IntMatParam virtual functions definitions: */
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/IntParam.cpp

    r19215 r19254  
    4141}
    4242/*}}}*/
    43 int    IntParam::Id(void){ return -1; }/*{{{*/
     43int  IntParam::Id(void){ return -1; }/*{{{*/
    4444/*}}}*/
    45 int IntParam::ObjectEnum(void){/*{{{*/
     45int  IntParam::ObjectEnum(void){/*{{{*/
    4646
    4747        return IntParamEnum;
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/IntVecParam.cpp

    r19222 r19254  
    7171}
    7272/*}}}*/
    73 int    IntVecParam::Id(void){ return -1; }/*{{{*/
     73int  IntVecParam::Id(void){ return -1; }/*{{{*/
    7474/*}}}*/
    75 int IntVecParam::ObjectEnum(void){/*{{{*/
     75int  IntVecParam::ObjectEnum(void){/*{{{*/
    7676
    7777        return IntVecParamEnum;
     
    9191        MARSHALLING(enum_type);
    9292        MARSHALLING(M);
    93         MARSHALLING_DYNAMIC(values,int,M);
     93        if(M) {
     94                MARSHALLING_DYNAMIC(values,int,M);
     95        }
     96        else values=NULL;
    9497
    9598}
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/MatrixParam.cpp

    r18064 r19254  
    5050}
    5151/*}}}*/
    52 int    MatrixParam::Id(void){ return -1; }/*{{{*/
     52int  MatrixParam::Id(void){ return -1; }/*{{{*/
    5353/*}}}*/
    5454int MatrixParam::ObjectEnum(void){/*{{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/Parameters.cpp

    r18521 r19254  
    465465
    466466                param=xDynamicCast<Param*>(*object);
    467                 if(param->InstanceEnum()==enum_type){
     467                if(param && param->InstanceEnum()==enum_type){
    468468                        return (*object);
    469469                }
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/StringArrayParam.cpp

    r19217 r19254  
    8888                if(numstrings)sizes=xNew<int>(numstrings);
    8989                for(int i=0;i<numstrings;i++)sizes[i]=strlen(value[i])+1;
    90         }
     90        }       
    9191
    9292        MARSHALLING_ENUM(StringArrayParamEnum);
     
    9797        if(numstrings){
    9898                MARSHALLING_DYNAMIC(sizes,int,numstrings);
    99                
    10099                if(marshall_direction==MARSHALLING_BACKWARD) value=xNew<char*>(numstrings);
    101                
    102100                for(int i=0;i<numstrings;i++)MARSHALLING_DYNAMIC(value[i],char,sizes[i]);
    103101        }
     102        else value=NULL;
     103
     104        //cleanup sizes array
     105        if(sizes) xDelete<int>(sizes);
    104106
    105107}
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/StringParam.cpp

    r19222 r19254  
    6767        MARSHALLING_DYNAMIC(value,char,size);
    6868
    69 
    7069}
    7170/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/TransientParam.cpp

    r19236 r19254  
    7474}
    7575/*}}}*/
     76void TransientParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
     77
     78        MARSHALLING_ENUM(TransientParamEnum);
     79
     80        MARSHALLING(enum_type);
     81        MARSHALLING(interpolation);
     82        MARSHALLING(N);
     83        if(marshall_direction==MARSHALLING_BACKWARD){
     84                values=xNew<IssmDouble>(N);
     85                timesteps=xNew<IssmDouble>(N);
     86        }
     87        MARSHALLING_ARRAY(values,IssmDouble,N);
     88        MARSHALLING_ARRAY(timesteps,IssmDouble,N);
     89
     90}
     91/*}}}*/
    7692
    7793/*TransientParam virtual functions definitions: */
  • TabularUnified issm/trunk-jpl/src/c/classes/Params/TransientParam.h

    r19236 r19254  
    3939                int   ObjectEnum();
    4040                Object* copy();
    41                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
     41                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    4242                /*}}}*/
    4343                /*Param vritual function definitions: {{{*/
  • TabularUnified issm/trunk-jpl/src/c/datastructures/DataSet.cpp

    r19240 r19254  
    9090       
    9191        vector<Object*>::iterator obj;
    92         int obj_enum;
     92        int obj_size=0;
     93        int obj_enum=0;
    9394        int i;
    9495
    9596        if(marshall_direction==MARSHALLING_FORWARD || marshall_direction==MARSHALLING_SIZE){
    96                 numsorted=objects.size();
     97                obj_size=objects.size();
     98        }
     99        else{
     100                clear();
    97101        }
    98102
     
    102106        MARSHALLING(presorted);
    103107        MARSHALLING(numsorted);
    104         MARSHALLING_DYNAMIC(sorted_ids,int,numsorted);
    105         MARSHALLING_DYNAMIC(id_offsets,int,numsorted);
    106108
    107109        /*Now branch according to direction of marshalling: */
    108110        if(marshall_direction==MARSHALLING_FORWARD || marshall_direction==MARSHALLING_SIZE){
     111                if(!(this->sorted && numsorted>0 && this->id_offsets)){
     112                        sorted_ids=NULL;
     113                        id_offsets=NULL;
     114                  }
     115                MARSHALLING_DYNAMIC(sorted_ids,int,numsorted);
     116                MARSHALLING_DYNAMIC(id_offsets,int,numsorted);
     117                MARSHALLING(obj_size);
     118
    109119                /*Go through our objects, and marshall them into the buffer: */
    110120                for ( obj=this->objects.begin() ; obj < this->objects.end(); obj++ ){
     121                        obj_enum=(*obj)->ObjectEnum();
     122                        MARSHALLING(obj_enum);
    111123                        (*obj)->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    112124                }
    113125        }
    114126        else{
     127
     128                MARSHALLING_DYNAMIC(sorted_ids,int,numsorted);
     129                MARSHALLING_DYNAMIC(id_offsets,int,numsorted);
     130                if (!(this->sorted && numsorted>0)){
     131                 sorted_ids=NULL;
     132                 id_offsets=NULL;
     133                }
     134                MARSHALLING(obj_size);
     135
    115136                /*This is the heart of the demashalling method. We have a buffer coming
    116137                 in, and we are supposed to create a dataset out of it. No such thing
    117138                 as class orientation for buffers, we need to key off the enum of each
    118139                 object stored in the buffer. */
    119                 for(i=0;i<this->numsorted;i++){
     140                for(i=0;i<obj_size;i++){
    120141
    121142                        /*Recover enum of object first: */
    122                         MARSHALLING_ENUM(obj_enum);
    123                         /*Reset the file pointer to point again to the beginning of the object: */
    124                         *pmarshalled_data-=sizeof(int);
     143                        MARSHALLING(obj_enum);
    125144
    126145                        /*Giant case statement to spin-up the right object, and demarshall into it the information
    127146                         *stored in the buffer: */
    128147                        if(obj_enum==NodeEnum){
    129                                         Node* node=NULL;
    130                                         node=new Node();
    131                                         node->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    132                                         this->AddObject(node);
     148                                Node* node=NULL;
     149                                node=new Node();
     150                                node->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     151                                this->AddObject(node);
    133152                        }
    134153                        else if(obj_enum==VertexEnum){
     
    137156                                vertex->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    138157                                this->AddObject(vertex);
    139                                 break;
    140158                        }
    141159                        else if(obj_enum==DoubleParamEnum){
     
    144162                                doubleparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    145163                                this->AddObject(doubleparam);
    146                                 break;
    147164                        }
    148165                        else if(obj_enum==IntParamEnum){
     
    151168                                intparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    152169                                this->AddObject(intparam);
    153                                 break;
    154                         }
    155                         else _error_("could not recognize enum type: " << obj_enum);
     170                        }
     171                        else if(obj_enum==IntMatParamEnum){
     172                                IntMatParam* intmparam=NULL;
     173                                intmparam=new IntMatParam();
     174                                intmparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     175                                this->AddObject(intmparam);
     176                        }
     177                        else if(obj_enum==IntVecParamEnum){
     178                                IntVecParam* intvparam=NULL;
     179                                intvparam=new IntVecParam();
     180                                intvparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     181                                this->AddObject(intvparam);
     182                        }
     183                        else if(obj_enum==BoolParamEnum){
     184                                BoolParam* boolparam=NULL;
     185                                boolparam=new BoolParam();
     186                                boolparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     187                                this->AddObject(boolparam);
     188                        }
     189                        else if(obj_enum==DataSetParamEnum){
     190                                DataSetParam* dsparam=NULL;
     191                                dsparam=new DataSetParam();
     192                                dsparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     193                                this->AddObject(dsparam);
     194                        }
     195                        else if(obj_enum==DoubleMatArrayParamEnum){
     196                                DoubleMatArrayParam* dmaparam=NULL;
     197                                dmaparam=new DoubleMatArrayParam();
     198                                dmaparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     199                                this->AddObject(dmaparam);
     200                        }
     201                        else if(obj_enum==DoubleMatParamEnum){
     202                                DoubleMatParam* dmparam=NULL;
     203                                dmparam=new DoubleMatParam();
     204                                dmparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     205                                this->AddObject(dmparam);
     206                        }
     207                        else if(obj_enum==DoubleVecParamEnum){
     208                                DoubleVecParam* dvparam=NULL;
     209                                dvparam=new DoubleVecParam();
     210                                dvparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     211                                this->AddObject(dvparam);
     212                        }
     213                        else if(obj_enum==FileParamEnum){
     214                                FileParam* fileparam=NULL;
     215                                fileparam=new FileParam();
     216                                fileparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     217                                this->AddObject(fileparam);
     218                        }
     219                        else if(obj_enum==StringParamEnum){
     220                                StringParam* sparam=NULL;
     221                                sparam=new StringParam();
     222                                sparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     223                                this->AddObject(sparam);
     224                        }
     225                        else if(obj_enum==StringArrayParamEnum){
     226                                StringArrayParam* saparam=NULL;
     227                                saparam=new StringArrayParam();
     228                                saparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     229                                this->AddObject(saparam);
     230                        }
     231                        else if(obj_enum==TransientParamEnum){
     232                                TransientParam* transparam=NULL;
     233                                transparam=new TransientParam();
     234                                transparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     235                                this->AddObject(transparam);
     236                        }
     237                        else if(obj_enum==MaticeEnum){
     238                                Matice* matice=NULL;
     239                                matice=new Matice();
     240                                matice->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     241                                this->AddObject(matice);
     242                        }
     243                        else if(obj_enum==MatparEnum){
     244                                Matpar* matpar=NULL;
     245                                matpar=new Matpar();
     246                                matpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     247                                this->AddObject(matpar);
     248                        }
     249                        else if(obj_enum==SpcStaticEnum){
     250                                SpcStatic* spcstatic=NULL;
     251                                spcstatic=new SpcStatic();
     252                                spcstatic->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     253                                this->AddObject(spcstatic);
     254                        }
     255                        else if(obj_enum==SpcDynamicEnum){
     256                                SpcDynamic* spcdynamic=NULL;
     257                                spcdynamic=new SpcDynamic();
     258                                spcdynamic->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     259                                this->AddObject(spcdynamic);
     260                        }
     261                        else if(obj_enum==SpcTransientEnum){
     262                                SpcTransient* spctransient=NULL;
     263                                spctransient=new SpcTransient();
     264                                spctransient->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     265                                this->AddObject(spctransient);
     266                        }
     267                        else if(obj_enum==TriaEnum){
     268                                Tria* tria=NULL;
     269                                tria=new Tria();
     270                                tria->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     271                                this->AddObject(tria);
     272                        }
     273                        else if(obj_enum==PentaEnum){
     274                                Penta* penta=NULL;
     275                                penta=new Penta();
     276                                penta->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     277                                this->AddObject(penta);
     278                        }
     279                        else if(obj_enum==TetraEnum){
     280                                Tetra* tetra=NULL;
     281                                tetra=new Tetra();
     282                                tetra->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     283                                this->AddObject(tetra);
     284                        }
     285                        else if(obj_enum==SegEnum){
     286                                Seg* seg=NULL;
     287                                seg=new Seg();
     288                                seg->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     289                                this->AddObject(seg);
     290                        }
     291                        else if(obj_enum==BoolInputEnum){
     292                                BoolInput* boolinput=NULL;
     293                                boolinput=new BoolInput();
     294                                boolinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     295                                this->AddObject(boolinput);
     296                        }
     297                        else if(obj_enum==DoubleInputEnum){
     298                                DoubleInput* doubleinput=NULL;
     299                                doubleinput=new DoubleInput();
     300                                doubleinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     301                                this->AddObject(doubleinput);
     302                        }
     303                        else if(obj_enum==IntInputEnum){
     304                                IntInput* intinput=NULL;
     305                                intinput=new IntInput();
     306                                intinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     307                                this->AddObject(intinput);
     308                        }
     309                        else if(obj_enum==ControlInputEnum){
     310                                ControlInput* cinput=NULL;
     311                                cinput=new ControlInput();
     312                                cinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     313                                this->AddObject(cinput);
     314                        }
     315                        else if(obj_enum==TransientInputEnum){
     316                                TransientInput* transinput=NULL;
     317                                transinput=new TransientInput();
     318                                transinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     319                                this->AddObject(transinput);
     320                        }
     321                        else if(obj_enum==TriaInputEnum){
     322                                TriaInput* triainput=NULL;
     323                                triainput=new TriaInput();
     324                                triainput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     325                                this->AddObject(triainput);
     326                        }
     327                        else if(obj_enum==PentaInputEnum){
     328                                PentaInput* pentainput=NULL;
     329                                pentainput=new PentaInput();
     330                                pentainput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     331                                this->AddObject(pentainput);
     332                        }
     333                        else if(obj_enum==TetraInputEnum){
     334                                TetraInput* tetrainput=NULL;
     335                                tetrainput=new TetraInput();
     336                                tetrainput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     337                                this->AddObject(tetrainput);
     338                        }
     339                        else if(obj_enum==SegInputEnum){
     340                                SegInput* seginput=NULL;
     341                                seginput=new SegInput();
     342                                seginput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     343                                this->AddObject(seginput);
     344                        }
     345                        else if(obj_enum==RiftfrontEnum){
     346                                Riftfront* rift=NULL;
     347                                rift=new Riftfront();
     348                                rift->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     349                                this->AddObject(rift);
     350                        }
     351                        else if(obj_enum==NumericalfluxEnum){
     352                                Numericalflux* numflux=NULL;
     353                                numflux=new Numericalflux();
     354                                numflux->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     355                                this->AddObject(numflux);
     356                        }
     357                        else if(obj_enum==PengridEnum){
     358                                Pengrid* pengrid=NULL;
     359                                pengrid=new Pengrid();
     360                                pengrid->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     361                                this->AddObject(pengrid);
     362                        }
     363                        else if(obj_enum==PenpairEnum){
     364                                Penpair* penpair=NULL;
     365                                penpair=new Penpair();
     366                                penpair->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     367                                this->AddObject(penpair);
     368                        }
     369                        else _error_("could not recognize enum type: " << obj_enum << ": " << EnumToStringx(obj_enum) );
    156370                }
    157371        }
  • TabularUnified issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h

    r19240 r19254  
    1313
    1414#define MARSHALLING_ENUM(EN)\
    15         int enum_type=EN;\
     15        int type_enum=EN;\
    1616        if(marshall_direction==MARSHALLING_FORWARD){\
    17                 memcpy(*pmarshalled_data,&enum_type,sizeof(int));\
     17                memcpy(*pmarshalled_data,&type_enum,sizeof(int));\
    1818                *pmarshalled_data+=sizeof(int);\
    1919        }\
Note: See TracChangeset for help on using the changeset viewer.