Changeset 4423


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

marshall/demarshall hook in Penta (is NULL)

File:
1 edited

Legend:

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

    r4410 r4423  
    158158        char* marshalled_dataset=NULL;
    159159        int   i;
     160        int flaghook;
    160161
    161162        /*recover marshalled_dataset: */
     
    172173        /*demarshall hooks: */
    173174        for(i=0;i<numanalyses;i++){
    174                 hnodes[i]=new Hook();
    175                 hnodes[i]->Demarshall(&marshalled_dataset);
     175                memcpy(&flaghook,marshalled_dataset,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
     176                if(flaghook){ // there is a hook so demarshall it
     177                        hnodes[i]=new Hook();
     178                        hnodes[i]->Demarshall(&marshalled_dataset);
     179                }
     180                else hnodes[i]=NULL; //There is no hook so it is NULL
    176181        }
    177182        hmatice=new Hook(); hmatice->Demarshall(&marshalled_dataset);
     
    225230        char* marshalled_results=NULL;
    226231        int   marshalled_results_size;
     232        int   flaghook; //to indicate if hook is NULL or exists
    227233
    228234        /*recover marshalled_dataset: */
     
    240246
    241247        /*Marshall hooks: */
    242         for(i=0;i<numanalyses;i++)hnodes[i]->Marshall(&marshalled_dataset);
     248        for(i=0;i<numanalyses;i++){
     249                if(hnodes[i]){
     250                        /*Set flag to 1 as there is a hook */
     251                        flaghook=1;
     252                        memcpy(marshalled_dataset,&flaghook,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
     253                        hnodes[i]->Marshall(&marshalled_dataset);
     254                }
     255                else{
     256                        /*Set flag to 0 and do not marshall flag as there is no Hook */
     257                        flaghook=0;
     258                        memcpy(marshalled_dataset,&flaghook,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
     259                }
     260        }
    243261        hmatice->Marshall(&marshalled_dataset);
    244262        hmatpar->Marshall(&marshalled_dataset);
     
    271289        int hnodes_size=0;;
    272290
    273         for(i=0;i<numanalyses;i++)hnodes_size+=hnodes[i]->MarshallSize();
     291        for(i=0;i<numanalyses;i++){
     292                hnodes_size+=sizeof(int); //Flag 0 or 1
     293                if (hnodes[i]) hnodes_size+=hnodes[i]->MarshallSize();
     294        }
    274295
    275296        return sizeof(id)
Note: See TracChangeset for help on using the changeset viewer.