Ignore:
Timestamp:
05/17/17 11:02:34 (7 years ago)
Author:
ymipsl
Message:
  • Add new timer for better profiling. The full timer output will be provided only for info_level=100
  • Add new file attribute : convention_str (string) : this string will overide the default value wrote in the file (CF-1.6 or UGRID)

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/io/onetcdf4.cpp

    r1097 r1135  
    77#include "netCdfInterface.hpp" 
    88#include "netCdfException.hpp" 
     9#include "timer.hpp" 
    910 
    1011namespace xios 
     
    5556         if (!append || !std::ifstream(filename.c_str())) 
    5657         { 
     58            CTimer::get("Files : create").resume(); 
    5759            if (wmpi) 
    5860               CNetCdfInterface::createPar(filename, mode, *comm, MPI_INFO_NULL, 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, *comm, MPI_INFO_NULL, this->ncidp); 
    6973            else 
    7074               CNetCdfInterface::open(filename, mode, this->ncidp); 
    71  
     75            CTimer::get("Files : open").suspend(); 
    7276            this->appendMode = true; 
    7377         } 
     
    8387      void CONetCDF4::close() 
    8488      { 
     89        CTimer::get("Files : close").resume(); 
    8590        CNetCdfInterface::close(this->ncidp); 
     91        CTimer::get("Files : close").suspend(); 
    8692      } 
    8793 
     
    557563 
    558564         this->getWriteDataInfos(name, 0, array_size,  sstart, scount, NULL, NULL); 
     565 
    559566         this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
     567 
    560568      } 
    561569 
     
    583591 
    584592         this->getWriteDataInfos(name, record, array_size,  sstart, scount, NULL, NULL); 
    585          if (using_netcdf_internal) 
    586          { 
    587            if (!isRoot) 
    588            { 
    589              sstart[0] = sstart[0] + 1; 
    590              scount[0] = 0; 
    591            } 
    592          } 
    593593         this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
    594594       } 
    595595 
     596      void CONetCDF4::writeTimeAxisDataBounds(const CArray<double, 1>& data, const StdString& name, 
     597                                        bool collective, StdSize record, bool isRoot) 
     598      { 
     599         int grpid = this->getCurrentGroup(); 
     600         int varid = this->getVariable(name); 
     601 
     602         map<int,size_t>::iterator it=timeAxis.find(varid); 
     603         if (it == timeAxis.end()) timeAxis[varid] = record; 
     604         else 
     605         { 
     606           if (it->second >= record) return; 
     607           else it->second =record; 
     608         } 
     609 
     610         StdSize array_size = 1; 
     611         std::vector<StdSize> sstart, scount; 
     612 
     613         if (this->wmpi && collective) 
     614            CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); 
     615         if (this->wmpi && !collective) 
     616            CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 
     617 
     618         this->getWriteDataInfos(name, record, array_size,  sstart, scount, NULL, NULL); 
     619         this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
     620       } 
     621 
     622 
    596623      //--------------------------------------------------------------- 
    597624 
Note: See TracChangeset for help on using the changeset viewer.