Changeset 802 for XIOS/trunk/src/io
- Timestamp:
- 11/30/15 16:21:33 (8 years ago)
- Location:
- XIOS/trunk/src/io
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/io/inetcdf4.cpp
r783 r802 7 7 namespace xios 8 8 { 9 CINetCDF4::CINetCDF4(const StdString& filename, const MPI_Comm* comm /*= NULL*/, bool multifile /*= true*/ )9 CINetCDF4::CINetCDF4(const StdString& filename, const MPI_Comm* comm /*= NULL*/, bool multifile /*= true*/, const StdString& timeCounterName /*= "time_counter"*/) 10 10 { 11 11 // Don't use parallel mode if there is only one process … … 25 25 else 26 26 CNetCdfInterface::open(filename, NC_NOWRITE, this->ncidp); 27 28 this->timeCounterName = timeCounterName; 27 29 } 28 30 … … 359 361 bool CINetCDF4::hasTemporalDim(const CVarPath* const path) 360 362 { 361 return (this->getUnlimitedDimension(path) != -1); 363 std::list<StdString> dims = this->getDimensionsList(NULL, path); 364 return (std::find(dims.begin(), dims.end(), timeCounterName) != dims.end()); 362 365 } 363 366 … … 563 566 bool CINetCDF4::isTemporal(const StdString& name, const CVarPath* const path) 564 567 { 565 if (!this->hasTemporalDim(path)) return false; 566 std::map<StdString, StdSize> dims = this->getDimensions(&name, path); 567 return (dims.find(this->getUnlimitedDimensionName(path)) != dims.end()); 568 std::list<StdString> dims = this->getDimensionsList(&name, path); 569 return (std::find(dims.begin(), dims.end(), timeCounterName) != dims.end()); 568 570 } 569 571 -
XIOS/trunk/src/io/inetcdf4.hpp
r782 r802 22 22 public: 23 23 /// Constructors /// 24 CINetCDF4(const StdString& filename, const MPI_Comm* comm = NULL, bool multifile = true); 24 CINetCDF4(const StdString& filename, const MPI_Comm* comm = NULL, bool multifile = true, 25 const StdString& timeCounterName = "time_counter"); 25 26 CINetCDF4(const CINetCDF4& inetcdf4); // Not implemented. 26 27 CINetCDF4(const CINetCDF4* const inetcdf4); // Not implemented. … … 41 42 42 43 StdString getUnlimitedDimensionName(const CVarPath* const path = NULL); 44 45 const StdString& getTimeCounterName(void) const { return timeCounterName; }; 43 46 44 47 StdString getCoordinatesId(const StdString& name, const CVarPath* const path = NULL); … … 155 158 int ncidp; //< Id of the NetCDF file 156 159 bool mpi; //< Whether parallel file access is used 160 StdString timeCounterName; 157 161 }; // class CINetCDF4 158 162 } // namespace xios -
XIOS/trunk/src/io/nc4_data_input.cpp
r785 r802 9 9 namespace xios 10 10 { 11 CNc4DataInput::CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective /*= true*/ )11 CNc4DataInput::CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective /*= true*/, const StdString& timeCounterName /*= "time_counter"*/) 12 12 : SuperClass() 13 , SuperClassWriter(filename, &comm_file, multifile )13 , SuperClassWriter(filename, &comm_file, multifile, timeCounterName) 14 14 , comm_file(comm_file) 15 15 , filename(filename) -
XIOS/trunk/src/io/nc4_data_input.hpp
r783 r802 22 22 23 23 /// Constructors /// 24 CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective = true); 24 CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective = true, 25 const StdString& timeCounterName = "time_counter"); 25 26 CNc4DataInput(const CNc4DataInput& dataInput); // Not implemented. 26 27 CNc4DataInput(const CNc4DataInput* const dataInput); // Not implemented. -
XIOS/trunk/src/io/nc4_data_output.cpp
r796 r802 22 22 , filename(filename) 23 23 { 24 StdString timeid = StdString("time_counter");25 24 SuperClass::type = MULTI_FILE; 26 25 } … … 28 27 CNc4DataOutput::CNc4DataOutput 29 28 (const StdString & filename, bool exist, bool useClassicFormat, 30 MPI_Comm comm_file,bool multifile, bool isCollective )29 MPI_Comm comm_file,bool multifile, bool isCollective, const StdString& timeCounterName) 31 30 : SuperClass() 32 , SuperClassWriter(filename, exist, useClassicFormat, &comm_file, multifile )31 , SuperClassWriter(filename, exist, useClassicFormat, &comm_file, multifile, timeCounterName) 33 32 , comm_file(comm_file) 34 33 , filename(filename) 35 34 , isCollective(isCollective) 36 35 { 37 StdString timeid = StdString("time_counter");38 39 36 SuperClass::type = (multifile) ? MULTI_FILE : ONE_FILE; 40 37 } … … 952 949 try 953 950 { 954 SuperClassWriter::addDimension( "time_counter");951 SuperClassWriter::addDimension(getTimeCounterName()); 955 952 } 956 953 catch (CNetCdfException& e) … … 982 979 std::vector<StdString> axisList = grid->getAxisList(); 983 980 984 StdString timeid = StdString("time_counter");981 StdString timeid = getTimeCounterName(); 985 982 StdString dimXid,dimYid; 986 983 std::deque<StdString> dimIdList, dimCoordList; … … 1391 1388 else if (field->getOperationTimeType() == func::CFunctor::centered) timeAxisId = "time_centered"; 1392 1389 1393 StdString timeBoundId ("time_counter_bounds");1390 StdString timeBoundId = getTimeCounterName() + "_bounds"; 1394 1391 1395 1392 StdString timeAxisBoundId; … … 1492 1489 if (field->file->time_counter != CFile::time_counter_attr::none) 1493 1490 { 1494 SuperClassWriter::writeData(time_counter, string("time_counter"), isCollective, field->getNStep() - 1);1491 SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1); 1495 1492 if (field->file->time_counter != CFile::time_counter_attr::record) 1496 1493 SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1); … … 1619 1616 if (field->file->time_counter != CFile::time_counter_attr::none) 1620 1617 { 1621 SuperClassWriter::writeTimeAxisData(time_counter, string("time_counter"), isCollective, field->getNStep() - 1, isRoot);1618 SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1, isRoot); 1622 1619 if (field->file->time_counter != CFile::time_counter_attr::record) 1623 1620 SuperClassWriter::writeTimeAxisData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot); … … 1659 1656 StdString axisid("time_centered") ; 1660 1657 StdString axisBoundId("time_centered_bounds"); 1661 StdString timeid( "time_counter");1658 StdString timeid(getTimeCounterName()); 1662 1659 StdString timeBoundId("axis_nbounds"); 1663 1660 … … 1701 1698 { 1702 1699 // Adding time_counter 1703 axisid = "time_counter";1704 axisBoundId = "time_counter_bounds";1700 axisid = getTimeCounterName(); 1701 axisBoundId = getTimeCounterName() + "_bounds"; 1705 1702 dims.clear(); 1706 1703 dims.push_back(timeid); … … 1955 1952 if (it == timeToRecordCache.end()) 1956 1953 { 1957 StdString timeAxisBoundsId( "time_counter_bounds");1954 StdString timeAxisBoundsId(getTimeCounterName() + "_bounds"); 1958 1955 if (!SuperClassWriter::varExist(timeAxisBoundsId)) 1959 1956 timeAxisBoundsId = "time_instant_bounds"; -
XIOS/trunk/src/io/nc4_data_output.hpp
r774 r802 26 26 CNc4DataOutput 27 27 (const StdString & filename, bool exist, bool useClassicFormat, 28 MPI_Comm comm_file, bool multifile, bool isCollective=true); 28 MPI_Comm comm_file, bool multifile, bool isCollective = true, 29 const StdString& timeCounterName = "time_counter"); 29 30 30 31 CNc4DataOutput(const CNc4DataOutput & dataoutput); // Not implemented. -
XIOS/trunk/src/io/onetcdf4.cpp
r707 r802 13 13 14 14 CONetCDF4::CONetCDF4(const StdString& filename, bool append, bool useClassicFormat, 15 const MPI_Comm* comm, bool multifile )15 const MPI_Comm* comm, bool multifile, const StdString& timeCounterName) 16 16 : path() 17 17 , wmpi(false) 18 18 , useClassicFormat(useClassicFormat) 19 19 { 20 this->initialize(filename, append, useClassicFormat, comm, multifile);20 this->initialize(filename, append, useClassicFormat, comm, multifile, timeCounterName); 21 21 } 22 22 … … 30 30 31 31 void CONetCDF4::initialize(const StdString& filename, bool append, bool useClassicFormat, 32 const MPI_Comm* comm, bool multifile )32 const MPI_Comm* comm, bool multifile, const StdString& timeCounterName) 33 33 { 34 34 this->useClassicFormat = useClassicFormat; … … 74 74 if (useClassicFormat) 75 75 CNetCdfInterface::setFill(this->ncidp, false); 76 77 this->timeCounterName = timeCounterName; 76 78 } 77 79 … … 444 446 int i = 0; 445 447 446 if (iddims.begin()->compare(t his->getUnlimitedDimensionName()) == 0)448 if (iddims.begin()->compare(timeCounterName) == 0) 447 449 { 448 450 sstart.push_back(record); -
XIOS/trunk/src/io/onetcdf4.hpp
r707 r802 27 27 /// Constructeurs /// 28 28 CONetCDF4(const StdString& filename, bool append, bool useClassicFormat = false, 29 const MPI_Comm* comm = NULL, bool multifile = true); 29 const MPI_Comm* comm = NULL, bool multifile = true, 30 const StdString& timeCounterName = "time_counter"); 30 31 31 32 CONetCDF4(const CONetCDF4& onetcdf4); // Not implemented. … … 35 36 /// Initialisation /// 36 37 void initialize(const StdString& filename, bool append, bool useClassicFormat, 37 const MPI_Comm* comm, bool multifile );38 const MPI_Comm* comm, bool multifile, const StdString& timeCounterName); 38 39 void close(void); 39 40 void sync(void); … … 93 94 int getUnlimitedDimension(void); 94 95 StdString getUnlimitedDimensionName(void); 96 const StdString& getTimeCounterName(void) const { return timeCounterName; }; 95 97 96 98 void getTimeAxisBounds(CArray<double,2>& timeAxisBounds, const StdString& name, bool collective); … … 119 121 bool wmpi; 120 122 map<int,size_t> timeAxis; 123 StdString timeCounterName; 121 124 }; // class CONetCDF4 122 125
Note: See TracChangeset
for help on using the changeset viewer.