CArl
Code Arlequin / C++ implementation
libmesh_solve_linear_system_input_parser.cpp
Go to the documentation of this file.
1 /*
2  * libmesh_solve_linear_system_input_parser.h
3  *
4  * Created on: Apr 16, 2017
5  * Author: Thiago Milanetto Schlittler
6  */
7 
9 
10 namespace carl
11 {
12 void get_input_params(GetPot& field_parser,
14 
15  if (field_parser.search(1, "SysMatrix")) {
16  input_params.sys_matrix_file = field_parser.next(
17  input_params.sys_matrix_file);
18  } else {
19  homemade_error_msg("Missing the system matrix file!");
20  }
21 
22  if (field_parser.search(1, "SysRHSVector")) {
23  input_params.sys_rhs_vec_file = field_parser.next(
24  input_params.sys_rhs_vec_file);
25  } else {
26  homemade_error_msg("Missing the system RHS vector file!");
27  }
28 
29  if (field_parser.search(1, "OutputBase")) {
30  input_params.output_base = field_parser.next(
31  input_params.output_base);
32  } else {
33  homemade_error_msg("Missing the output filename base!");
34  }
35 
36  if (field_parser.search(1, "SysEps")) {
37  input_params.sys_eps = field_parser.next(
38  input_params.sys_eps);
39  } else {
40  input_params.sys_eps = 1e-5;
41  }
42 
43  if (field_parser.search(1, "SysIterDiv")) {
44  input_params.sys_iter_div = field_parser.next(
45  input_params.sys_iter_div);
46  } else {
47  input_params.sys_iter_div = 1000;
48  }
49 
50  if (field_parser.search(1, "RBVectorBase")) {
51  input_params.path_to_rb_vectors = field_parser.next(
52  input_params.path_to_rb_vectors);
53  input_params.bUseRBVectors = true;
54 
55  if (field_parser.search(1, "NbOfRBVectors")) {
56  input_params.nb_of_rb_vectors = field_parser.next(
57  input_params.nb_of_rb_vectors);
58  } else {
59  input_params.nb_of_rb_vectors = 6;
60  }
61 
62  } else {
63  input_params.bUseRBVectors = false;
64  }
65 };
66 
67 void print_input_params(const std::string& output_filename,
69 
70  std::ofstream output_file(output_filename);
71 
72  output_file << "SysMatrix " << input_params.sys_matrix_file << std::endl;
73  output_file << "SysRHSVector " << input_params.sys_rhs_vec_file << std::endl;
74  output_file << "OutputBase " << input_params.output_base << std::endl;
75 
76  output_file << "SysEps " << input_params.sys_eps << std::endl;
77  output_file << "SysIterDiv " << input_params.sys_iter_div << std::endl;
78 
79  if(input_params.bUseRBVectors)
80  {
81  output_file << "RBVectorBase " << input_params.path_to_rb_vectors << std::endl;
82  output_file << "NbOfRBVectors " << input_params.nb_of_rb_vectors << std::endl;
83  }
84 
85  output_file.close();
86 };
87 
88 };
#define homemade_error_msg(msg)
Definition: common_header.h:73
void get_input_params(GetPot &field_parser, feti_iterate_params &input_params)
Parser function for the coupled solver test programs.
bool bUseRBVectors
Use rigid body mode vectors? Default: false.
std::string sys_rhs_vec_file
Path to the system RHS vector file.
void print_input_params(const std::string &output_filename, libmesh_solve_linear_system_input_params &input_params)
Function used to generate a solver input file from "input_params".
std::string path_to_rb_vectors
Path to a folder containing the rigid body mode vectors.