Changeset 1205 for XIOS/dev/branch_yushan_merged/src/io
- Timestamp:
- 07/10/17 18:17:04 (7 years ago)
- Location:
- XIOS/dev/branch_yushan_merged/src/io
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan_merged/src/io/nc4_data_output.cpp
r1176 r1205 11 11 #include "netCdfException.hpp" 12 12 #include "exception.hpp" 13 #include "timer.hpp" 13 14 #include "uuid.hpp" 14 15 // mpi.hpp … … 79 80 80 81 81 82 StdString dimXid, dimYid ; 82 83 83 84 nc_type typePrec ; … … 1045 1046 int zoom_begin_srv = axis->zoom_begin_srv; 1046 1047 int zoom_size = (MULTI_FILE == SuperClass::type) ? zoom_size_srv 1047 : axis->global_zoom_n; 1048 int zoom_begin = (MULTI_FILE == SuperClass::type) ? zoom_begin_srv 1049 : axis->global_zoom_begin; 1048 : axis->global_zoom_size_srv; 1050 1049 1051 1050 if ((0 == zoom_size_srv) && (MULTI_FILE == SuperClass::type)) return; … … 1102 1101 1103 1102 SuperClassWriter::definition_end(); 1104 printf("SuperClass::type = %d, typePrec = %d\n", SuperClass::type, typePrec); 1103 1105 1104 switch (SuperClass::type) 1106 1105 { … … 1126 1125 std::vector<StdSize> start(1), startBounds(2) ; 1127 1126 std::vector<StdSize> count(1), countBounds(2) ; 1128 start[0] = startBounds[0] = zoom_begin_srv-axis->global_zoom_begin ;1127 start[0] = startBounds[0] = zoom_begin_srv-axis->global_zoom_begin_srv; 1129 1128 count[0] = countBounds[0] = zoom_size_srv; 1130 1129 startBounds[1] = 0; … … 1832 1831 1833 1832 singleDomain = (file->nbDomains == 1); 1833 1834 StdString conv_str ; 1835 if (file->convention_str.isEmpty()) 1836 { 1837 if (SuperClassWriter::useCFConvention) conv_str="CF-1.6" ; 1838 else conv_str="UGRID" ; 1839 } 1840 else conv_str=file->convention_str ; 1841 1834 1842 try 1835 1843 { 1836 if (SuperClassWriter::useCFConvention) 1837 this->writeFileAttributes(filename, description, 1838 StdString("CF-1.6"), 1839 StdString("An IPSL model"), 1840 this->getTimeStamp()); 1841 else 1842 this->writeFileAttributes(filename, description, 1843 StdString("UGRID"), 1844 StdString("An IPSL model"), 1845 this->getTimeStamp()); 1846 1844 this->writeFileAttributes(filename, description, 1845 conv_str, 1846 StdString("An IPSL model"), 1847 this->getTimeStamp()); 1847 1848 1848 1849 if (!appendMode) … … 1989 1990 CGrid* grid = field->grid; 1990 1991 1991 if (field->getNStep()<1) return ; 1992 if (field->getNStep()<1) 1993 { 1994 return; 1995 } 1992 1996 1993 1997 if (!grid->doGridHaveDataToWrite()) 1994 if (SuperClass::type == MULTI_FILE || !isCollective) return; 1995 1998 if (SuperClass::type == MULTI_FILE || !isCollective) 1999 { 2000 return; 2001 } 2002 2003 1996 2004 StdString fieldid = field->getFieldOutputName(); 1997 2005 … … 2118 2126 case (MULTI_FILE) : 2119 2127 { 2128 CTimer::get("Files : writing data").resume(); 2120 2129 SuperClassWriter::writeData(fieldData, fieldid, isCollective, field->getNStep() - 1); 2130 CTimer::get("Files : writing data").suspend(); 2121 2131 if (wtime) 2122 2132 { 2133 CTimer::get("Files : writing time axis").resume(); 2123 2134 if ( wtimeData) 2124 2135 { 2125 SuperClassWriter::writeData(time_data, timeAxisId, isCollective, field->getNStep() - 1); 2126 SuperClassWriter::writeData(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1); 2127 } 2136 // SuperClassWriter::writeData(time_data, timeAxisId, isCollective, field->getNStep() - 1); 2137 // SuperClassWriter::writeData(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1); 2138 SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, field->getNStep() - 1, isRoot); 2139 SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1, isRoot); 2140 } 2128 2141 if (wtimeCounter) 2129 2142 { 2130 SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1); 2131 if (timeCounterType!=record) SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1); 2143 // SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1); 2144 // if (timeCounterType!=record) SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1); 2145 SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1,isRoot); 2146 if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot); 2132 2147 } 2148 CTimer::get("Files : writing time axis").suspend(); 2133 2149 } 2134 2150 break; … … 2256 2272 } 2257 2273 2274 2275 CTimer::get("Files : writing data").resume(); 2258 2276 SuperClassWriter::writeData(fieldData, fieldid, isCollective, field->getNStep() - 1, &start, &count); 2277 CTimer::get("Files : writing data").suspend(); 2278 2259 2279 if (wtime) 2260 2280 { 2281 CTimer::get("Files : writing time axis").resume(); 2261 2282 if ( wtimeData) 2262 2283 { 2263 SuperClassWriter::writeData(time_data, timeAxisId, isCollective, field->getNStep() - 1); 2264 SuperClassWriter::writeData(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1); 2284 // SuperClassWriter::writeData(time_data, timeAxisId, isCollective, field->getNStep() - 1); 2285 // SuperClassWriter::writeData(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1); 2286 SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, field->getNStep() - 1, isRoot); 2287 SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1, isRoot); 2265 2288 } 2266 2289 if (wtimeCounter) 2267 2290 { 2268 SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1); 2269 if (timeCounterType!=record) SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1); 2291 // SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1); 2292 // if (timeCounterType!=record) SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1); 2293 SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1,isRoot); 2294 if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot); 2295 2270 2296 } 2297 CTimer::get("Files : writing time axis").suspend(); 2271 2298 } 2272 2299 -
XIOS/dev/branch_yushan_merged/src/io/onetcdf4.cpp
r1160 r1205 6 6 #include "netCdfInterface.hpp" 7 7 #include "netCdfException.hpp" 8 // mpi_std.hpp 8 #include "timer.hpp" 9 9 10 10 namespace xios … … 54 54 if (!append || !std::ifstream(filename.c_str())) 55 55 { 56 CTimer::get("Files : create").resume(); 56 57 if (wmpi) 57 58 CNetCdfInterface::createPar(filename, mode, *comm, MPI_INFO_NULL_STD, this->ncidp); 58 59 else 59 60 CNetCdfInterface::create(filename, mode, this->ncidp); 60 61 CTimer::get("Files : create").suspend(); 62 61 63 this->appendMode = false; 62 64 } … … 64 66 { 65 67 mode |= NC_WRITE; 68 CTimer::get("Files : open").resume(); 66 69 if (wmpi) 67 //CNetCdfInterface::openPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), MPI_INFO_NULL_STD, this->ncidp);68 70 CNetCdfInterface::openPar(filename, mode, *comm, MPI_INFO_NULL_STD, this->ncidp); 69 71 else 70 72 CNetCdfInterface::open(filename, mode, this->ncidp); 71 73 CTimer::get("Files : open").suspend(); 72 74 this->appendMode = true; 73 75 } … … 83 85 void CONetCDF4::close() 84 86 { 87 CTimer::get("Files : close").resume(); 85 88 CNetCdfInterface::close(this->ncidp); 89 CTimer::get("Files : close").suspend(); 86 90 } 87 91 … … 558 562 559 563 this->getWriteDataInfos(name, 0, array_size, sstart, scount, NULL, NULL); 564 560 565 this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 566 561 567 } 562 568 … … 584 590 585 591 this->getWriteDataInfos(name, record, array_size, sstart, scount, NULL, NULL); 586 if (using_netcdf_internal)587 {588 if (!isRoot)589 {590 sstart[0] = sstart[0] + 1;591 scount[0] = 0;592 }593 }594 592 this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 595 593 } 596 594 595 void CONetCDF4::writeTimeAxisDataBounds(const CArray<double, 1>& data, const StdString& name, 596 bool collective, StdSize record, bool isRoot) 597 { 598 int grpid = this->getCurrentGroup(); 599 int varid = this->getVariable(name); 600 601 map<int,size_t>::iterator it=timeAxis.find(varid); 602 if (it == timeAxis.end()) timeAxis[varid] = record; 603 else 604 { 605 if (it->second >= record) return; 606 else it->second =record; 607 } 608 609 StdSize array_size = 1; 610 std::vector<StdSize> sstart, scount; 611 612 if (this->wmpi && collective) 613 CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); 614 if (this->wmpi && !collective) 615 CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 616 617 this->getWriteDataInfos(name, record, array_size, sstart, scount, NULL, NULL); 618 this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 619 } 620 621 597 622 //--------------------------------------------------------------- 598 623 -
XIOS/dev/branch_yushan_merged/src/io/onetcdf4.hpp
r1160 r1205 73 73 void writeTimeAxisData(const CArray<double,1>& data, const StdString& name, 74 74 bool collective, StdSize record, bool Isroot); 75 void writeTimeAxisDataBounds(const CArray<double,1>& data, const StdString& name, 76 bool collective, StdSize record, bool Isroot); 75 77 /// Accesseur /// 76 78 const CONetCDF4Path& getCurrentPath(void) const; -
XIOS/dev/branch_yushan_merged/src/io/onetcdf4_impl.hpp
r1160 r1205 25 25 CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 26 26 27 CTimer::get("Files : get data infos").resume(); 27 28 this->getWriteDataInfos 28 29 (name, record, array_size, sstart, scount, start, count); 30 CTimer::get("Files : get data infos").suspend(); 31 29 32 if (data.numElements() != array_size) 30 33 { … … 54 57 CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 55 58 56 this->getWriteDataInfos 57 (name, record, array_size, sstart, scount, start, count); 59 CTimer::get("CONetCDF4::writeData getWriteDataInfos").resume(); 60 this->getWriteDataInfos(name, record, array_size, sstart, scount, start, count); 61 CTimer::get("CONetCDF4::writeData getWriteDataInfos").suspend(); 62 58 63 if (data.numElements()*stringArrayLen != array_size) 59 64 { … … 72 77 PtrArrayStr[it->size()]='\0' ; 73 78 } 79 CTimer::get("CONetCDF4::writeData writeData_").resume(); 74 80 this->writeData_(grpid, varid, sstart, scount, ArrayStr); 81 CTimer::get("CONetCDF4::writeData writeData_").suspend(); 75 82 delete [] ArrayStr ; 76 83 }
Note: See TracChangeset
for help on using the changeset viewer.