Changeset 4421


Ignore:
Timestamp:
07/07/10 08:34:02 (15 years ago)
Author:
seroussi
Message:

marshall/demarshall hook if NULL in Tria

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk/src/c/objects/Elements/Tria.cpp

    r4420 r4421  
    145145        char* marshalled_dataset=NULL;
    146146        int i;
     147        int flaghook;
    147148
    148149        /*recover marshalled_dataset: */
     
    159160        /*demarshall hooks: */
    160161        for(i=0;i<numanalyses;i++){
    161                 hnodes[i]=new Hook();
    162                 hnodes[i]->Demarshall(&marshalled_dataset);
     162                memcpy(&flaghook,marshalled_dataset,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
     163                if(flaghook){ // there is a hook so demarshall it
     164                        hnodes[i]=new Hook();
     165                        hnodes[i]->Demarshall(&marshalled_dataset);
     166                }
     167                else hnodes[i]=NULL; //There is no hook so it is NULL
    163168        }
    164169        hmatice=new Hook(); hmatice->Demarshall(&marshalled_dataset);
     
    231236        char* marshalled_results=NULL;
    232237        int   marshalled_results_size;
     238        int   flaghook; //to indicate if hook is NULL or exists
    233239
    234240        /*recover marshalled_dataset: */
     
    246252        memcpy(marshalled_dataset,&numanalyses,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses);
    247253
    248         /*Marshall hooks: */
    249         for(i=0;i<numanalyses;i++)hnodes[i]->Marshall(&marshalled_dataset);
     254 /*Marshall hooks: */
     255        for(i=0;i<numanalyses;i++){
     256                if(hnodes[i]){
     257                        /*Set flag to 1 as there is a hook */
     258                        flaghook=1;
     259                        memcpy(marshalled_dataset,&flaghook,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
     260                        hnodes[i]->Marshall(&marshalled_dataset);
     261                }
     262                else{
     263                        /*Set flag to 0 and do not marshall flag as there is no Hook */
     264                        flaghook=0;
     265                        memcpy(marshalled_dataset,&flaghook,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
     266                }
     267        }
    250268        hmatice->Marshall(&marshalled_dataset);
    251269        hmatpar->Marshall(&marshalled_dataset);
     
    278296        int hnodes_size=0;;
    279297
    280         for(i=0;i<numanalyses;i++)hnodes_size+=hnodes[i]->MarshallSize();
     298        for(i=0;i<numanalyses;i++){
     299                hnodes_size+=sizeof(int); //Flag 0 or 1
     300                if (hnodes[i]) hnodes_size+=hnodes[i]->MarshallSize();
     301        }
    281302
    282303        return sizeof(id)
Note: See TracChangeset for help on using the changeset viewer.