PSCF v1.1
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
55 {
56
57 public:
58
61
65 void setBase(void* objectAddress);
66
81 void addMember(void* memberAddress, MPI::Datatype type, int count = 1);
82
91 void commit(MPI::Datatype& newType);
92
93 private:
94
95 static const int MaxNBlock = 20; // Maximum allowed number of members
96
97 MPI::Aint base_; // address of example object
98 MPI::Datatype types_[MaxNBlock]; // datatypes of members
99 MPI::Aint addresses_[MaxNBlock]; // addresses of members
100 int counts_[MaxNBlock]; // counts of members
101 int nMember_; // number of members added
102
103 };
104}
105#endif
106#endif
A MpiStructBuilder objects is used to create an MPI Struct datatype.
void addMember(void *memberAddress, MPI::Datatype type, int count=1)
Add a new member variable to the type map.
void setBase(void *objectAddress)
Set address of an class instance.
MpiStructBuilder()
Default constructor.
void commit(MPI::Datatype &newType)
Build and commit a user-defined MPI Struct datatype.
File containing preprocessor macros for error handling.
Utility classes for scientific computation.
Definition: accumulators.mod:1