22 #include "libmesh/string_to_enum.h" 32 params.
addClassDescription(
"Single purpose problem object that does not run the given input but " 33 "allows deconstructing actions into their series of underlying Moose " 34 "objects and variables.");
36 "dump_path",
"all",
"Syntax path of the action of which to dump the generated syntax");
38 "include_all_user_specified_params",
40 "Whether to include all parameters that have been specified by a user in the dump, even if " 41 "they match the default value of the parameter in the Factory");
48 "Whether to attempt to solve the Problem. This will only cause additional outputs of the " 49 "objects and their parameters. This is unlikely to succeed with more complex executioners.");
55 _include_all_user_specified_params(getParam<bool>(
"include_all_user_specified_params"))
62 const auto & new_sys = std::make_shared<DumpObjectsNonlinearSystem>(*
this, sys_name);
69 const auto & new_sys = std::make_shared<DumpObjectsLinearSystem>(*
this, sys_name);
73 _aux = std::make_shared<AuxiliarySystem>(*
this,
"aux0");
89 auto dump_objects_action =
101 std::string param_text;
102 for (
auto & value_pair : specified_params)
105 const auto & param_name = value_pair.first;
106 const auto & param_value = value_pair.second;
109 auto factory_it = factory_params.find(param_name);
110 bool include_param = (factory_it->second != param_value);
113 if (factory_it == factory_params.end() || include_param)
114 param_text +=
" " + param_name +
" = " + param_value +
'\n';
122 const std::string & type,
123 const std::string & name,
132 +
" type = " +
type +
'\n' 140 const std::string & var_name,
144 const std::set<SubdomainID> *
const active_subdomains)
147 std::string param_text;
149 if (active_subdomains)
152 for (
auto & subdomain_id : *active_subdomains)
155 if (subdomain_name ==
"")
156 subdomain_name = std::to_string(subdomain_id);
164 if (active_subdomains->size() > 1)
167 param_text +=
" blocks = " +
blocks +
'\n';
171 param_text +=
" family = " + libMesh::Utility::enum_to_string<FEFamily>(family) +
'\n';
173 param_text +=
" order = " + libMesh::Utility::enum_to_string<Order>(order) +
'\n';
174 if (scale_factor != 1.0)
175 param_text +=
" scale = " + std::to_string(scale_factor);
179 " [" + var_name +
"]\n" 188 const auto path = getParam<std::string>(
"dump_path");
202 Moose::out <<
"**START DUMP DATA**\n";
203 for (
const auto & system_pair : pathit->second)
204 Moose::out <<
'[' << system_pair.first <<
"]\n" << system_pair.second <<
"[]\n\n";
205 Moose::out <<
"**END DUMP DATA**\n";
206 Moose::out << std::flush;
212 Moose::out <<
"**START DUMP DATA**\n";
214 for (
const auto & system_pair : path.second)
215 Moose::out <<
'[' << system_pair.first <<
"]\n" << system_pair.second <<
"[]\n\n";
216 Moose::out <<
"**END DUMP DATA**\n";
217 Moose::out << std::flush;
220 std::map<std::string, std::string>
223 std::map<std::string, std::string> parameter_map;
232 const auto & param_name = value_pair.first;
236 if (param_name ==
"control_tags")
246 std::string param_value;
250 param_value = b ?
"true" :
"false";
254 std::stringstream ss;
255 value_pair.second->print(ss);
256 param_value = ss.str();
260 if (!param_value.empty() && param_value.back() ==
' ')
261 param_value.pop_back();
264 if (param_value.find_first_of(
" ") != std::string::npos || param_value.length() == 0)
265 param_value =
"'" + param_value +
"'";
267 parameter_map[param_name] = param_value;
272 return parameter_map;
278 TIME_SECTION(
"initializingFunctions", 5,
"Initializing Functions");
279 mooseAssert(
libMesh::n_threads() == 1,
"We should only use one thread for dumping objects");
Factory & _factory
The Factory for building objects.
static InputParameters validParams()
InputParameters getValidParams(const std::string &name)
const bool _include_all_user_specified_params
Whether to include all user-specified parameters in the dump or only parameters that differ from the ...
Specialization of SubProblem for dumping generated objects as input file syntax.
virtual void newAssemblyArray(std::vector< std::shared_ptr< SolverSystem >> &solver_systems)
std::string getCurrentActionName() const
void addActionBlock(std::shared_ptr< Action > blk)
This method add an Action instance to the warehouse.
std::vector< std::shared_ptr< SolverSystem > > _solver_systems
Combined container to base pointer of every solver system.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
ActionFactory & getActionFactory()
Retrieve a writable reference to the ActionFactory associated with this App.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual const std::string & name() const
Get the name of the class.
std::shared_ptr< Action > create(const std::string &action, const std::string &action_name, InputParameters ¶meters)
void dumpObjectHelper(const std::string &system, const std::string &type, const std::string &name, const InputParameters ¶meters)
std::vector< std::shared_ptr< NonlinearSystemBase > > _nl
The nonlinear systems.
void createTagSolutions()
Create extra tagged solution vectors.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
void createTagVectors()
Create extra tagged vectors and matrices.
std::shared_ptr< AuxiliarySystem > _aux
The auxiliary system.
virtual void initialSetup() override
const std::string & type() const
Get the type of this class.
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
std::string & subdomain_name(subdomain_id_type id)
MooseApp & _app
The MOOSE application this is associated with.
std::map< std::string, std::string > stringifyParameters(const InputParameters ¶meters)
create a string map form parameter names to stringified parameter values
virtual void initialSetup(THREAD_ID tid=0) const
Convenience methods for calling object setup methods.
std::map< std::string, std::map< std::string, std::string > > _generated_syntax
store input syntax to build objects generated by a specific action
const std::vector< NonlinearSystemName > _nl_sys_names
The nonlinear system names.
void dumpVariableHelper(const std::string &system, const std::string &var_name, libMesh::FEFamily family, Order order, Real scale_factor, const std::set< SubdomainID > *const active_subdomains)
registerMooseObject("MooseApp", DumpObjectsProblem)
void dumpAllGeneratedSyntax() const
output input blocks for all paths
const std::vector< LinearSystemName > _linear_sys_names
The linear system names.
const InputParameters & parameters() const
Get the parameters of the object.
MooseObjectWarehouse< Function > _functions
functions
static InputParameters validParams()
void dumpGeneratedSyntax(const std::string path)
output input blocks for a given action path
std::vector< std::shared_ptr< LinearSystem > > _linear_systems
The vector of linear systems.
std::string deduceNecessaryParameters(const std::string &type, const InputParameters ¶meters)
build a text snippet of the minimal set of parameters that need to be specified
auto index_range(const T &sizable)
DumpObjectsProblem(const InputParameters ¶meters)