Line |
Branch |
Exec |
Source |
1 |
|
|
// ______ ______ _ _ _____ ______ |
2 |
|
|
// | ____| ____| | (_)/ ____| | ____| |
3 |
|
|
// | |__ | |__ | | _| (___ ___| |__ |
4 |
|
|
// | __| | __| | | | |\___ \ / __| __| |
5 |
|
|
// | | | |____| |____| |____) | (__| |____ |
6 |
|
|
// |_| |______|______|_|_____/ \___|______| |
7 |
|
|
// Finite Elements for Life Sciences and Engineering |
8 |
|
|
// |
9 |
|
|
// License: LGL2.1 License |
10 |
|
|
// FELiScE default license: LICENSE in root folder |
11 |
|
|
// |
12 |
|
|
// Main authors: Vicente Mataix Ferrandiz |
13 |
|
|
// |
14 |
|
|
|
15 |
|
|
// System includes |
16 |
|
|
|
17 |
|
|
// External includes |
18 |
|
|
|
19 |
|
|
// Project includes |
20 |
|
|
#include "Tools/ksp_solver.hpp" |
21 |
|
|
#include "Tools/simple_cmd.hpp" |
22 |
|
|
|
23 |
|
✗ |
int main(int argc, const char* argv[]) |
24 |
|
|
{ |
25 |
|
|
struct Options |
26 |
|
|
{ |
27 |
|
|
std::string InputFileMatrix{""}; |
28 |
|
|
std::string InputFileVector{""}; |
29 |
|
|
std::string SolverType{"MUMPS"}; |
30 |
|
|
std::string PreconditionerType{""}; |
31 |
|
|
}; |
32 |
|
|
|
33 |
|
✗ |
auto parser = CmdOptions<Options>::Create({ |
34 |
|
|
{"--file_matrix", &Options::InputFileMatrix }, |
35 |
|
|
{"--file_vector", &Options::InputFileVector }, |
36 |
|
|
{"--solver_type", &Options::SolverType }, |
37 |
|
|
{"--preconditioner_type", &Options::PreconditionerType } |
38 |
|
✗ |
}); |
39 |
|
|
|
40 |
|
✗ |
auto options = parser->parse(argc, argv); |
41 |
|
|
|
42 |
|
✗ |
if (options.InputFileMatrix == "") { |
43 |
|
✗ |
std::cout << "The following input values must be set: " << std::endl; |
44 |
|
✗ |
std::cout << "\tInput file matrix:\t--file_matrix"<< std::endl; |
45 |
|
✗ |
return 1; |
46 |
|
|
} |
47 |
|
✗ |
if (options.InputFileVector == "") { |
48 |
|
✗ |
options.InputFileVector = options.InputFileMatrix; |
49 |
|
✗ |
std::cout << "\tAssuming same file for matrix and vector"<< std::endl; |
50 |
|
|
} |
51 |
|
|
|
52 |
|
✗ |
std::cout << "The following input values has been considered" << std::endl; |
53 |
|
✗ |
std::cout << "\tInput file matrix =\t" << options.InputFileMatrix << std::endl; |
54 |
|
✗ |
std::cout << "\tInput file vector =\t" << options.InputFileVector << std::endl; |
55 |
|
✗ |
std::cout << "\tSolver type =\t" << options.SolverType << std::endl; |
56 |
|
✗ |
std::cout << "\tPreconditioner type =\t" << options.PreconditionerType << std::endl; |
57 |
|
|
|
58 |
|
✗ |
std::string current_path = std::filesystem::current_path(); |
59 |
|
✗ |
current_path += "/"; |
60 |
|
✗ |
const int check = SolveMatrix(current_path + options.InputFileMatrix, current_path + options.InputFileVector, options.SolverType, options.PreconditionerType); |
61 |
|
✗ |
return check; |
62 |
|
|
} |
63 |
|
|
|