[782] | 1 | #ifndef __XIOS_INETCDF4_IMPL__ |
---|
| 2 | #define __XIOS_INETCDF4_IMPL__ |
---|
| 3 | |
---|
| 4 | #include "inetcdf4.hpp" |
---|
| 5 | #include "netCdfInterface.hpp" |
---|
| 6 | |
---|
| 7 | namespace xios |
---|
| 8 | { |
---|
| 9 | template <class T, int Ndim> |
---|
| 10 | void 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__ |
---|