Scippy

UG

Ubiquity Generator framework

scipParaSolution.cpp
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 scipParaSolution.cpp
27 * @brief ParaSolution extension for SCIP solver.
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#include "scipParaSolution.h"
38
39using namespace ParaSCIP;
40
41#ifdef UG_WITH_ZLIB
42
43void
44ScipParaSolution::write(
45 gzstream::ogzstream &out
46 )
47{
48 out.write((char *)&objectiveFunctionValue, sizeof(double));
49 out.write((char *)&nVars, sizeof(int));
50 for(int i = 0; i < nVars; i++ )
51 {
52 out.write((char *)&indicesAmongSolvers[i], sizeof(int));
53 out.write((char *)&values[i], sizeof(SCIP_Real));
54 }
55}
56
57bool
60 gzstream::igzstream &in
61 )
62{
63 in.read((char *)&objectiveFunctionValue, sizeof(double));
64 if( in.eof() ) return false;
65 in.read((char *)&nVars, sizeof(int));
66 indicesAmongSolvers = new int[nVars];
67 values = new SCIP_Real[nVars];
68 for(int i = 0; i < nVars; i++ )
69 {
70 in.read((char *)&indicesAmongSolvers[i], sizeof(int));
71 in.read((char *)&values[i], sizeof(SCIP_Real));
72 }
73 return true;
74}
75
76#endif
bool read(UG::ParaComm *comm, gzstream::igzstream &in)
Base class of communicator object.
Definition: paraComm.h:102
static ScipParaCommTh * comm
Definition: fscip.cpp:73
ParaSolution extension for SCIP solver.