Changeset 27113


Ignore:
Timestamp:
06/27/22 05:39:50 (3 years ago)
Author:
seroussi
Message:

NEW: changes to allow restart with ArrayInputs

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

Legend:

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

    r25508 r27113  
    8181        marshallhandle->call(object_enum);
    8282        marshallhandle->call(this->numberofelements_local);
     83
     84        /*Allocate memory if reading restart file*/
     85        if(marshallhandle->OperationNumber() == MARSHALLING_LOAD){
     86                _assert_(this->numberofelements_local>0);
     87                _assert_(this->numberofelements_local<1e11);
     88                if(this->numberofelements_local){
     89                        this->N                      = xNewZeroInit<int>(this->numberofelements_local);
     90                        this->values                 = xNewZeroInit<IssmDouble*>(this->numberofelements_local);
     91                }
     92                else{
     93                        this->N      = NULL;
     94                        this->values = NULL;
     95                }
     96        }
     97
     98        /*Marshall N*/
    8399        if(this->numberofelements_local){
    84100                marshallhandle->call(this->N,this->numberofelements_local);
     101        }
     102
     103        /*Marshall individual arrays*/
     104        if(this->numberofelements_local){
    85105                for(int i=0;i<this->numberofelements_local;i++){
    86                         if(this->values[i]){
     106                        if(this->N[i]){
     107
     108                                /*Allocate if reading restart*/
     109                                if(marshallhandle->OperationNumber() == MARSHALLING_LOAD){
     110                                        this->values[i] = xNew<IssmDouble>(this->N[i]);
     111                                }
     112                                _assert_(this->values[i]);
    87113                                marshallhandle->call(this->values[i],this->N[i]);
    88114                        }
    89115                }
    90116        }
    91         else{
    92                 this->N      = NULL;
    93                 this->values = NULL;
    94         }
    95 
    96117}
    97118/*}}}*/
  • issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp

    r26174 r27113  
    167167                                this->inputs[index]=input;
    168168                        }
     169                        else if(object_enum==ArrayInputEnum){
     170                                ArrayInput* input=new ArrayInput();
     171                                input->Marshall(marshallhandle);
     172                                this->inputs[index]=input;
     173                        }
    169174                        else{
    170175                                _error_("input "<<EnumToStringx(object_enum)<<" not supported");
Note: See TracChangeset for help on using the changeset viewer.