Changeset 21845


Ignore:
Timestamp:
07/24/17 13:08:55 (8 years ago)
Author:
Mathieu Morlighem
Message:

CHG: fixing AD (no need to have a specialization for int*

File:
1 edited

Legend:

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

    r21674 r21845  
    462462
    463463}  /*}}}*/
    464 /*Specific instantiations for int*: */
    465 #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.
    466 template <> inline void GenericExternalResult<int*>::WriteData(FILE* fid,bool io_gather){ /*{{{*/
    467 
    468         int     i;
    469         int     my_rank;
    470         int     type;
    471         int     rows,cols;
    472         char   *name    = NULL;
    473         IssmPDouble passiveDouble;
    474         int* passiveInts;
    475 
    476         /*recover my_rank:*/
    477         my_rank=IssmComm::GetRank();
    478 
    479         if(io_gather){
    480                 /*we are gathering the data on cpu 0, don't write on other cpus: */
    481                 if(my_rank) return;
    482         }
    483 
    484         /*First write enum: */
    485         int length=(strlen(this->result_name)+1)*sizeof(char);
    486         fwrite(&length,sizeof(int),1,fid);
    487         fwrite(this->result_name,length,1,fid);
    488 
    489         /*Now write time and step: */
    490         passiveDouble=reCast<IssmPDouble>(time);
    491         fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid);
    492         fwrite(&step,sizeof(int),1,fid);
    493 
    494         /*writing a int array, type is 4 (see parseresultsfromdisk.m):*/
    495         type=4;
    496         fwrite(&type,sizeof(int),1,fid);
    497         rows=this->M;
    498         fwrite(&rows,sizeof(int),1,fid);
    499         cols=this->N;
    500         fwrite(&cols,sizeof(int),1,fid);
    501 
    502         passiveInts=xNew<int>(this->M*this->N);
    503         for (i=0;i<this->M*this->N;i++)passiveInts[i]=reCast<int>(value[i]);
    504         fwrite(passiveInts,cols*rows*sizeof(int),1,fid);
    505         xDelete<int>(int);
    506 
    507 }
    508 /*}}}*/
    509 #endif
    510464
    511465/*Specific instantiations for IssmPDouble*: */
Note: See TracChangeset for help on using the changeset viewer.