PSCF v1.3
MpiStructBuilder.h
1#ifdef UTIL_MPI
2#ifndef UTIL_STRUCT_BUILDER_H
3#define UTIL_STRUCT_BUILDER_H
4
5/*
6* Util Package - C++ Utilities for Scientific Computation
7*
8* Copyright 2010 - 2017, The Regents of the University of Minnesota
9* Distributed under the terms of the GNU General Public License.
10*/
11
12#include <util/global.h>
13
14namespace Util
15{
16
56 class MpiStructBuilder
57 {
58
59 public:
60
62 MpiStructBuilder();
63
67 void setBase(void* objectAddress);
68
83 void addMember(void* memberAddress, MPI::Datatype type, int count = 1);
84
93 void commit(MPI::Datatype& newType);
94
95 private:
96
97 static const int MaxNBlock = 20; // Maximum allowed number of members
98
99 MPI::Aint base_; // address of example object
100 MPI::Datatype types_[MaxNBlock]; // datatypes of members
101 MPI::Aint addresses_[MaxNBlock]; // addresses of members
102 int counts_[MaxNBlock]; // counts of members
103 int nMember_; // number of members added
104
105 };
106}
107#endif
108#endif
File containing preprocessor macros for error handling.
Utility classes for scientific computation.