Ignore:
Timestamp:
09/01/20 13:22:48 (5 years ago)
Author:
Mathieu Morlighem
Message:

NEW: new way of Marshalling femmodel

File:
1 edited

Legend:

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

    r25497 r25506  
    124124}
    125125/*}}}*/
     126void ElementHook::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
     127
     128        int i;
     129        bool* hnodesi_null=NULL; /*intermediary needed*/
     130        bool  hnodes_null=true; /*this could be NULL on empty constructor*/
     131        bool  hneighbors_null=true; /*don't deal with hneighbors, unless explicitely asked to*/
     132
     133        _assert_(this);
     134
     135        /*preliminary, before marshall starts: */
     136        if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber()==MARSHALLING_SIZE){
     137                if(this->hneighbors)hneighbors_null=false;
     138                if(this->hnodes){
     139                        hnodes_null=false;
     140                        hnodesi_null=xNew<bool>(numanalyses);
     141                        for(i=0;i<numanalyses;i++){
     142                                if(this->hnodes[i])hnodesi_null[i]=false;
     143                                else hnodesi_null[i]=true;
     144                        }
     145                }
     146        }
     147
     148        /*ok, marshall operations: */
     149        int object_enum = ElementHookEnum;
     150        marshallhandle->call(object_enum);
     151        marshallhandle->call(this->numanalyses);
     152        marshallhandle->call(hneighbors_null);
     153        marshallhandle->call(hnodes_null);
     154        marshallhandle->call(hnodesi_null,numanalyses);
     155
     156        if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
     157
     158                if (!hnodes_null)this->hnodes = new Hook*[numanalyses];
     159                else this->hnodes=NULL;
     160                this->hvertices   = new Hook();
     161                this->hmaterial   = new Hook();
     162                if(!hneighbors_null)this->hneighbors  = new Hook();
     163                else this->hneighbors=NULL;
     164
     165                /*Initialize hnodes: */
     166                if (this->hnodes){
     167                        for(int i=0;i<this->numanalyses;i++){
     168                                if(!hnodesi_null[i])this->hnodes[i]=new Hook();
     169                                else this->hnodes[i]=NULL;
     170                        }
     171                }
     172        }
     173
     174        if (this->hnodes){
     175                for (i=0;i<numanalyses;i++) if(this->hnodes[i])this->hnodes[i]->Marshall2(marshallhandle);
     176        }
     177        this->hvertices->Marshall2(marshallhandle);
     178        this->hmaterial->Marshall2(marshallhandle);
     179        if(this->hneighbors)this->hneighbors->Marshall2(marshallhandle);
     180
     181        /*Free ressources: */
     182        if(hnodesi_null) xDelete<bool>(hnodesi_null);
     183
     184}
     185/*}}}*/
    126186
    127187void ElementHook::DeepEcho(){/*{{{*/
Note: See TracChangeset for help on using the changeset viewer.