Ignore:
Timestamp:
07/10/17 18:17:04 (7 years ago)
Author:
yushan
Message:

branch merged with trunk @1200

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan_merged/src/io/onetcdf4.cpp

    r1160 r1205  
    66#include "netCdfInterface.hpp" 
    77#include "netCdfException.hpp" 
    8 // mpi_std.hpp 
     8#include "timer.hpp" 
    99 
    1010namespace xios 
     
    5454         if (!append || !std::ifstream(filename.c_str())) 
    5555         { 
     56            CTimer::get("Files : create").resume(); 
    5657            if (wmpi) 
    5758               CNetCdfInterface::createPar(filename, mode, *comm, MPI_INFO_NULL_STD, this->ncidp); 
    5859            else 
    5960               CNetCdfInterface::create(filename, mode, this->ncidp); 
    60  
     61            CTimer::get("Files : create").suspend(); 
     62  
    6163            this->appendMode = false; 
    6264         } 
     
    6466         { 
    6567            mode |= NC_WRITE; 
     68            CTimer::get("Files : open").resume(); 
    6669            if (wmpi) 
    67                //CNetCdfInterface::openPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), MPI_INFO_NULL_STD, this->ncidp); 
    6870               CNetCdfInterface::openPar(filename, mode, *comm, MPI_INFO_NULL_STD, this->ncidp); 
    6971            else 
    7072               CNetCdfInterface::open(filename, mode, this->ncidp); 
    71  
     73            CTimer::get("Files : open").suspend(); 
    7274            this->appendMode = true; 
    7375         } 
     
    8385      void CONetCDF4::close() 
    8486      { 
     87        CTimer::get("Files : close").resume(); 
    8588        CNetCdfInterface::close(this->ncidp); 
     89        CTimer::get("Files : close").suspend(); 
    8690      } 
    8791 
     
    558562 
    559563         this->getWriteDataInfos(name, 0, array_size,  sstart, scount, NULL, NULL); 
     564 
    560565         this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
     566 
    561567      } 
    562568 
     
    584590 
    585591         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          } 
    594592         this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
    595593       } 
    596594 
     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 
    597622      //--------------------------------------------------------------- 
    598623 
Note: See TracChangeset for help on using the changeset viewer.