Changeset 2481


Ignore:
Timestamp:
03/23/23 16:22:23 (15 months ago)
Author:
jderouillat
Message:

Chunk must be defined for non fields variables too in parallel write

Location:
XIOS3/trunk/src/io
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/trunk/src/io/nc4_data_output.cpp

    r2479 r2481  
    18101810        try 
    18111811        { 
    1812            SuperClassWriter::addVariable(fieldid, type, dims); 
     1812           SuperClassWriter::addVariable(fieldid, type, dims, false); 
    18131813           SuperClassWriter::addChunk(field, type, dims); 
    18141814 
  • XIOS3/trunk/src/io/onetcdf4.cpp

    r2479 r2481  
    308308 
    309309      int CONetCDF4::addVariable(const StdString& name, nc_type type, 
    310                                  const std::vector<StdString>& dim, int compressionLevel) 
     310                                 const std::vector<StdString>& dim, bool defineChunking) 
    311311      { 
    312312         int varid = 0; 
     
    315315         int dimSize = dim.size(); 
    316316 
     317         StdSize size; 
     318 
    317319         int grpid = this->getCurrentGroup(); 
    318320 
     
    323325            const StdString& dimid = *it; 
    324326            dimids.push_back(this->getDimension(dimid)); 
     327            CNetCdfInterface::inqDimLen(grpid, this->getDimension(dimid), size); 
     328            if (size == NC_UNLIMITED) size = 1; 
     329            dimsizes.push_back(size); 
    325330         } 
    326331 
    327332         CNetCdfInterface::defVar(grpid, name, type, dimids.size(), &dimids[0], varid); 
     333 
     334         if (defineChunking) { 
     335           int storageType = (0 == dimSize) ? NC_CONTIGUOUS : NC_CHUNKED; 
     336           CNetCdfInterface::defVarChunking(grpid, varid, storageType, &dimsizes[0]); 
     337           CNetCdfInterface::defVarFill(grpid, varid, true, NULL); 
     338         } 
     339 
    328340          
    329341         return varid; 
     
    509521           ERROR("void CONetCDF4::setCompressionLevel(const StdString& varname, int compressionLevel)", 
    510522                 "Impossible to use compression for variable \"" << varname << "\" when using parallel mode."); 
    511  
    512523         int grpid = this->getCurrentGroup(); 
    513524         int varid = this->getVariable(varname); 
  • XIOS3/trunk/src/io/onetcdf4.hpp

    r2479 r2481  
    4949            int addDimension(const StdString& name, const StdSize size = UNLIMITED_DIM); 
    5050            int addVariable(const StdString& name, nc_type type, 
    51                             const std::vector<StdString>& dim, int compressionLevel=0); 
     51                            const std::vector<StdString>& dim, bool defineChunking=true); 
    5252            int addChunk(CField* field, nc_type type, 
    5353                         const std::vector<StdString>& dim, int compressionLevel=0); 
Note: See TracChangeset for help on using the changeset viewer.