1 // Copyright (C) 2006-2008 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 Emulator::Emulator(void)
27 solver = new SalomeTest((Superviseur &) *this);
30 Emulator::~Emulator(void)
36 void Emulator::destroyAll(void)
38 std::pair<long,std::vector<double> *> pa;
47 void Emulator::push(long id, std::vector<double> &cal)
49 std::pair<long, std::vector<double> *> *tmp;
51 tmp = new std::pair<long, std::vector<double> *>(id, &cal);
56 long Emulator::getCurrentId(void)
58 std::vector<double> *cal;
59 std::pair<long,std::vector<double> *> pa;
61 pa = q.front(); q.pop();
68 std::vector<double> *Emulator::getCurrentOut(void)
73 std::vector<double> *Emulator::eval(std::vector<double> &x)
75 std::vector<double> *res;
76 res = new std::vector<double>(1);
84 (*res)[0] = fabs(x1) + fabs(x2+50);
86 (*res)[0] = fabs(x2-50);
88 (*res)[0] += 1 + fabs(x1+50);
90 (*res)[0] += 2 + fabs(x1-50);
97 x1 = x[0] ; x2 = x1*x1 - x[1]; x1 -= 1;
98 (*res)[0] = x1*x1 + 100*x2*x2 ;
105 for (i=0; i<NBGENE; i++) {
108 x2 *= cos(y/sqrt(i+1));
110 (*res)[0] = x1 / 4000 - x2 + 1;
115 void Emulator::run(void)
117 solver->readFromFile("caca");