Changeset 19334
- Timestamp:
- 04/30/15 16:33:11 (10 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h
r19198 r19334 53 53 fwrite(&step,sizeof(int),1,fid); 54 54 } /*}}}*/ 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 } /*}}}*/ 55 70 56 71 /*GenericExternalResult constructors and destructors*/ … … 62 77 step = 0; 63 78 time = 0; 79 value = NULL; 64 80 } /*}}}*/ 65 81 GenericExternalResult(int in_id, int in_enum_type,ResultType in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/ … … 70 86 step = 0; 71 87 time = 0; 88 value = in_values; 72 89 _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"); 73 90 } … … 78 95 step = in_step; 79 96 time = in_time; 97 M = 1; 98 N = 1; 80 99 81 100 /*Convert enum to name*/ … … 88 107 step = in_step; 89 108 time = UNDEF; 109 M = 1; 110 N = 1; 90 111 91 112 /*Convert enum to name*/ … … 98 119 step = in_step; 99 120 time = in_time; 121 M = 1; 122 N = 1; 100 123 101 124 /*Copy name*/ … … 131 154 /*}}}*/ 132 155 133 134 135 156 /*GenericExternalResult management: */ 136 157 void WriteData(FILE* fid,bool io_gather){ /*{{{*/ … … 193 214 return BoolExternalResultEnum; 194 215 } /*}}}*/ 216 template <> 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 } /*}}}*/ 195 221 196 222 /*Specific instantiations for int: */ … … 205 231 return IntExternalResultEnum; 206 232 } /*}}}*/ 233 template <> 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 } /*}}}*/ 207 238 208 239 /*Specific instantiations for double: */ … … 220 251 return value; 221 252 } /*}}}*/ 253 template <> 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 } /*}}}*/ 222 258 223 259 /*Specific instantiations for char*: */ … … 229 265 step = in_step; 230 266 time = in_time; 267 M = 1; 268 N = 1; 231 269 232 270 /*Convert enum to name*/ … … 284 322 return StringExternalResultEnum; 285 323 } /*}}}*/ 324 template <> 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 } /*}}}*/ 286 338 287 339 /*Specific instantiations for IssmPDouble*: */ … … 382 434 return value; 383 435 } /*}}}*/ 436 template <> 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 } /*}}}*/ 384 449 385 450 /*Specific instantiations for IssmDouble*: */ … … 556 621 } 557 622 /*}}}*/ 623 template <> 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 } /*}}}*/ 558 628 559 629 #endif /* _EXTERNAL_RESULTOBJECT_H */ -
issm/trunk-jpl/src/c/cores/transient_core.cpp
r19333 r19334 181 181 } 182 182 183 if(save_results){ 184 if(VerboseSolution()) _printf0_(" saving temporary results\n"); 185 OutputResultsx(femmodel); 186 } 187 183 188 if(recording_frequency&& step%recording_frequency==0){ 184 189 if(VerboseSolution()) _printf0_(" checkpointing model \n"); 185 190 femmodel->CheckPoint(); 186 }187 188 if(save_results){189 if(VerboseSolution()) _printf0_(" saving temporary results\n");190 OutputResultsx(femmodel);191 191 } 192 192 }
Note:
See TracChangeset
for help on using the changeset viewer.