Scippy

UG

Ubiquity Generator framework

paraParamSetMpi.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and software framework */
4 /* UG --- Ubquity Generator Framework */
5 /* */
6 /* Copyright Written by Yuji Shinano <shinano@zib.de>, */
7 /* Copyright (C) 2021 by Zuse Institute Berlin, */
8 /* licensed under LGPL version 3 or later. */
9 /* Commercial licenses are available through <licenses@zib.de> */
10 /* */
11 /* This code is free software; you can redistribute it and/or */
12 /* modify it under the terms of the GNU Lesser General Public License */
13 /* as published by the Free Software Foundation; either version 3 */
14 /* of the License, or (at your option) any later version. */
15 /* */
16 /* This program is distributed in the hope that it will be useful, */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19 /* GNU Lesser General Public License for more details. */
20 /* */
21 /* You should have received a copy of the GNU Lesser General Public License */
22 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 /* */
24 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25 
26 /**@file paraParamSetMpi.h
27  * @brief ParaParamSet extension for MPI communication.
28  * @author Yuji Shinano
29  *
30  *
31  *
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 
37 #ifndef __PARA_PARAM_SET_MPI_H__
38 #define __PARA_PARAM_SET_MPI_H__
39 #include <mpi.h>
40 #include "paraCommMpi.h"
41 #include "paraParamSet.h"
42 
43 namespace UG
44 {
45 
46 ///
47 /// class ParaParamSetMpi
48 /// @note This class is to transfer all parameters which are NOT default values
49 ///
50 class ParaParamSetMpi : public ParaParamSet {
51 
52  int nBoolParams; ///< the number of bool parameters
53  int *boolParams; ///< boolean parameter ids
54  char *boolParamValues; ///< boolean parameter values
55 
56  int nIntParams; ///< the number of int parameters
57  int *intParams; ///< int parameter ids
58  int *intParamValues; ///< int parameter values
59 
60  int nLongintParams; ///< the number of long int parameters
61  int *longintParams; ///< long int parameter ids
62  long long *longintParamValues; ///< long int parameter values
63 
64  int nRealParams; ///< the number of real parameters
65  int *realParams; ///< real parameter ids
66  double *realParamValues; ///< real parameter values
67 
68  int nCharParams; ///< the number of char parameters
69  int *charParams; ///< char parameter ids
70  char *charParamValues; ///< char parameter values
71 
72  int nStringParams; ///< the number of string parameters
73  int *stringParams; ///< string parameter ids
74  int stringParamValuesSize; ///< size of stringParameterValues area
75  char *stringParamValues; ///< string parameter values: values are concatenated
76 
77  ///
78  /// allocate temporary memory for transfer
79  ///
80  void allocateMemory(
81  );
82 
83  ///
84  /// free allocated temporary memory for transfer
85  ///
86  void freeMemory(
87  );
88 
89  ///
90  /// create non default parameters for transfer
91  ///
92  void createDiffParams(
93  );
94 
95  ///
96  /// set non default parameters transferred
97  ///
98  void setDiffParams(
99  );
100 
101  ///
102  /// create ParaParamSetDatatype1
103  /// @return ParaParamSetDatatype1 created
104  ///
105  MPI_Datatype createDatatype1(
106  );
107 
108  ///
109  /// create ParaParamSetDatatype2
110  /// @return ParaParamSetDatatype2 created
111  ///
112  MPI_Datatype createDatatype2(
113  bool reallocateStringPramsValue
114  );
115 
116 public:
117 
118  ///
119  /// constructor
120  ///
122  )
123  : nBoolParams(0),
124  boolParams(0),
125  boolParamValues(0),
126  nIntParams(0),
127  intParams(0),
128  intParamValues(0),
129  nLongintParams(0),
130  longintParams(0),
131  longintParamValues(0),
132  nRealParams(0),
133  realParams(0),
134  realParamValues(0),
135  nCharParams(0),
136  charParams(0),
137  charParamValues(0),
138  nStringParams(0),
139  stringParams(0),
140  stringParamValuesSize(0),
141  stringParamValues(0)
142  {
143  }
144 
145  ///
146  /// constructor
147  ///
149  int inNParaParams
150  )
151  : ParaParamSet(inNParaParams),
152  nBoolParams(0),
153  boolParams(0),
154  boolParamValues(0),
155  nIntParams(0),
156  intParams(0),
157  intParamValues(0),
158  nLongintParams(0),
159  longintParams(0),
160  longintParamValues(0),
161  nRealParams(0),
162  realParams(0),
163  realParamValues(0),
164  nCharParams(0),
165  charParams(0),
166  charParamValues(0),
167  nStringParams(0),
168  stringParams(0),
169  stringParamValuesSize(0),
170  stringParamValues(0)
171  {
172  }
173 
174  ///
175  /// destructor
176  ///
178  )
179  {
180  }
181 
182  ///
183  /// broadcast ParaParams
184  /// @return always 0 (for future extensions)
185  ///
186  int bcast(
187  ParaComm *comm, ///< communicator used
188  int root ///< root rank for broadcast
189  );
190 
191 };
192 
193 }
194 
195 #endif // __PARA_PARAM_SET_MPI_H__
long long * longintParamValues
long int parameter values
void freeMemory()
free allocated temporary memory for transfer
char * stringParamValues
string parameter values: values are concatenated
ParaParamSetMpi(int inNParaParams)
constructor
int stringParamValuesSize
size of stringParameterValues area
double * realParamValues
real parameter values
char * boolParamValues
boolean parameter values
int * charParams
char parameter ids
int * intParams
int parameter ids
static ScipParaCommTh * comm
Definition: fscip.cpp:73
int nIntParams
the number of int parameters
int nBoolParams
the number of bool parameters
int bcast(ParaComm *comm, int root)
broadcast ParaParams
int * longintParams
long int parameter ids
MPI_Datatype createDatatype1()
create ParaParamSetDatatype1
MPI_Datatype createDatatype2(bool reallocateStringPramsValue)
create ParaParamSetDatatype2
int nStringParams
the number of string parameters
int nLongintParams
the number of long int parameters
int * realParams
real parameter ids
int * stringParams
string parameter ids
ParaComm extension for MPI communication.
int * boolParams
boolean parameter ids
Parameter set for UG framework.
int nRealParams
the number of real parameters
class ParaParamSet
Definition: paraParamSet.h:850
int nCharParams
the number of char parameters
char * charParamValues
char parameter values
int * intParamValues
int parameter values
class ParaParamSetMpi
void createDiffParams()
create non default parameters for transfer
void allocateMemory()
allocate temporary memory for transfer
void setDiffParams()
set non default parameters transferred
ParaParamSetMpi()
constructor
Base class of communicator object.
Definition: paraComm.h:101
~ParaParamSetMpi()
destructor