Ignore:
Timestamp:
06/06/17 15:52:13 (7 years ago)
Author:
yushan
Message:

branch merged with trunk @1155

File:
1 edited

Legend:

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

    r1138 r1156  
    66#include "netCdfInterface.hpp" 
    77#include "netCdfException.hpp" 
     8#include "timer.hpp" 
    89// mpi_std.hpp 
    910 
     
    5455         if (!append || !std::ifstream(filename.c_str())) 
    5556         { 
     57            CTimer::get("Files : create").resume(); 
    5658            if (wmpi) 
    5759               //CNetCdfInterface::createPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), MPI_INFO_NULL_STD, this->ncidp);            
     
    5961            else 
    6062               CNetCdfInterface::create(filename, mode, this->ncidp); 
    61  
     63            CTimer::get("Files : create").suspend(); 
     64  
    6265            this->appendMode = false; 
    6366         } 
     
    6568         { 
    6669            mode |= NC_WRITE; 
     70            CTimer::get("Files : open").resume(); 
    6771            if (wmpi) 
    6872               //CNetCdfInterface::openPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), MPI_INFO_NULL_STD, this->ncidp); 
     
    7074            else 
    7175               CNetCdfInterface::open(filename, mode, this->ncidp); 
    72  
     76            CTimer::get("Files : open").suspend(); 
    7377            this->appendMode = true; 
    7478         } 
     
    8488      void CONetCDF4::close() 
    8589      { 
     90        CTimer::get("Files : close").resume(); 
    8691        CNetCdfInterface::close(this->ncidp); 
     92        CTimer::get("Files : close").suspend(); 
    8793      } 
    8894 
     
    559565 
    560566         this->getWriteDataInfos(name, 0, array_size,  sstart, scount, NULL, NULL); 
     567 
    561568         this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
     569 
    562570      } 
    563571 
     
    585593 
    586594         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          } 
    595595         this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
    596596       } 
    597597 
     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 
    598625      //--------------------------------------------------------------- 
    599626 
Note: See TracChangeset for help on using the changeset viewer.