source: XIOS/trunk/src/io/inetcdf4_impl.hpp @ 934

Last change on this file since 934 was 782, checked in by mhnguyen, 8 years ago

Reading attributes of curvilinear grid from file

+) Correct some minor bugs detecting type of grid
+) Use constant string for attributes conforming to CF convention
+) Add part of code to read attributes of curvilinear grid

Test
+) On Curie
+) test_remap passes

File size: 1.1 KB
Line 
1#ifndef __XIOS_INETCDF4_IMPL__
2#define __XIOS_INETCDF4_IMPL__
3
4#include "inetcdf4.hpp"
5#include "netCdfInterface.hpp"
6
7namespace xios
8{
9template <class T, int Ndim>
10void CINetCDF4::getData(CArray<T, Ndim>& data, const StdString& var,
11                       bool collective, StdSize record,
12                       const std::vector<StdSize>* start,
13                       const std::vector<StdSize>* count)
14{
15  int varid = this->getVariable(var);
16
17  if (this->mpi && collective)
18    CNetCdfInterface::varParAccess(ncidp, varid, NC_COLLECTIVE);
19  else if (this->mpi && !collective)
20    CNetCdfInterface::varParAccess(ncidp, varid, NC_INDEPENDENT);
21
22  std::vector<StdSize> sstart, scount;
23  StdSize array_size = 1;
24  this->getDataInfo(var, NULL, record, sstart, scount, array_size, start, count);
25
26  if (data.numElements() != array_size)
27  {
28    ERROR("CINetCDF4::getData(...)",
29          << "[ Array size = " << data.numElements()
30          << ", Data size = "  << array_size
31          << " ] Invalid array size");
32  }
33
34  CNetCdfInterface::getVaraType(ncidp, varid, &sstart[0], &scount[0], data.dataFirst());
35}
36
37} // namespace xios
38
39#endif //__XIOS_INETCDF4_IMPL__
Note: See TracBrowser for help on using the repository browser.