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-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 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
45namespace 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
60public:
61
62 ///
63 /// default constructor
64 ///
66 )
67 {
68 }
69
70 ///
71 /// destructor
72 ///
74 )
75 {
76 }
77
78 ///
79 /// get objective function value
80 /// @return objective function value
81 ///
83 ) = 0;
84
85 ///
86 /// create clone of this object
87 /// @return pointer to ParaSolution object
88 ///
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__
Base class of communicator object.
Definition: paraComm.h:102
class for solution
Definition: paraSolution.h:54
virtual ~ParaSolution()
destructor
Definition: paraSolution.h:73
virtual bool read(ParaComm *comm, gzstream::igzstream &in)=0
function to read ParaSolution object from checkpoint file
ParaSolution()
DO NOT HAVE DATA MEMBER!!
Definition: paraSolution.h:65
virtual void write(gzstream::ogzstream &out)=0
function to write ParaSolution object to checkpoint file
virtual double getObjectiveFunctionValue()=0
get objective function value
virtual ParaSolution * clone(ParaComm *comm)=0
create clone of this object
virtual void send(ParaComm *comm, int destination)=0
send solution data
virtual void receive(ParaComm *comm, int source)=0
receive solution data
virtual const std::string toString()
stringfy ParaSolution object
Definition: paraSolution.h:140
virtual void bcast(ParaComm *comm, int root)=0
broadcast solution data
static ScipParaCommTh * comm
Definition: fscip.cpp:73
Utilities for handling gzipped input and output streams.
ParaSolution * ParaSolutionPtr
Definition: paraSolution.h:148
Base class of communicator for UG Framework.