本文整理汇总了C++中GetPot::unidentified_arguments方法的典型用法代码示例。如果您正苦于以下问题:C++ GetPot::unidentified_arguments方法的具体用法?C++ GetPot::unidentified_arguments怎么用?C++ GetPot::unidentified_arguments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GetPot
的用法示例。
在下文中一共展示了GetPot::unidentified_arguments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
//.........这里部分代码省略.........
libmesh_error();
}
if (n_other_boundary_functions !=
input.vector_variable_size("other_boundary_function_ids"))
{
libMesh::out << "Error: " << n_other_boundary_functions
<< " other boundary function types does not match "
<< input.vector_variable_size("other_boundary_function_ids")
<< " other boundary function ids." << std::endl;
libmesh_error();
}
for (unsigned int i=0; i != n_other_boundary_functions; ++i)
{
const std::string func_type =
input("other_boundary_function_types", zero_string, i);
const std::string func_value =
input("other_boundary_function_values", empty_string, i);
const boundary_id_type func_boundary =
input("other_boundary_function_boundaries", boundary_id_type(0), i);
const int func_id =
input("other_boundary_function_ids", int(0), i);
other_boundary_functions[func_id][func_boundary] =
(new_function_base(func_type, func_value).release());
}
GETPOT_INPUT(run_simulation);
GETPOT_INPUT(run_postprocess);
GETPOT_REGISTER(fe_family);
const unsigned int n_fe_family =
std::max(1u, input.vector_variable_size("fe_family"));
fe_family.resize(n_fe_family, "LAGRANGE");
for (unsigned int i=0; i != n_fe_family; ++i)
fe_family[i] = input("fe_family", fe_family[i].c_str(), i);
GETPOT_REGISTER(fe_order);
const unsigned int n_fe_order =
input.vector_variable_size("fe_order");
fe_order.resize(n_fe_order, 1);
for (unsigned int i=0; i != n_fe_order; ++i)
fe_order[i] = input("fe_order", (int)fe_order[i], i);
GETPOT_INPUT(extra_quadrature_order);
GETPOT_INPUT(analytic_jacobians);
GETPOT_INPUT(verify_analytic_jacobians);
GETPOT_INPUT(numerical_jacobian_h);
GETPOT_INPUT(print_solution_norms);
GETPOT_INPUT(print_solutions);
GETPOT_INPUT(print_residual_norms);
GETPOT_INPUT(print_residuals);
GETPOT_INPUT(print_jacobian_norms);
GETPOT_INPUT(print_jacobians);
GETPOT_INPUT(print_element_jacobians);
GETPOT_INPUT(use_petsc_snes);
GETPOT_INPUT(time_solver_quiet);
GETPOT_INPUT(solver_quiet);
GETPOT_INPUT(solver_verbose);
GETPOT_INPUT(require_residual_reduction);
GETPOT_INPUT(min_step_length);
GETPOT_INT_INPUT(max_linear_iterations);
GETPOT_INT_INPUT(max_nonlinear_iterations);
GETPOT_INPUT(relative_step_tolerance);
GETPOT_INPUT(relative_residual_tolerance);
GETPOT_INPUT(initial_linear_tolerance);
GETPOT_INPUT(minimum_linear_tolerance);
GETPOT_INPUT(linear_tolerance_multiplier);
GETPOT_INT_INPUT(initial_sobolev_order);
GETPOT_INT_INPUT(initial_extra_quadrature);
GETPOT_INPUT(indicator_type);
GETPOT_INT_INPUT(sobolev_order);
GETPOT_INPUT(system_config_file);
std::vector<std::string> bad_variables =
input.unidentified_arguments(variable_names);
if (libMesh::processor_id() == 0 && !bad_variables.empty())
{
std::cerr << "ERROR: Unrecognized variables:" << std::endl;
for (unsigned int i = 0; i != bad_variables.size(); ++i)
std::cerr << bad_variables[i] << std::endl;
std::cerr << "Not found among recognized variables:" << std::endl;
for (unsigned int i = 0; i != variable_names.size(); ++i)
std::cerr << variable_names[i] << std::endl;
libmesh_error();
}
}
示例2: read
void FEMParameters::read(GetPot &input)
{
std::vector<std::string> variable_names;
GETPOT_INT_INPUT(coarserefinements);
GETPOT_INPUT(domainfile);
GETPOT_INPUT(solver_quiet);
GETPOT_INPUT(reuse_preconditioner);
GETPOT_INPUT(require_residual_reduction);
GETPOT_INPUT(min_step_length);
GETPOT_INT_INPUT(max_linear_iterations);
GETPOT_INT_INPUT(max_nonlinear_iterations);
GETPOT_INPUT(relative_step_tolerance);
GETPOT_INPUT(relative_residual_tolerance);
GETPOT_INPUT(initial_linear_tolerance);
GETPOT_INPUT(minimum_linear_tolerance);
GETPOT_INPUT(linear_tolerance_multiplier);
GETPOT_INT_INPUT(nelem_target);
GETPOT_INPUT(global_tolerance);
GETPOT_INPUT(refine_fraction);
GETPOT_INPUT(coarsen_fraction);
GETPOT_INPUT(coarsen_threshold);
GETPOT_INT_INPUT(max_adaptivesteps);
GETPOT_INPUT(refine_uniformly);
GETPOT_INPUT(indicator_type);
GETPOT_INPUT(patch_reuse);
GETPOT_REGISTER(fe_family);
const unsigned int n_fe_family =
std::max(1u, input.vector_variable_size("fe_family"));
fe_family.resize(n_fe_family, "LAGRANGE");
for (unsigned int i=0; i != n_fe_family; ++i)
fe_family[i] = input("fe_family", fe_family[i].c_str(), i);
GETPOT_REGISTER(fe_order);
const unsigned int n_fe_order =
input.vector_variable_size("fe_order");
fe_order.resize(n_fe_order, 1);
for (unsigned int i=0; i != n_fe_order; ++i)
fe_order[i] = input("fe_order", (int)fe_order[i], i);
GETPOT_INPUT(analytic_jacobians);
GETPOT_INPUT(verify_analytic_jacobians);
GETPOT_INPUT(print_solution_norms);
GETPOT_INPUT(print_solutions);
GETPOT_INPUT(print_residual_norms);
GETPOT_INPUT(print_residuals);
GETPOT_INPUT(print_jacobian_norms);
GETPOT_INPUT(print_jacobians);
std::vector<std::string> bad_variables =
input.unidentified_arguments(variable_names);
if (libMesh::global_processor_id() == 0 && !bad_variables.empty())
{
std::cerr << "ERROR: Unrecognized variables:" << std::endl;
for (unsigned int i = 0; i != bad_variables.size(); ++i)
std::cerr << bad_variables[i] << std::endl;
std::cerr << "not found among recognized variables." << std::endl;
for (unsigned int i = 0; i != variable_names.size(); ++i)
std::cerr << variable_names[i] << std::endl;
libmesh_error();
}
}
示例3: read
//.........这里部分代码省略.........
}
GETPOT_INPUT(run_simulation);
GETPOT_INPUT(run_postprocess);
GETPOT_REGISTER(fe_family);
const unsigned int n_fe_family =
std::max(1u, input.vector_variable_size("fe_family"));
fe_family.resize(n_fe_family, "LAGRANGE");
for (unsigned int i=0; i != n_fe_family; ++i)
fe_family[i] = input("fe_family", fe_family[i].c_str(), i);
GETPOT_REGISTER(fe_order);
const unsigned int n_fe_order =
input.vector_variable_size("fe_order");
fe_order.resize(n_fe_order, 1);
for (unsigned int i=0; i != n_fe_order; ++i)
fe_order[i] = input("fe_order", (int)fe_order[i], i);
GETPOT_INPUT(extra_quadrature_order);
GETPOT_INPUT(analytic_jacobians);
GETPOT_INPUT(verify_analytic_jacobians);
GETPOT_INPUT(numerical_jacobian_h);
GETPOT_INPUT(print_solution_norms);
GETPOT_INPUT(print_solutions);
GETPOT_INPUT(print_residual_norms);
GETPOT_INPUT(print_residuals);
GETPOT_INPUT(print_jacobian_norms);
GETPOT_INPUT(print_jacobians);
GETPOT_INPUT(print_element_solutions);
GETPOT_INPUT(print_element_residuals);
GETPOT_INPUT(print_element_jacobians);
GETPOT_INPUT(use_petsc_snes);
GETPOT_INPUT(time_solver_quiet);
GETPOT_INPUT(solver_quiet);
GETPOT_INPUT(solver_verbose);
GETPOT_INPUT(reuse_preconditioner);
GETPOT_INPUT(require_residual_reduction);
GETPOT_INPUT(min_step_length);
GETPOT_INT_INPUT(max_linear_iterations);
GETPOT_INT_INPUT(max_nonlinear_iterations);
GETPOT_INPUT(relative_step_tolerance);
GETPOT_INPUT(relative_residual_tolerance);
GETPOT_INPUT(absolute_residual_tolerance);
GETPOT_INPUT(initial_linear_tolerance);
GETPOT_INPUT(minimum_linear_tolerance);
GETPOT_INPUT(linear_tolerance_multiplier);
GETPOT_INT_INPUT(initial_sobolev_order);
GETPOT_INT_INPUT(initial_extra_quadrature);
GETPOT_INPUT(refine_uniformly);
GETPOT_INPUT(indicator_type);
GETPOT_INPUT(patch_reuse);
GETPOT_INT_INPUT(sobolev_order);
GETPOT_INPUT(system_config_file);
std::vector<std::string> bad_variables =
input.unidentified_arguments(variable_assignments);
// The way unidentified_arguments() works can give us false
// positives from repeated (overridden) variable assignments or from
// other (e.g. PETSc) command line arguments.
std::vector<std::string> actually_bad_variables;
for (std::size_t i = 0; i < bad_variables.size(); ++i)
{
// If any of our ufo arguments start with a -, that's a false
// positive from an unrelated command line argument.
if (bad_variables[i].empty() || bad_variables[i][0] != '-')
{
std::string bad_variable_name =
bad_variables[i].substr(0, bad_variables[i].find('='));
if (!variable_names.count(bad_variable_name))
actually_bad_variables.push_back(bad_variables[i]);
}
// Skip any option variable and (to be safe from false
// positives, though it can create false negatives) any
// subsequent potential argument
else
if (bad_variables.size() > (i+1) &&
!bad_variables[i+1].empty() &&
bad_variables[i+1][0] != '-')
++i;
}
if (this->comm().rank() == 0 && !actually_bad_variables.empty())
{
libMesh::err << "ERROR: Unrecognized variables:" << std::endl;
for (auto var : actually_bad_variables)
libMesh::err << var << std::endl;
libMesh::err << "Not found among recognized variables:" << std::endl;
for (std::size_t i = 0; i != variable_names.size(); ++i)
libMesh::err << variable_assignments[i] << std::endl;
libmesh_error();
}
}