CArl
Code Arlequin / C++ implementation
libmesh_assemble_system_input_parser.cpp
Go to the documentation of this file.
1 /*
2  * libmesh_assemble_system_input_parser.h
3  *
4  * Created on: Apr 16, 2017
5  * Author: Thiago Milanetto Schlittler
6  */
7 
9 void get_input_params(GetPot& field_parser,
10  libmesh_assemble_input_params& input_params) {
11 
12  // Set mesh files
13  if (field_parser.search(1, "Mesh")) {
14  input_params.mesh_file = field_parser.next(
15  input_params.mesh_file);
16  } else {
17  homemade_error_msg("Missing the system mesh file!");
18  }
19 
20  // Set constant parameters
21  if ( field_parser.search(1, "PhysicalParameters") )
22  {
23  input_params.physical_params_file = field_parser.next(input_params.physical_params_file);
24  }
25  else
26  {
27  homemade_error_msg("Missing the physical parameters file!");
28  }
29 
30  // Set weight function
31  std::string sys_type;
32  if ( field_parser.search(1, "SystemType") )
33  {
34  sys_type = field_parser.next(sys_type);
35  if(sys_type == "Macro" || sys_type == "MACRO" || sys_type == "macro")
37  else if(sys_type == "Micro" || sys_type == "MICRO" || sys_type == "micro")
39  else if(sys_type == "NoWeight" || sys_type == "NOWEIGHT" || sys_type == "noweight")
40  {
42  std::cout << " >> Warning: Will not use the weight parameters!" << std::endl;
43  }
44  else
45  homemade_error_msg("Invalid system type (must be either Macro, Micro or NoWeight)!");
46  }
47  else
48  {
49  homemade_error_msg("Missing the system type (must be either Macro, Micro or NoWeight)!");
50  }
51 
52  if ( field_parser.search(1, "MeshWeight") )
53  {
54  input_params.mesh_weight_file = field_parser.next(input_params.mesh_weight_file);
55  }
56  else
57  {
58  homemade_error_msg("Missing the weight mesh file!");
59  }
60 
61  if( field_parser.search(1, "WeightIndexes") )
62  {
63  input_params.weight_domain_idx_file = field_parser.next(input_params.weight_domain_idx_file);
64  }
65  else
66  {
67  homemade_error_msg("Missing the weight value file!");
68  }
69 
70  // Output
71  if (field_parser.search(2, "--output", "OutputBase"))
72  {
73  input_params.output_base = field_parser.next(
74  input_params.output_base);
75  } else {
76  input_params.output_base = "test_system";
77  }
78 
79  if (field_parser.search(1, "ExportRBVectors")) {
80  input_params.bCalculateRBVectors = true;
81  } else {
82  input_params.bCalculateRBVectors = false;
83  }
84 };
#define homemade_error_msg(msg)
Definition: common_header.h:73
std::string mesh_weight_file
Path to the mesh containing the weight region indices.
bool bCalculateRBVectors
Build and export the rigid body modes vectors?
std::string physical_params_file
Physical parameters.
void get_input_params(GetPot &field_parser, libmesh_assemble_input_params &input_params)
Parser function for the coupled solver test programs.
std::string weight_domain_idx_file
Path to the file identifying the weight function regions.
WeightFunctionSystemType system_type
Indicates if the system to be assembled is a micro or a macro system (used to choose the proper weigh...
std::string mesh_file
Path to the system mesh.
std::string output_base
Output filename base.