Changeset 1156 for XIOS/dev/branch_yushan_merged/src/io/onetcdf4.cpp
- Timestamp:
- 06/06/17 15:52:13 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan_merged/src/io/onetcdf4.cpp
r1138 r1156 6 6 #include "netCdfInterface.hpp" 7 7 #include "netCdfException.hpp" 8 #include "timer.hpp" 8 9 // mpi_std.hpp 9 10 … … 54 55 if (!append || !std::ifstream(filename.c_str())) 55 56 { 57 CTimer::get("Files : create").resume(); 56 58 if (wmpi) 57 59 //CNetCdfInterface::createPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), MPI_INFO_NULL_STD, this->ncidp); … … 59 61 else 60 62 CNetCdfInterface::create(filename, mode, this->ncidp); 61 63 CTimer::get("Files : create").suspend(); 64 62 65 this->appendMode = false; 63 66 } … … 65 68 { 66 69 mode |= NC_WRITE; 70 CTimer::get("Files : open").resume(); 67 71 if (wmpi) 68 72 //CNetCdfInterface::openPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), MPI_INFO_NULL_STD, this->ncidp); … … 70 74 else 71 75 CNetCdfInterface::open(filename, mode, this->ncidp); 72 76 CTimer::get("Files : open").suspend(); 73 77 this->appendMode = true; 74 78 } … … 84 88 void CONetCDF4::close() 85 89 { 90 CTimer::get("Files : close").resume(); 86 91 CNetCdfInterface::close(this->ncidp); 92 CTimer::get("Files : close").suspend(); 87 93 } 88 94 … … 559 565 560 566 this->getWriteDataInfos(name, 0, array_size, sstart, scount, NULL, NULL); 567 561 568 this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 569 562 570 } 563 571 … … 585 593 586 594 this->getWriteDataInfos(name, record, array_size, sstart, scount, NULL, NULL); 587 if (using_netcdf_internal)588 {589 if (!isRoot)590 {591 sstart[0] = sstart[0] + 1;592 scount[0] = 0;593 }594 }595 595 this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 596 596 } 597 597 598 void CONetCDF4::writeTimeAxisDataBounds(const CArray<double, 1>& data, const StdString& name, 599 bool collective, StdSize record, bool isRoot) 600 { 601 int grpid = this->getCurrentGroup(); 602 int varid = this->getVariable(name); 603 604 map<int,size_t>::iterator it=timeAxis.find(varid); 605 if (it == timeAxis.end()) timeAxis[varid] = record; 606 else 607 { 608 if (it->second >= record) return; 609 else it->second =record; 610 } 611 612 StdSize array_size = 1; 613 std::vector<StdSize> sstart, scount; 614 615 if (this->wmpi && collective) 616 CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); 617 if (this->wmpi && !collective) 618 CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 619 620 this->getWriteDataInfos(name, record, array_size, sstart, scount, NULL, NULL); 621 this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 622 } 623 624 598 625 //--------------------------------------------------------------- 599 626
Note: See TracChangeset
for help on using the changeset viewer.