Version: 8.3.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
OptimizerAlg.cxx
Go to the documentation of this file.
1
// Copyright (C) 2006-2016 CEA/DEN, EDF R&D
2
//
3
// This library is free software; you can redistribute it and/or
4
// modify it under the terms of the GNU Lesser General Public
5
// License as published by the Free Software Foundation; either
6
// version 2.1 of the License, or (at your option) any later version.
7
//
8
// This library is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
// Lesser General Public License for more details.
12
//
13
// You should have received a copy of the GNU Lesser General Public
14
// License along with this library; if not, write to the Free Software
15
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
//
17
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18
//
19
20
#include "
OptimizerAlg.hxx
"
21
#include "
Runtime.hxx
"
22
23
using namespace
YACS::BASES;
24
using namespace
YACS::ENGINE;
25
26
OptimizerAlgBase::OptimizerAlgBase(
Pool
*pool):_pool(pool), _proc(NULL)
27
{
28
}
29
30
OptimizerAlgBase::~OptimizerAlgBase
()
31
{
32
}
33
34
void
OptimizerAlgBase::initialize
(
const
Any
*input)
throw
(
YACS::Exception
)
35
{
36
}
37
38
void
OptimizerAlgBase::finish
()
39
{
40
}
41
42
TypeCode
*
OptimizerAlgBase::getTCForAlgoInit
()
const
43
{
44
return
Runtime::_tc_string
;
45
}
46
47
TypeCode
*
OptimizerAlgBase::getTCForAlgoResult
()
const
48
{
49
return
Runtime::_tc_string
;
50
}
51
52
Any
*
OptimizerAlgBase::getAlgoResult
()
53
{
54
return
NULL;
55
}
56
57
TypeCode
*
OptimizerAlgBase::getTCForInProxy
()
const
58
{
59
return
getTCForIn
();
60
}
61
62
TypeCode
*
OptimizerAlgBase::getTCForOutProxy
()
const
63
{
64
return
getTCForOut
();
65
}
66
67
TypeCode
*
OptimizerAlgBase::getTCForAlgoInitProxy
()
const
68
{
69
return
getTCForAlgoInit
();
70
}
71
72
TypeCode
*
OptimizerAlgBase::getTCForAlgoResultProxy
()
const
73
{
74
return
getTCForAlgoResult
();
75
}
76
77
void
OptimizerAlgBase::initializeProxy
(
const
Any
*input)
throw
(
YACS::Exception
)
78
{
79
initialize(input);
80
}
81
82
void
OptimizerAlgBase::startProxy
()
83
{
84
start
();
85
}
86
87
void
OptimizerAlgBase::takeDecisionProxy
()
88
{
89
takeDecision
();
90
}
91
92
void
OptimizerAlgBase::finishProxy
()
93
{
94
finish
();
95
_errorMessage
=
""
;
96
}
97
98
Any
*
OptimizerAlgBase::getAlgoResultProxy
()
99
{
100
return
getAlgoResult
();
101
}
102
103
void
OptimizerAlgBase::setPool
(
Pool
* pool)
104
{
105
_pool
=pool;
106
}
107
108
void
OptimizerAlgBase::setProc
(
Proc
* proc)
109
{
110
_proc
= proc;
111
}
112
113
Proc
*
OptimizerAlgBase::getProc
()
114
{
115
return
_proc
;
116
}
117
118
bool
OptimizerAlgBase::hasError
()
const
119
{
120
return
(
_errorMessage
.length() > 0);
121
}
122
123
const
std::string &
OptimizerAlgBase::getError
()
const
124
{
125
return
_errorMessage
;
126
}
127
128
void
OptimizerAlgBase::setError
(
const
std::string & message)
129
{
130
_errorMessage
= (message.length() > 0) ? message :
"Unknown error"
;
131
}
132
133
void
OptimizerAlgBase::setNbOfBranches
(
int
nbOfBranches)
134
{
135
_nbOfBranches
=nbOfBranches;
136
}
137
138
int
OptimizerAlgBase::getNbOfBranches
()
const
139
{
140
return
_nbOfBranches
;
141
}
142
143
OptimizerAlgASync::OptimizerAlgASync
(
Pool
*pool):
OptimizerAlgBase
(pool)
144
{
145
}
146
147
OptimizerAlgASync::~OptimizerAlgASync
()
148
{
149
}
150
151
void
OptimizerAlgASync::finishProxy
()
152
{
153
terminateSlaveThread();
154
OptimizerAlgBase::finishProxy
();
155
}
156
157
void
OptimizerAlgASync::takeDecision
()
158
{
159
signalSlaveAndWait();
160
}
161
162
void
OptimizerAlgASync::start
()
163
{
164
AlternateThread::start();
165
}
166
167
void
OptimizerAlgASync::run
()
168
{
169
startToTakeDecision
();
170
_pool
->
destroyAll
();
171
}
src
engine
OptimizerAlg.cxx
Copyright © 2006-2017 CEA/DEN, EDF R&D