Changeset a4fee13 for GenericIO.h


Ignore:
Timestamp:
10/09/15 19:14:02 (9 years ago)
Author:
Hal Finkel <hfinkel@…>
Branches:
master, pympi
Children:
8f0a211
Parents:
406b50a
git-author:
Hal Finkel <hfinkel@…> (10/09/15 19:14:02)
git-committer:
Hal Finkel <hfinkel@…> (10/09/15 19:14:02)
Message:

Implement reading of files of non-native Endianness

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GenericIO.h

    rda65757 ra4fee13  
    288288  int readGlobalRankNumber(int EffRank = -1); 
    289289 
    290  void readData(int EffRank = -1, bool PrintStats = true, bool CollStats = true); 
     290  void readData(int EffRank = -1, bool PrintStats = true, bool CollStats = true); 
    291291 
    292292  void close() { 
     
    319319  } 
    320320#endif 
     321 
     322private: 
     323  // Implementation functions templated on the Endianness of the underlying 
     324  // data. 
     325 
     326#ifndef GENERICIO_NO_MPI 
     327  template <bool IsBigEndian> 
     328  void write(); 
     329#endif 
     330 
     331  template <bool IsBigEndian> 
     332  void readHeaderLeader(void *GHPtr, bool MustMatch, int SplitNRanks, 
     333                        std::string &LocalFileName, uint64_t &HeaderSize, 
     334                        std::vector<char> &Header); 
     335 
     336  template <bool IsBigEndian> 
     337  int readNRanks(); 
     338 
     339  template <bool IsBigEndian> 
     340  void readDims(int Dims[3]); 
     341 
     342  template <bool IsBigEndian> 
     343  uint64_t readTotalNumElems(); 
     344 
     345  template <bool IsBigEndian> 
     346  void readPhysOrigin(double Origin[3]); 
     347 
     348  template <bool IsBigEndian> 
     349  void readPhysScale(double Scale[3]); 
     350 
     351  template <bool IsBigEndian> 
     352  int readGlobalRankNumber(int EffRank); 
     353 
     354  template <bool IsBigEndian> 
     355  size_t readNumElems(int EffRank); 
     356 
     357  template <bool IsBigEndian> 
     358  void readCoords(int Coords[3], int EffRank); 
     359 
     360  template <bool IsBigEndian> 
     361  void readData(int EffRank, bool PrintStats, bool CollStats); 
     362 
     363  template <bool IsBigEndian> 
     364  void getVariableInfo(std::vector<VariableInfo> &VI); 
    321365 
    322366protected: 
     
    378422    } 
    379423 
     424    bool isBigEndian() { 
     425      return CountedFH ? CountedFH->IsBigEndian : false; 
     426    } 
     427 
     428    void setIsBigEndian(bool isBE) { 
     429      CountedFH->IsBigEndian = isBE; 
     430    } 
     431 
    380432    void allocate() { 
    381433      close(); 
     
    393445 
    394446    struct FHWCnt { 
    395       FHWCnt() : GFIO(0), Cnt(1) {} 
     447      FHWCnt() : GFIO(0), Cnt(1), IsBigEndian(false) {} 
    396448 
    397449      ~FHWCnt() { 
     
    411463      // Used for reading 
    412464      std::vector<char> HeaderCache; 
     465      bool IsBigEndian; 
    413466    }; 
    414467 
Note: See TracChangeset for help on using the changeset viewer.