Scippy

UG

Ubiquity Generator framework

paraSolverState.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-2024 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 paraSolverState.h
27 * @brief This class has solver state to be transferred.
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_SOLVER_STATE_H__
38#define __PARA_SOLVER_STATE_H__
39
40#include <cfloat>
41#include "paraComm.h"
42
43namespace UG
44{
45
46///
47/// class ParaSolverState
48/// (ParaSolver state object for notification message)
49///
51{
52
53protected:
54
55 int racingStage; ///< if this value is 1, solver is in racing stage
56 unsigned int notificationId; ///< id for this notification
57 int lcId; ///< lc id of current ParaTask
58 int globalSubtreeIdInLc; ///< global subtree id of current ParaTask
59 double detTime; ///< deterministic time, -1: should be non-deterministic
60
61public:
62
63 ///
64 /// default constructor
65 ///
67 )
68 : racingStage(0),
70 lcId(-1),
72 detTime(-1.0)
73 {
74 }
75
76 ///
77 /// copy constructor
78 ///
80 const ParaSolverState& paraSolverState
81 )
82 : racingStage(paraSolverState.racingStage),
83 notificationId(paraSolverState.notificationId),
84 lcId(paraSolverState.lcId),
86 detTime(paraSolverState.detTime)
87 {
88 }
89
90 ///
91 /// constructor
92 ///
94 int inRacingStage, ///< if this value is 1, solver is in racing stage
95 unsigned int inNotificationId, ///< id for this notification
96 int inLcId, ///< lc id of current ParaTask
97 int inGlobalSubtreeIdInLc, ///< global subtree id of current ParaTask
98 double inDetTime ///< deterministic time, -1: should be non-deterministic
99 )
100 : racingStage(inRacingStage),
101 notificationId(inNotificationId),
102 lcId(inLcId),
103 globalSubtreeIdInLc(inGlobalSubtreeIdInLc),
104 detTime(inDetTime)
105 {
106 }
107
108 ///
109 /// destractor
110 ///
112 )
113 {
114 }
115
116 ///
117 /// getter of isRacingStage
118 /// @return true if the Solver notified this message is in racing stage, false otherwise
119 ///
121 )
122 {
123 return (racingStage == 1);
124 }
125
126 ///
127 /// getter of notification id
128 /// @return notification id
129 ///
130 unsigned int getNotificaionId(
131 )
132 {
133 return notificationId;
134 }
135
136 ///
137 /// getter of LoadCoordintor id
138 /// @return LoadCoordinator id
139 ///
141 )
142 {
143 return lcId;
144 }
145
146 ///
147 /// getter of global subtree id
148 /// @return global subtree id
149 ///
151 )
152 {
153 return globalSubtreeIdInLc;
154 }
155
156 ///
157 /// getter of deterministic time
158 /// @return deterministic time
159 ///
161 )
162 {
163 return detTime;
164 }
165
166 ///
167 /// stringfy ParaSolverState
168 /// @return string to show inside of ParaSolverState
169 ///
170 virtual std::string toString(
171 ) = 0;
172
173 ///
174 /// send this object
175 ///
176 virtual void send(
177 ParaComm *comm, ///< communicator used
178 int destination, ///< destination rank
179 int tag ///< TagSolverState
180 ) = 0;
181
182 ///
183 /// receive this object
184 ///
185 virtual void receive(
186 ParaComm *comm, ///< communicator used
187 int source, ///< source rank
188 int tag ///< TagSolverState
189 ) = 0;
190
191};
192
193}
194
195#endif // __PARA_SOLVER_STATE_H__
Base class of communicator object.
Definition: paraComm.h:102
class ParaSolverState (ParaSolver state object for notification message)
ParaSolverState(const ParaSolverState &paraSolverState)
copy constructor
virtual void send(ParaComm *comm, int destination, int tag)=0
send this object
double detTime
deterministic time, -1: should be non-deterministic
int lcId
lc id of current ParaTask
ParaSolverState()
default constructor
int getGlobalSubtreeId()
getter of global subtree id
unsigned int getNotificaionId()
getter of notification id
int globalSubtreeIdInLc
global subtree id of current ParaTask
virtual ~ParaSolverState()
destractor
double getDeterministicTime()
getter of deterministic time
unsigned int notificationId
id for this notification
int getLcId()
getter of LoadCoordintor id
bool isRacingStage()
getter of isRacingStage
ParaSolverState(int inRacingStage, unsigned int inNotificationId, int inLcId, int inGlobalSubtreeIdInLc, double inDetTime)
constructor
virtual std::string toString()=0
stringfy ParaSolverState
int racingStage
if this value is 1, solver is in racing stage
virtual void receive(ParaComm *comm, int source, int tag)=0
receive this object
static ScipParaCommTh * comm
Definition: fscip.cpp:73
Base class of communicator for UG Framework.