#ifndef __ONETCDF4_IMPL_HPP__ #define __ONETCDF4_IMPL_HPP__ #include "onetcdf4.hpp" #include "netCdfInterface.hpp" namespace xios { template void CONetCDF4::writeData(const CArray& data, const StdString & name, bool collective, StdSize record, const std::vector * start, const std::vector * count) { int grpid = this->getCurrentGroup(); int varid = this->getVariable(name); StdSize array_size = 1; std::vector sstart, scount; if (this->wmpi && collective) CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); if (this->wmpi && !collective) CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); this->getWriteDataInfos (name, record, array_size, sstart, scount, start, count); if (data.numElements() != array_size) { ERROR("CONetCDF4::writeData(...)", << "[ input array size = " << data.numElements() << ", intern array size = " << array_size << " ] Invalid input data !" ); } this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); } //---------------------------------------------------------------- template void CONetCDF4::setDefaultValue(const StdString & varname, const T * value) { int grpid = this->getCurrentGroup(); int varid = this->getVariable(varname); if (value != NULL) { // nc_def_var_fill will automatically set the _FillValue attribute when // using the NetCDF 4 format but we need to do it manually otherwise if (useClassicFormat) this->addAttribute(StdString("_FillValue"), *value, &varname); else CNetCdfInterface::defVarFill(grpid, varid, 0, (void*)value); this->addAttribute(StdString("missing_value"), *value, &varname); } else if (!useClassicFormat) { // The "no-fill mode" is set globally for the classic NetCDF format CNetCdfInterface::defVarFill(grpid, varid, 1, NULL); } } ///--------------------------------------------------------------- } #endif