Changeset 26172


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

CHG: added support for DatasetInput

File:
1 edited

Legend:

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

    r25508 r26172  
    9090        marshallhandle->call(this->numberofvertices_local);
    9191        marshallhandle->call(this->ids,numids);
    92         //if (marshallhandle->OperationNumber() == MARSHALLING_LOAD) inputs = new Inputs();
    93         //inputs->Marshall(marshallhandle);
    94         _error_("not implemented");
     92
     93        /*Allocate memory if need be*/
     94        int N = this->numids; _assert_(N>=0 && N<1e6);
     95        if(marshallhandle->OperationNumber() == MARSHALLING_LOAD){
     96                if(N){
     97                        this->inputs = xNew<Input*>(N);
     98                        for(int i=0;i<N;i++) this->inputs[i] = NULL;
     99                }
     100                else{
     101                        this->inputs = NULL;
     102                }
     103        }
     104
     105        /*Marshall!*/
     106        if(marshallhandle->OperationNumber()!=MARSHALLING_LOAD){
     107                for(int i=0;i<N;i++){
     108                        _assert_(this->inputs[i]);
     109                        object_enum = this->inputs[i]->ObjectEnum();
     110                        marshallhandle->call(object_enum);
     111                        this->inputs[i]->Marshall(marshallhandle);
     112                }
     113        }
     114        else{
     115                for(int i=0;i<N;i++){
     116                        marshallhandle->call(object_enum);
     117
     118                        if(object_enum==TriaInputEnum){
     119                                TriaInput* triainput2=new TriaInput();
     120                                triainput2->Marshall(marshallhandle);
     121                                this->inputs[i]=triainput2;
     122                        }
     123                        else if(object_enum==PentaInputEnum){
     124                                PentaInput* pentainput2=new PentaInput();
     125                                pentainput2->Marshall(marshallhandle);
     126                                this->inputs[i]=pentainput2;
     127                        }
     128                        else{
     129                                _error_("input "<<EnumToStringx(object_enum)<<" not supported");
     130                        }
     131                }
     132        }
    95133
    96134}
Note: See TracChangeset for help on using the changeset viewer.