source: XIOS/dev/branch_yushan_merged/src/io/inetcdf4_impl.hpp @ 1138

Last change on this file since 1138 was 1138, checked in by yushan, 5 years ago

test_remap back to work. No thread for now

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