Scippy

UG

Ubiquity Generator framework

paraCalculationState.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 paraCalculationState.h
27 * @brief Base class for calculation state.
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_CALCULATION_STATE_H__
38#define __PARA_CALCULATION_STATE_H__
39
40#include <climits>
41#include <cfloat>
42#include "paraComm.h"
43
44namespace UG
45{
46
47///
48/// \class ParaCalculationState
49/// Base class of Calculation state in a ParaSolver
50///
52{
53protected:
54 double compTime; ///< computation time of this ParaTask
55 int nSolved; ///< the number of tasks solved
56 int terminationState; ///< indicate whether if this computation is terminationState or not. 0: no, 1: terminationState
57 ///< meaning can be defined in derived class
58public:
59
60 ///
61 /// Default Constructor
62 ///
64 )
65 : compTime(0.0),
66 nSolved(-1),
68 {
69 }
70
71 ///
72 /// Constructor
73 ///
75 double inCompTime, ///< computation time of this ParaTask
76 int inNSolved, ///< the number of tasks solved
77 int inTerminationState ///< indicate whether if this computation is terminationState or not. 0: no, 1: terminationState
78 )
79 : compTime(inCompTime),
80 nSolved(inNSolved),
81 terminationState(inTerminationState)
82 {
83 }
84
85 ///
86 /// Destructor
87 ///
88 virtual
90 )
91 {
92 }
93
94 ///
95 /// getter of computing time of a subproblem
96 /// @return subroblem computing time
97 ///
98 double
100 )
101 {
102 return compTime;
103 }
104
105 ///
106 /// geeter of the number of tasks solved in a subproblem
107 /// @return the number of tasks
108 ///
110 )
111 {
112 return nSolved;
113 }
114
115 ///
116 /// getter of the termination state for solving the subproblem
117 /// @return the termination state
119 )
120 {
121 return terminationState;
122 }
123
124 ///
125 /// stringfy ParaCalculationState
126 /// @return string to show this object
127 ///
128 virtual std::string toString(
129 ) = 0;
130
131 ///
132 /// stringfy ParaCalculationState (simple string version)
133 /// @return simple string to show this object
134 ///
135 virtual std::string toSimpleString(
136 ) = 0;
137
138 ///
139 /// send this object to destination
140 ///
141 virtual void send(
142 ParaComm *comm, ///< communicator used to send this object
143 int destination, ///< destination rank to send
144 int tag ///< tag to show this object
145 ) = 0;
146
147 ///
148 /// send this object to destination
149 ///
150 virtual void receive(
151 ParaComm *comm, ///< communicator used to receive this object
152 int source, ///< source rank to receive this object
153 int tag ///< tag to show this object
154 ) = 0;
155
156};
157
158}
159
160#endif // __PARA_CALCULATION_STATE_H__
Base class of Calculation state in a ParaSolver.
virtual void send(ParaComm *comm, int destination, int tag)=0
send this object to destination
int nSolved
the number of tasks solved
int terminationState
indicate whether if this computation is terminationState or not. 0: no, 1: terminationState meaning c...
ParaCalculationState()
Default Constructor.
virtual std::string toSimpleString()=0
stringfy ParaCalculationState (simple string version)
int getNSolved()
geeter of the number of tasks solved in a subproblem
double compTime
computation time of this ParaTask
double getCompTime()
getter of computing time of a subproblem
ParaCalculationState(double inCompTime, int inNSolved, int inTerminationState)
Constructor.
virtual ~ParaCalculationState()
Destructor.
virtual std::string toString()=0
stringfy ParaCalculationState
virtual void receive(ParaComm *comm, int source, int tag)=0
send this object to destination
int getTerminationState()
getter of the termination state for solving the subproblem
Base class of communicator object.
Definition: paraComm.h:102
static ScipParaCommTh * comm
Definition: fscip.cpp:73
Base class of communicator for UG Framework.