1 // Copyright (C) 2006-2015 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, or (at your option) any later version.
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
26 Emulator::Emulator(void)
28 solver = new SalomeTest((Superviseur &) *this);
31 Emulator::~Emulator(void)
37 void Emulator::destroyAll(void)
39 std::pair<long,std::vector<double> *> pa;
48 void Emulator::push(long id, std::vector<double> &cal)
50 std::pair<long, std::vector<double> *> *tmp;
52 tmp = new std::pair<long, std::vector<double> *>(id, &cal);
57 long Emulator::getCurrentId(void)
59 std::vector<double> *cal;
60 std::pair<long,std::vector<double> *> pa;
62 pa = q.front(); q.pop();
69 std::vector<double> *Emulator::getCurrentOut(void)
74 std::vector<double> *Emulator::eval(std::vector<double> &x)
76 std::vector<double> *res;
77 res = new std::vector<double>(1);
85 (*res)[0] = fabs(x1) + fabs(x2+50);
87 (*res)[0] = fabs(x2-50);
89 (*res)[0] += 1 + fabs(x1+50);
91 (*res)[0] += 2 + fabs(x1-50);
98 x1 = x[0] ; x2 = x1*x1 - x[1]; x1 -= 1;
99 (*res)[0] = x1*x1 + 100*x2*x2 ;
106 for (i=0; i<NBGENE; i++) {
109 x2 *= cos(y/sqrt(i+1));
111 (*res)[0] = x1 / 4000 - x2 + 1;
116 void Emulator::run(void)
118 solver->readFromFile("caca");