Changeset 352 for XIOS/trunk/src/output/onetcdf4.hpp
- Timestamp:
- 07/09/12 11:33:05 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/output/onetcdf4.hpp
r347 r352 126 126 ///--------------------------------------------------------------- 127 127 128 template <class T, StdSize ndim>129 void CONetCDF4::writeData(const ARRAY(T, ndim) data, const StdString & name,130 bool collective, StdSize record,131 const std::vector<StdSize> * start,132 const std::vector<StdSize> * count)133 {134 int grpid = this->getCurrentGroup();135 int varid = this->getVariable(name);136 StdSize array_size = 1;137 std::vector<StdSize> sstart, scount;138 128 139 if (this->wmpi && collective)140 CheckError(nc_var_par_access(grpid, varid, NC_COLLECTIVE));141 if (this->wmpi && !collective)142 CheckError(nc_var_par_access(grpid, varid, NC_INDEPENDENT));143 144 this->getWriteDataInfos145 (name, record, array_size, sstart, scount, start, count);146 if (data->num_elements() != array_size)147 {148 ERROR("CONetCDF4::writeData(...)",149 << "[ input array size = " << data->num_elements()150 << ", intern array size = " << array_size151 << " ] Invalid input data !" );152 }153 154 this->writeData_(grpid, varid, sstart, scount, data->data());155 }156 157 //----------------------------------------------------------------158 159 template <class T>160 void CONetCDF4::setDefaultValue(const StdString & varname, const T * value)161 {162 int grpid = this->getCurrentGroup();163 int varid = this->getVariable(varname);164 165 if (value != NULL)166 {167 CheckError(nc_def_var_fill(grpid, varid, 0, value));168 this->addAttribute(StdString("missing_value"), *value, &varname);169 }170 else171 CheckError(nc_def_var_fill(grpid, varid, 1, NULL));172 }173 174 ///---------------------------------------------------------------175 129 176 130 } // namespace xios
Note: See TracChangeset
for help on using the changeset viewer.