Changeset 17145
- Timestamp:
- 01/20/14 20:46:03 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h
r17055 r17145 368 368 } /*}}}*/ 369 369 370 /*Specific instantiations for IssmDouble*: */ 371 #if defined(_HAVE_ADOLC_) && !defined(_WRAPPERS_) //We hook off this specific specialization when not running ADOLC, otherwise we get a redeclaration with the next specialization. 372 template <> inline void GenericExternalResult<IssmDouble*>::WriteData(FILE* fid,bool io_gather){ /*{{{*/ 373 374 int i; 375 int my_rank; 376 int type; 377 int rows,cols; 378 char *name = NULL; 379 IssmPDouble passiveDouble; 380 IssmPDouble* passiveDoubles; 381 382 /*recover my_rank:*/ 383 my_rank=IssmComm::GetRank(); 384 385 if(io_gather){ 386 /*we are gathering the data on cpu 0, don't write on other cpus: */ 387 if(my_rank) return; 388 } 389 390 /*First write enum: */ 391 int length=(strlen(this->result_name)+1)*sizeof(char); 392 fwrite(&length,sizeof(int),1,fid); 393 fwrite(this->result_name,length,1,fid); 394 395 /*Now write time and step: */ 396 passiveDouble=reCast<IssmPDouble>(time); 397 fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid); 398 fwrite(&step,sizeof(int),1,fid); 399 400 /*writing a IssmDouble array, type is 3:*/ 401 type=3; 402 fwrite(&type,sizeof(int),1,fid); 403 rows=this->M; 404 fwrite(&rows,sizeof(int),1,fid); 405 cols=this->N; 406 fwrite(&cols,sizeof(int),1,fid); 407 408 passiveDoubles=xNew<IssmPDouble>(this->M*this->N); 409 for (i=0;i<this->M*this->N;i++)passiveDoubles[i]=reCast<IssmPDouble>(value[i]); 410 fwrite(passiveDoubles,cols*rows*sizeof(IssmPDouble),1,fid); 411 xDelete<IssmPDouble>(passiveDoubles); 412 413 } 414 /*}}}*/ 415 #endif 416 370 417 /*Specifics instantiations for Vector*/ 371 418 template <> inline GenericExternalResult<Vector<IssmPDouble>*>::GenericExternalResult(int in_id, int in_enum_type,Vector<IssmPDouble>* in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
Note:
See TracChangeset
for help on using the changeset viewer.