Changeset 798 for XIOS/branchs/xios-1.0/src/output
- Timestamp:
- 11/27/15 09:55:05 (9 years ago)
- Location:
- XIOS/branchs/xios-1.0/src/output
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/branchs/xios-1.0/src/output/nc4_data_output.cpp
r713 r798 937 937 this->getTimeStamp()); 938 938 939 SuperClassWriter::addDimension("axis_nbounds", 2); 939 if (!appendMode) 940 SuperClassWriter::addDimension("axis_nbounds", 2); 940 941 } 941 942 catch (CNetCdfException& e) -
XIOS/branchs/xios-1.0/src/output/onetcdf4.cpp
r607 r798 11 11 12 12 CONetCDF4::CONetCDF4 13 (const StdString & filename, bool exist, const MPI_Comm * comm, bool multifile)13 (const StdString & filename, bool append, const MPI_Comm * comm, bool multifile) 14 14 : path() 15 15 , wmpi(false) 16 16 { 17 this->initialize(filename, exist, comm,multifile);17 this->initialize(filename, append, comm,multifile); 18 18 } 19 19 … … 29 29 30 30 void CONetCDF4::initialize 31 (const StdString & filename, bool exist, const MPI_Comm * comm, bool multifile)31 (const StdString & filename, bool append, const MPI_Comm * comm, bool multifile) 32 32 { 33 33 // Don't use parallel mode if there is only one process … … 41 41 wmpi = comm && !multifile; 42 42 43 if (!exist) 43 // If the file does not exist, we always create it 44 if (!append || !std::ifstream(filename.c_str())) 44 45 { 45 46 if (wmpi) … … 47 48 else 48 49 CNetCdfInterface::create(filename, NC_NETCDF4, this->ncidp); 50 51 this->appendMode = false; 52 this->recordOffset = 0; 49 53 } 50 54 else 51 55 { 52 56 if (wmpi) 53 CNetCdfInterface::openPar(filename, NC_NETCDF4|NC_MPIIO , *comm, MPI_INFO_NULL, this->ncidp);57 CNetCdfInterface::openPar(filename, NC_NETCDF4|NC_MPIIO|NC_WRITE, *comm, MPI_INFO_NULL, this->ncidp); 54 58 else 55 CNetCdfInterface::open(filename, NC_NETCDF4, this->ncidp); 59 CNetCdfInterface::open(filename, NC_NETCDF4|NC_WRITE, this->ncidp); 60 61 this->appendMode = true; 62 // Find out how many temporal records have been written already to the file we are opening 63 int ncUnlimitedDimId; 64 CNetCdfInterface::inqUnLimDim(this->ncidp, ncUnlimitedDimId); 65 if (ncUnlimitedDimId != -1) 66 CNetCdfInterface::inqDimLen(this->ncidp, ncUnlimitedDimId, this->recordOffset); 67 else 68 this->recordOffset = 0; 56 69 } 57 70 } … … 429 442 if (iddims.begin()->compare(this->getUnlimitedDimensionName()) == 0) 430 443 { 431 sstart.push_back(record );444 sstart.push_back(record + recordOffset); 432 445 scount.push_back(1); 433 446 if ((start == NULL) && -
XIOS/branchs/xios-1.0/src/output/onetcdf4.hpp
r606 r798 26 26 27 27 /// Constructeurs /// 28 CONetCDF4(const StdString & filename, bool exist, const MPI_Comm * comm = NULL, bool multifile=true);28 CONetCDF4(const StdString & filename, bool append, const MPI_Comm * comm = NULL, bool multifile=true); 29 29 30 30 CONetCDF4(const CONetCDF4 & onetcdf4); // Not implemented. … … 33 33 34 34 /// Initialisation /// 35 void initialize(const StdString & filename, bool exist, const MPI_Comm * comm, bool multifile);35 void initialize(const StdString & filename, bool append, const MPI_Comm * comm, bool multifile); 36 36 void close(void) ; 37 37 void sync(void) ; … … 116 116 int ncidp; 117 117 bool wmpi; 118 /*! Number of records already written when opening an existing file. 119 * always 0 when creating a new file */ 120 size_t recordOffset; 118 121 map<int,size_t> timeAxis ; 119 122 }; // class CONetCDF4
Note: See TracChangeset
for help on using the changeset viewer.