set_package.cpp
Go to the documentation of this file.
1
// Copyright 2019, University of Maryland and the MANGO development team.
2
//
3
// This file is part of MANGO.
4
//
5
// MANGO is free software: you can redistribute it and/or modify it
6
// under the terms of the GNU Lesser General Public License as
7
// published by the Free Software Foundation, either version 3 of the
8
// License, or (at your option) any later version.
9
//
10
// MANGO is distributed in the hope that it will be useful, but
11
// WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with MANGO. If not, see
17
// <https://www.gnu.org/licenses/>.
18
19
#include <stdexcept>
20
#include "
mango.hpp
"
21
#include "
Solver.hpp
"
22
// <includes>
23
// This section was automatically generated by ./update_algorithms
24
#include "
Package_hopspack.hpp
"
25
#include "
Package_mango.hpp
"
26
#include "
Package_nlopt.hpp
"
27
#include "
Package_gsl.hpp
"
28
#include "
Package_petsc.hpp
"
29
// </includes>
30
31
// This file is the only place where the core of mango (specifically Solver) knows
32
// anything about the concrete Packages available.
33
34
void
mango::Solver::set_package
() {
35
switch
(
algorithms
[
algorithm
].
package
) {
36
// <packages>
37
// This section was automatically generated by ./update_algorithms
38
case
PACKAGE_HOPSPACK
:
39
package
= new Package_hopspack();
40
break
;
41
case
PACKAGE_MANGO
:
42
package
= new Package_mango();
43
break
;
44
case
PACKAGE_NLOPT
:
45
package
= new Package_nlopt();
46
break
;
47
case
PACKAGE_GSL
:
48
package
= new Package_gsl();
49
break
;
50
case
PACKAGE_PETSC
:
51
package
= new Package_petsc();
52
break
;
53
// </packages>
54
default
:
55
throw
std::runtime_error(
"Unknown package in mango::Solver::set_package"
);
56
}
57
}
mango::Solver::package
Package * package
Definition:
Solver.hpp:57
Package_hopspack.hpp
Package_gsl.hpp
Package_petsc.hpp
Solver.hpp
mango::algorithms
const algorithm_properties algorithms[NUM_ALGORITHMS]
A database of the algorithms that MANGO is aware of, including various properties of each algorithm.
Definition:
mango.hpp:124
mango::PACKAGE_PETSC
@ PACKAGE_PETSC
Definition:
mango.hpp:43
mango::PACKAGE_HOPSPACK
@ PACKAGE_HOPSPACK
Definition:
mango.hpp:39
mango::PACKAGE_MANGO
@ PACKAGE_MANGO
Definition:
mango.hpp:40
mango.hpp
Package_mango.hpp
mango::Solver::algorithm
algorithm_type algorithm
Definition:
Solver.hpp:42
mango::PACKAGE_NLOPT
@ PACKAGE_NLOPT
Definition:
mango.hpp:41
Package_nlopt.hpp
mango::Solver::set_package
virtual void set_package()
Definition:
set_package.cpp:34
mango::PACKAGE_GSL
@ PACKAGE_GSL
Definition:
mango.hpp:42