Changeset 19334


Ignore:
Timestamp:
04/30/15 16:33:11 (10 years ago)
Author:
schlegel
Message:

CHG: move checkpoint after outputresult

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

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h

    r19198 r19334  
    5353                        fwrite(&step,sizeof(int),1,fid);
    5454                } /*}}}*/
     55                void GenericMarshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
     56
     57                        MARSHALLING_ENUM(this->ObjectEnum());
     58
     59                        bool isnull=true;
     60                        if(marshall_direction==MARSHALLING_FORWARD || marshall_direction == MARSHALLING_SIZE) if(value) isnull=false;
     61
     62                        MARSHALLING(id);
     63                        MARSHALLING(result_name);
     64                        MARSHALLING(isnull)
     65                        if (!isnull) MARSHALLING(value) else value=NULL;
     66                        MARSHALLING(step);
     67                        MARSHALLING(time);
     68
     69                }  /*}}}*/
    5570
    5671                /*GenericExternalResult constructors and  destructors*/
     
    6277                        step        = 0;
    6378                        time        = 0;
     79                        value       = NULL;
    6480                } /*}}}*/
    6581                GenericExternalResult(int in_id, int in_enum_type,ResultType in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
     
    7086                        step        = 0;
    7187                        time        = 0;
     88                        value       = in_values;
    7289                        _error_("template GenericExternalResult(int in_id, int in_enum_type,double* in_values, int in_M,int in_N,int in_step,IssmDouble in_time) not implemented for this ResultType\n");
    7390                }
     
    7895                        step      = in_step;
    7996                        time      = in_time;
     97                        M         = 1;
     98                        N         = 1;
    8099
    81100                        /*Convert enum to name*/
     
    88107                        step      = in_step;
    89108                        time      = UNDEF;
     109                        M         = 1;
     110                        N         = 1;
    90111
    91112                        /*Convert enum to name*/
     
    98119                        step      = in_step;
    99120                        time      = in_time;
     121                        M         = 1;
     122                        N         = 1;
    100123
    101124                        /*Copy name*/
     
    131154                /*}}}*/
    132155
    133 
    134 
    135156                /*GenericExternalResult management: */
    136157void  WriteData(FILE* fid,bool io_gather){ /*{{{*/
     
    193214        return BoolExternalResultEnum;
    194215} /*}}}*/
     216template <> inline void GenericExternalResult<bool>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
     217
     218        this->GenericMarshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     219
     220}  /*}}}*/
    195221
    196222/*Specific instantiations for int: */
     
    205231        return IntExternalResultEnum;
    206232} /*}}}*/
     233template <> inline void GenericExternalResult<int>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
     234
     235        this->GenericMarshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     236
     237}  /*}}}*/
    207238
    208239/*Specific instantiations for double: */
     
    220251        return value;
    221252} /*}}}*/
     253template <> inline void GenericExternalResult<double>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
     254
     255        this->GenericMarshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     256
     257}  /*}}}*/
    222258
    223259/*Specific instantiations for char*: */
     
    229265        step  = in_step;
    230266        time  = in_time;
     267        M     = 1;
     268        N     = 1;
    231269
    232270        /*Convert enum to name*/
     
    284322        return StringExternalResultEnum;
    285323} /*}}}*/
     324template <> inline void GenericExternalResult<char*>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
     325
     326        int size;
     327
     328        if(marshall_direction==MARSHALLING_FORWARD || marshall_direction == MARSHALLING_SIZE)size=strlen(value)+1;
     329
     330        MARSHALLING(id);
     331        MARSHALLING(result_name);
     332        MARSHALLING(size);
     333        MARSHALLING_DYNAMIC(value,char,size);
     334        MARSHALLING(step);
     335        MARSHALLING(time);
     336
     337}  /*}}}*/
    286338
    287339/*Specific instantiations for IssmPDouble*: */
     
    382434        return value;
    383435} /*}}}*/
     436template <> inline void GenericExternalResult<IssmPDouble*>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
     437
     438        MARSHALLING_ENUM(this->ObjectEnum());
     439
     440        MARSHALLING(id);
     441        MARSHALLING(result_name);
     442        MARSHALLING(M);
     443        MARSHALLING(N);
     444        MARSHALLING_DYNAMIC(value,IssmPDouble,M*N);
     445        MARSHALLING(step);
     446        MARSHALLING(time);
     447
     448}  /*}}}*/
    384449
    385450/*Specific instantiations for IssmDouble*: */
     
    556621}
    557622/*}}}*/
     623template <> inline void GenericExternalResult<Vector<IssmDouble>*>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
     624
     625        _error_("GenericExternalResult instantiated for type Vector<IssmDouble>* called " << result_name << " not implemented yet");
     626
     627}  /*}}}*/
    558628
    559629#endif  /* _EXTERNAL_RESULTOBJECT_H */
  • issm/trunk-jpl/src/c/cores/transient_core.cpp

    r19333 r19334  
    181181                }
    182182               
     183                if(save_results){
     184                        if(VerboseSolution()) _printf0_("   saving temporary results\n");
     185                        OutputResultsx(femmodel);
     186                }
     187
    183188                if(recording_frequency&& step%recording_frequency==0){
    184189                        if(VerboseSolution()) _printf0_("   checkpointing model \n");
    185190                        femmodel->CheckPoint();
    186                 }
    187 
    188                 if(save_results){
    189                         if(VerboseSolution()) _printf0_("   saving temporary results\n");
    190                         OutputResultsx(femmodel);
    191191                }
    192192        }
Note: See TracChangeset for help on using the changeset viewer.