source: vendor/nemo/current/NEMOGCM/EXTERNAL/XIOS/src/output/onetcdf4_impl.hpp @ 44

Last change on this file since 44 was 44, checked in by cholod, 12 years ago

Load NEMO_TMP into vendor/nemo/current.

File size: 1.8 KB
Line 
1#ifndef __ONETCDF4_IMPL_HPP__
2#define __ONETCDF4_IMPL_HPP__
3
4#include "onetcdf4.hpp"
5
6namespace xios
7{
8  template <class T, StdSize ndim>
9  void CONetCDF4::writeData(const ARRAY(T, ndim) data, const StdString & name,
10                            bool collective, StdSize record,
11                            const std::vector<StdSize> * start,
12                            const std::vector<StdSize> * count)
13  {
14    int grpid = this->getCurrentGroup();
15    int varid = this->getVariable(name);
16    StdSize array_size = 1;
17    std::vector<StdSize> sstart, scount;
18
19    if (this->wmpi && collective)
20    CheckError(nc_var_par_access(grpid, varid, NC_COLLECTIVE));
21    if (this->wmpi && !collective)
22    CheckError(nc_var_par_access(grpid, varid, NC_INDEPENDENT));
23
24    this->getWriteDataInfos
25    (name, record, array_size,  sstart, scount, start, count);
26    if (data->num_elements() != array_size)
27    {
28      ERROR("CONetCDF4::writeData(...)",
29      << "[ input array size = "  << data->num_elements()
30      << ", intern array size = " << array_size
31      << " ] Invalid input data !" );
32    }
33         
34    this->writeData_(grpid, varid, sstart, scount, data->data());
35  }
36     
37//----------------------------------------------------------------
38           
39  template <class T>
40  void CONetCDF4::setDefaultValue(const StdString & varname, const T * value)
41  {
42    int grpid = this->getCurrentGroup();
43    int varid = this->getVariable(varname);
44         
45    if (value != NULL)
46    {
47      CheckError(nc_def_var_fill(grpid, varid, 0, value));
48      this->addAttribute(StdString("missing_value"), *value, &varname);
49    }
50    else CheckError(nc_def_var_fill(grpid, varid, 1, NULL));         
51  }
52     
53  ///---------------------------------------------------------------
54
55}
56
57
58
59
60
61
62
63
64
65
66
67
68#endif
Note: See TracBrowser for help on using the repository browser.