Changeset 26170


Ignore:
Timestamp:
04/01/21 12:06:15 (4 years ago)
Author:
Mathieu Morlighem
Message:

CHG: implemented transientinput marshall

Location:
issm/trunk-jpl/src/c/classes/Inputs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp

    r26121 r26170  
    157157                                this->inputs[index]=input;
    158158                        }
     159                        else if(object_enum==TransientInputEnum){
     160                                TransientInput* input=new TransientInput();
     161                                input->Marshall(marshallhandle);
     162                                this->inputs[index]=input;
     163                        }
    159164                        else{
    160165                                _error_("input "<<EnumToStringx(object_enum)<<" not supported");
  • issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp

    r25508 r26170  
    119119void TransientInput::Marshall(MarshallHandle* marshallhandle){ /*{{{*/
    120120
    121         if (marshallhandle->OperationNumber() == MARSHALLING_LOAD){
    122                 _error_("not implmented");
    123                 //inputs = new Inputs();
    124         }
    125 
    126121        int object_enum = TransientInputEnum;
    127122   marshallhandle->call(object_enum);
    128123
     124        marshallhandle->call(this->numberofelements_local);
     125        marshallhandle->call(this->numberofvertices_local);
    129126        marshallhandle->call(this->enum_type);
    130127        marshallhandle->call(this->numtimesteps);
    131128        marshallhandle->call(this->timesteps,numtimesteps);
    132         //inputs->Marshall(marshallhandle);
    133         _error_("not implemented");
     129
     130        /*Allocate memory if need be*/
     131        if(marshallhandle->OperationNumber() == MARSHALLING_LOAD){
     132                int N = this->numtimesteps; _assert_(N>=0 && N<1e6);
     133                if(N){
     134                        this->inputs = xNew<Input*>(N);
     135                        for(int i=0;i<N;i++) this->inputs[i] = NULL;
     136                }
     137                else{
     138                        this->inputs = NULL;
     139                }
     140        }
     141
     142        /*Marshall!*/
     143        if(marshallhandle->OperationNumber()!=MARSHALLING_LOAD){
     144                for(int i=0;i<this->numtimesteps;i++){
     145                        _assert_(this->inputs[i]);
     146                        object_enum = this->inputs[i]->ObjectEnum();
     147                        marshallhandle->call(object_enum);
     148                        this->inputs[i]->Marshall(marshallhandle);
     149                }
     150        }
     151        else{
     152                for(int i=0;i<this->numtimesteps;i++){
     153                        marshallhandle->call(object_enum);
     154
     155                        if(object_enum==TriaInputEnum){
     156                                TriaInput* triainput2=new TriaInput();
     157                                triainput2->Marshall(marshallhandle);
     158                                this->inputs[i]=triainput2;
     159                        }
     160                        else if(object_enum==PentaInputEnum){
     161                                PentaInput* pentainput2=new PentaInput();
     162                                pentainput2->Marshall(marshallhandle);
     163                                this->inputs[i]=pentainput2;
     164                        }
     165                        else{
     166                                _error_("input "<<EnumToStringx(object_enum)<<" not supported");
     167                        }
     168                }
     169        }
     170
    134171}
    135172/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.