38 #ifndef TYPES_STRUCTTYPE_H
39 #define TYPES_STRUCTTYPE_H
89 StructType(
unsigned int count,
unsigned int blockLength[],
100 m_types =
new MPI_Datatype[count];
102 for (
unsigned int i = 0; i < count; i++) {
125 #endif // ASAGI_NOMPI
137 #endif // ASAGI_NOMPI
155 MPI_Datatype tmpType;
158 if (MPI_Type_create_struct(
163 &tmpType) != MPI_SUCCESS)
165 if (MPI_Type_create_resized(tmpType, 0, size, &
m_mpiType)
169 if (MPI_Type_commit(&
m_mpiType) != MPI_SUCCESS)
172 if (MPI_Type_free(&tmpType) != MPI_SUCCESS)
183 #endif // ASAGI_NOMPI
185 std::lock_guard<threads::Mutex> lock(
m_lock, std::adopt_lock);
204 #endif // ASAGI_NOMPI
210 const size_t *offset,
220 void convert(
const void* data,
void* buf)
const
228 unsigned int blockLength[],
229 unsigned long displacements[],
234 #endif // TYPES_STRUCTTYPE_H
static void copy(const void *data, void *buf, unsigned int size)
Type * createStruct(unsigned int count, unsigned int blockLength[], unsigned long displacements[], asagi::Grid::Type types[])
friend Type * createStruct(unsigned int count, unsigned int blockLength[], unsigned long displacements[], asagi::Grid::Type types[])
unsigned int size() const
MPI_Datatype getMPIType() const
StructType(unsigned int count, unsigned int blockLength[], unsigned long displacements[], asagi::Grid::Type types[])
void getBlock(void *block, const size_t *offset, const size_t *size)
Reads a block of cells from the netcdf file. The type is converted to T.
void load(io::NetCdfReader &file, const size_t *offset, const size_t *size, void *buf) const
Include file for C and C++ API.
unsigned int getVarSize() const
MPI_Aint * m_displacements
void convert(const void *data, void *buf) const
asagi::Grid::Error check(const io::NetCdfReader &file)