Scippy

UG

Ubiquity Generator framework

paraSolution.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 paraSolution.h
27  * @brief Base class for solution.
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_SOLUTION_H__
38 #define __PARA_SOLUTION_H__
39 
40 #include "paraComm.h"
41 #ifdef UG_WITH_ZLIB
42 #include "gzstream.h"
43 #endif
44 
45 namespace UG
46 {
47 
48 ///
49 /// class for solution
50 ///
51 /// This class should NOT have any data member.
52 ///
54 {
55 
56  ///
57  /// DO NOT HAVE DATA MEMBER!!
58  ///
59 
60 public:
61 
62  ///
63  /// default constructor
64  ///
66  )
67  {
68  }
69 
70  ///
71  /// destructor
72  ///
73  virtual ~ParaSolution(
74  )
75  {
76  }
77 
78  ///
79  /// get objective function value
80  /// @return objective function value
81  ///
82  virtual double getObjectiveFunctionValue(
83  ) = 0;
84 
85  ///
86  /// create clone of this object
87  /// @return pointer to ParaSolution object
88  ///
89  virtual ParaSolution *clone(
90  ParaComm *comm
91  ) = 0;
92 
93  ///
94  /// broadcast solution data
95  ///
96  virtual void bcast(
97  ParaComm *comm, ///< communicator used
98  int root ///< root rank for broadcast
99  ) = 0;
100 
101  ///
102  /// send solution data
103  ///
104  virtual void send(
105  ParaComm *comm, ///< communicator used
106  int destination ///< destination rank
107  ) = 0;
108 
109  ///
110  /// receive solution data
111  ///
112  virtual void receive(
113  ParaComm *comm, ///< communicator used
114  int source ///< source rank
115  ) = 0;
116 
117 #ifdef UG_WITH_ZLIB
118 
119  ///
120  /// function to write ParaSolution object to checkpoint file
121  ///
122  virtual void write(
123  gzstream::ogzstream &out ///< gzstream for output
124  ) = 0;
125 
126  ///
127  /// function to read ParaSolution object from checkpoint file
128  ///
129  virtual bool read(
130  ParaComm *comm, ///< communicator used
131  gzstream::igzstream &in ///< gzstream for input
132  ) = 0;
133 
134 #endif
135 
136  ///
137  /// stringfy ParaSolution object
138  /// @return string to show inside of this object
139  ///
140  virtual const std::string toString(
141  )
142  {
143  return std::string("");
144  }
145 
146 };
147 
149 
150 }
151 
152 #endif // __PARA_SOLUTION_H__
virtual ParaSolution * clone(ParaComm *comm)=0
create clone of this object
virtual void send(ParaComm *comm, int destination)=0
send solution data
static ScipParaCommTh * comm
Definition: fscip.cpp:73
virtual void bcast(ParaComm *comm, int root)=0
broadcast solution data
virtual void receive(ParaComm *comm, int source)=0
receive solution data
ParaSolution()
DO NOT HAVE DATA MEMBER!!
Definition: paraSolution.h:65
ParaSolution * ParaSolutionPtr
Definition: paraSolution.h:148
Base class of communicator for UG Framework.
void read(ParaComm *comm, const char *filename)
read ParaParams from file
virtual ~ParaSolution()
destructor
Definition: paraSolution.h:73
virtual const std::string toString()
stringfy ParaSolution object
Definition: paraSolution.h:140
virtual double getObjectiveFunctionValue()=0
get objective function value
Base class of communicator object.
Definition: paraComm.h:101
class for solution
Definition: paraSolution.h:53