Changeset 1205 for XIOS/dev/branch_yushan_merged/src/io/onetcdf4.cpp
- Timestamp:
- 07/10/17 18:17:04 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.