29 #include "libmesh/parallel.h"
40 _command_line(argc,argv),
41 _libmesh_init( new
libMesh::LibMeshInit(argc,argv) )
47 _inputfile.reset(
new GetPot(inputfile_name) );
64 out <<
"==========================================================" << std::endl;
65 out <<
"GRINS Version: " << GRINS_BUILD_VERSION << std::endl
66 <<
"libMesh Version: " << LIBMESH_BUILD_VERSION << std::endl
67 <<
"Running with command:\n";
69 for (
int i=0; i != argc; ++i)
70 out << argv[i] <<
' ';
73 <<
"==========================================================" << std::endl;
80 std::stringstream error_msg;
81 error_msg <<
"ERROR: Found only 1 command line argument, but was expecting an inputfile name!"
83 <<
" Please specify the name of the input file on the command line as the first" << std::endl
84 <<
" command line argument or using the '--input <filename>' option." << std::endl;
85 libmesh_error_msg(error_msg.str());
88 std::string inputfile_name;
89 if( command_line.search(
"--input") )
90 inputfile_name = command_line.next(std::string(
"DIE!"));
92 inputfile_name = argv[1];
94 std::ifstream i(inputfile_name.c_str());
97 std::string error_msg =
"Error: Could not read from input file "+inputfile_name+
"!\n";
98 libmesh_error_msg(error_msg);
101 return inputfile_name;
107 bool warning_only =
_command_line.search(
"--warn-only-unused-var");
118 std::vector<std::string> unused_vars = input.unidentified_variables();
120 bool unused_vars_detected =
false;
123 std::string mat_string =
"Materials/";
127 if( !unused_vars.empty() )
129 int n_total = unused_vars.size();
133 for(
int v = 0; v < n_total; v++ )
134 if( (unused_vars[v]).find(mat_string) != std::string::npos )
137 libmesh_assert_greater_equal( n_total, n_mats );
139 if( n_mats < n_total )
140 unused_vars_detected =
true;
143 if( unused_vars_detected )
145 libMesh::err <<
"==========================================================" << std::endl;
147 libMesh::err <<
"Warning: ";
149 libMesh::err <<
"Error: ";
151 libMesh::err <<
"Found unused variables!" << std::endl;
153 for( std::vector<std::string>::const_iterator it = unused_vars.begin();
154 it != unused_vars.end(); ++it )
157 if( (*it).find(mat_string) != std::string::npos )
160 libMesh::err << *it << std::endl;
162 libMesh::err <<
"==========================================================" << std::endl;
void echo_version_info(std::ostream &out, int argc, char *argv[])
Echo GRINS, libMesh version info as well as command line.
libMesh::UniquePtr< Simulation > _simulation
void init()
Initialize the Simulation objects.
void check_for_unused_vars(const GetPot &input, bool warning_only)
Check for any unused variables in GetPot input file.
SimulationBuilder _sim_builder
std::string check_and_get_inputfile(int argc, char *argv[], GetPot &command_line)
Check (and error if not found) and then return GetPot input file name.
libMesh::UniquePtr< GetPot > _inputfile
libMesh::UniquePtr< libMesh::LibMeshInit > _libmesh_init
void run()
Runs the simulation that was setup at construction time.