Compadre
1.5.5
Toggle main menu visibility
Loading...
Searching...
No Matches
examples
CommandLineProcessor.hpp
Go to the documentation of this file.
1
#ifndef COMMANDLINEPROCESSOR
2
#define COMMANDLINEPROCESSOR
3
4
struct
CommandLineProcessor
{
5
6
int
order
,
dimension
,
number_target_coords
,
number_source_coords
,
number_of_batches
;
7
std::string
constraint_name
,
solver_name
,
problem_name
;
8
9
CommandLineProcessor
(
int
argc,
char
* args[],
const
bool
print=
true
) {
10
11
order
= 2;
12
dimension
= 3;
13
number_target_coords
= 200;
14
number_source_coords
= -1;
15
number_of_batches
= 1;
16
17
constraint_name
=
"NO_CONSTRAINT"
;
// "NEUMANN_GRAD_SCALAR"
18
solver_name
=
"QR"
;
// LU
19
problem_name
=
"STANDARD"
;
// MANIFOLD
20
21
for
(
int
i = 1; i < argc; ++i) {
22
if
(i + 1 < argc) {
// not at end
23
if
(std::string(args[i]) ==
"--p"
) {
24
order
= atoi(args[i+1]);
25
}
else
if
(std::string(args[i]) ==
"--d"
) {
26
dimension
= atoi(args[i+1]);
27
}
else
if
(std::string(args[i]) ==
"--nt"
) {
28
number_target_coords
= atoi(args[i+1]);
29
}
else
if
(std::string(args[i]) ==
"--ns"
) {
30
number_source_coords
= atoi(args[i+1]);
31
}
else
if
(std::string(args[i]) ==
"--nb"
) {
32
number_of_batches
= atoi(args[i+1]);
33
}
else
if
(std::string(args[i]) ==
"--solver"
) {
34
solver_name
= std::string(args[i+1]);
35
}
else
if
(std::string(args[i]) ==
"--problem"
) {
36
problem_name
= std::string(args[i+1]);
37
}
else
if
(std::string(args[i]) ==
"--constraint"
) {
38
constraint_name
= std::string(args[i+1]);
39
}
40
}
41
}
42
43
if
(print) {
44
std::cout <<
"************************************************************************"
<< std::endl;
45
std::cout <<
"order: "
<<
order
<<
", dimension: "
<<
dimension
<<
", number_target_coords: "
<<
number_target_coords
<< std::endl;
46
std::cout <<
"solver: "
<<
solver_name
<<
", problem: "
<<
problem_name
<<
", constraint: "
<<
constraint_name
<< std::endl;
47
std::cout <<
"************************************************************************"
<< std::endl;
48
49
}
50
}
51
};
52
53
#endif
CommandLineProcessor::number_of_batches
int number_of_batches
Definition
CommandLineProcessor.hpp:6
CommandLineProcessor::number_source_coords
int number_source_coords
Definition
CommandLineProcessor.hpp:6
CommandLineProcessor::constraint_name
std::string constraint_name
Definition
CommandLineProcessor.hpp:7
CommandLineProcessor::dimension
int dimension
Definition
CommandLineProcessor.hpp:6
CommandLineProcessor::problem_name
std::string problem_name
Definition
CommandLineProcessor.hpp:7
CommandLineProcessor::order
int order
Definition
CommandLineProcessor.hpp:6
CommandLineProcessor::solver_name
std::string solver_name
Definition
CommandLineProcessor.hpp:7
CommandLineProcessor::number_target_coords
int number_target_coords
Definition
CommandLineProcessor.hpp:6
CommandLineProcessor::CommandLineProcessor
CommandLineProcessor(int argc, char *args[], const bool print=true)
Definition
CommandLineProcessor.hpp:9
Generated by
1.17.0