Scippy

UG

Ubiquity Generator framework

bbParaSolverStateTh.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 bbParaSolverStateTh.cpp
27 * @brief BbParaSolverState extension for threads communication.
28 * @author Yuji Shinano
29 *
30 *
31 *
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
36#include "bbParaComm.h"
37#include "bbParaSolverStateTh.h"
38
39using namespace UG;
40
42BbParaSolverStateTh::createDatatype(
43 )
44{
45 return new BbParaSolverStateTh(
48 lcId,
54 detTime,
56 );
57}
58
59void
62 int destination,
63 int tag
64 )
65{
66 assert(nNodesLeft >= 0);
67 assert(bestDualBoundValue >= -1e+10);
68 DEF_PARA_COMM( commTh, comm);
69
71 commTh->uTypeSend((void *)createDatatype(), ParaSolverStateType, destination, tag)
72 );
73}
74
75void
78 int source,
79 int tag
80 )
81{
82 DEF_PARA_COMM( commTh, comm);
83
84 BbParaSolverStateTh *received;
86 commTh->uTypeReceive((void **)&received, ParaSolverStateType, source, tag)
87 );
88
89 racingStage = received->racingStage;
91 lcId = received->lcId;
93 nNodesSolved = received->nNodesSolved;
94 nNodesLeft = received->nNodesLeft;
97 detTime = received->detTime;
99
100 delete received;
101
102}
Base class of communicator for UG Framework.
BbParaSolverState extension for threads communication.
class BbParaSolverStateTh (ParaSolver state object for notification message by thread communication)
void send(ParaComm *comm, int destination, int tag)
send this object
BbParaSolverStateTh()
default constructor
void receive(ParaComm *comm, int source, int tag)
receive this object
BbParaSolverStateTh * createDatatype()
create BbParaSolverStateTh datatype
double globalBestPrimalBoundValue
global best primal bound value
double bestDualBoundValue
best dual bound value in that of remaining nodes
double averageDualBoundGain
average dual bound gain received
int nNodesLeft
number of remaining nodes
long long nNodesSolved
number of nodes solved
Base class of communicator object.
Definition: paraComm.h:102
double detTime
deterministic time, -1: should be non-deterministic
int lcId
lc id of current ParaTask
int globalSubtreeIdInLc
global subtree id of current ParaTask
unsigned int notificationId
id for this notification
int racingStage
if this value is 1, solver is in racing stage
static ScipParaCommTh * comm
Definition: fscip.cpp:73
static const int ParaSolverStateType
#define DEF_PARA_COMM(para_comm, comm)
#define PARA_COMM_CALL(paracommcall)
Definition: paraComm.h:47