Ignore:
Timestamp:
09/24/15 15:55:17 (9 years ago)
Author:
rlacroix
Message:

Append mode: Detect the correct restart point and erase some records if need be.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/io/onetcdf4.hpp

    r686 r707  
    2626 
    2727            /// Constructeurs /// 
    28             CONetCDF4(const StdString & filename, bool append, bool useClassicFormat = false, 
    29                       const MPI_Comm * comm = NULL, bool multifile = true); 
     28            CONetCDF4(const StdString& filename, bool append, bool useClassicFormat = false, 
     29                      const MPI_Comm* comm = NULL, bool multifile = true); 
    3030 
    31             CONetCDF4(const CONetCDF4 & onetcdf4);       // Not implemented. 
    32             CONetCDF4(const CONetCDF4 * const onetcdf4); // Not implemented. 
     31            CONetCDF4(const CONetCDF4& onetcdf4);       // Not implemented. 
     32            CONetCDF4(const CONetCDF4* const onetcdf4); // Not implemented. 
    3333 
    3434 
    3535            /// Initialisation /// 
    36             void initialize(const StdString & filename, bool append, bool useClassicFormat, 
    37                             const MPI_Comm * comm, bool multifile); 
    38             void close(void) ; 
    39             void sync(void) ; 
     36            void initialize(const StdString& filename, bool append, bool useClassicFormat, 
     37                            const MPI_Comm* comm, bool multifile); 
     38            void close(void); 
     39            void sync(void); 
    4040            void definition_start(void); 
    4141            void definition_end(void); 
    4242 
    4343            /// Mutateurs /// 
    44             void setCurrentPath(const CONetCDF4Path & path); 
     44            void setCurrentPath(const CONetCDF4Path& path); 
    4545 
    46             int addGroup(const StdString & name); 
     46            int addGroup(const StdString& name); 
    4747            int addDimension(const StdString& name, const StdSize size = UNLIMITED_DIM); 
    48             int addVariable(const StdString & name, nc_type type, 
    49                             const std::vector<StdString> & dim); 
     48            int addVariable(const StdString& name, nc_type type, 
     49                            const std::vector<StdString>& dim); 
    5050 
    5151      //---------------------------------------------------------------- 
     
    5353 
    5454            template <class T> 
    55                void setDefaultValue(const StdString & varname, const T * value = NULL); 
     55               void setDefaultValue(const StdString& varname, const T* value = NULL); 
    5656 
    5757            void setCompressionLevel(const StdString& varname, int compressionLevel); 
    5858 
    59             template <class T>  void addAttribute (const StdString & name, const T & value, const StdString * varname = NULL); 
     59            template <class T>  void addAttribute (const StdString& name, const T& value, const StdString* varname = NULL); 
    6060 
    6161            /// Ecriture des données /// 
    6262            template <class T, int ndim> 
    63                void writeData(const CArray<T,ndim>& data, const StdString & name, 
     63               void writeData(const CArray<T,ndim>& data, const StdString& name, 
    6464                              bool collective, StdSize record, 
    65                               const std::vector<StdSize> * start = NULL, 
    66                               const std::vector<StdSize> * count = NULL); 
     65                              const std::vector<StdSize>* start = NULL, 
     66                              const std::vector<StdSize>* count = NULL); 
    6767 
    68             void writeData(const CArray<int, 2>& data, const StdString & name); 
    69             void writeTimeAxisData(const CArray<double,1>& data, const StdString & name, 
    70                                    bool collective, StdSize record, bool Isroot) ; 
     68            void writeData(const CArray<int, 2>& data, const StdString& name); 
     69            void writeTimeAxisData(const CArray<double,1>& data, const StdString& name, 
     70                                   bool collective, StdSize record, bool Isroot); 
    7171            /// Accesseur /// 
    72             const CONetCDF4Path & getCurrentPath(void) const; 
     72            const CONetCDF4Path& getCurrentPath(void) const; 
    7373 
    7474            /// Destructeur /// 
     
    8686            /// Accesseurs /// 
    8787            int getCurrentGroup(void); 
    88             int getGroup(const CONetCDF4Path & path); 
    89             int getVariable(const StdString & varname); 
    90             int getDimension(const StdString & dimname); 
    91             std::vector<StdSize>   getDimensions       (const StdString & varname); 
    92             std::vector<StdString> getDimensionsIdList (const StdString * varname); 
     88            int getGroup(const CONetCDF4Path& path); 
     89            int getVariable(const StdString& varname); 
     90            int getDimension(const StdString& dimname); 
     91            std::vector<StdSize>   getDimensions       (const StdString& varname); 
     92            std::vector<StdString> getDimensionsIdList (const StdString* varname); 
    9393            int       getUnlimitedDimension(void); 
    9494            StdString getUnlimitedDimensionName(void); 
    9595 
    96             bool varExist(const StdString & varname); 
     96            void getTimeAxisBounds(CArray<double,2>& timeAxisBounds, const StdString& name, bool collective); 
     97 
     98            bool varExist(const StdString& varname); 
    9799 
    98100            bool useClassicFormat; //!< If true, NetCDF4 will use the classic NetCDF3 format 
     
    101103 
    102104         private : 
     105            template <class T> 
     106            void writeData_(int grpid, int varid, 
     107                            const std::vector<StdSize>& sstart, 
     108                            const std::vector<StdSize>& scount, T* data); 
    103109 
    104             template <class T> 
    105                void writeData_(int grpid, int varid, 
    106                                const std::vector<StdSize> & sstart, 
    107                                const std::vector<StdSize> & scount, T * data); 
    108  
    109             void getWriteDataInfos(const StdString & name, StdSize record, StdSize & array_size, 
    110                                    std::vector<StdSize> & sstart, 
    111                                    std::vector<StdSize> & scount, 
    112                                    const std::vector<StdSize> * start, 
    113                                    const std::vector<StdSize> * count); 
     110            void getWriteDataInfos(const StdString& name, StdSize record, StdSize& array_size, 
     111                                   std::vector<StdSize>& sstart, 
     112                                   std::vector<StdSize>& scount, 
     113                                   const std::vector<StdSize>* start, 
     114                                   const std::vector<StdSize>* count); 
    114115 
    115116            /// Propriétés privées /// 
     
    117118            int ncidp; 
    118119            bool wmpi; 
    119             /*! Number of records already written when opening an existing file. 
    120              *  always 0 when creating a new file */ 
    121             size_t recordOffset; 
    122             map<int,size_t> timeAxis ; 
     120            map<int,size_t> timeAxis; 
    123121      }; // class CONetCDF4 
    124122 
Note: See TracChangeset for help on using the changeset viewer.