36 std::vector<MeshGeneratorName> all_components_mgs;
37 std::vector<MeshGeneratorName> mgs_to_combine;
39 for (
const auto comp : components)
42 for (
const auto & mg_name : comp->meshGeneratorNames())
43 all_components_mgs.push_back(mg_name);
44 if (comp->meshGeneratorNames().size())
45 mgs_to_combine.push_back(comp->meshGeneratorNames().back());
55 bool all_mgs_from_components =
true;
61 if (std::find(all_components_mgs.begin(), all_components_mgs.end(), mg) ==
62 all_components_mgs.end())
63 all_mgs_from_components =
false;
67 std::find(all_components_mgs.begin(), all_components_mgs.end(), final_mg) ==
68 all_components_mgs.end())
69 mgs_to_combine.push_back(final_mg);
70 if (final_mg ==
"" && !all_mgs_from_components)
71 mooseError(
"Final mesh generator should be set for [Mesh] and [ActionComponents] to work " 77 params.
set<std::vector<MeshGeneratorName>>(
"inputs") = mgs_to_combine;
78 params.
set<
bool>(
"avoid_merging_subdomains") =
true;
79 params.
set<
bool>(
"avoid_merging_boundaries") =
true;
80 params.
set<
bool>(
"output") =
true;
83 if (mgs_to_combine.size() == 1)
84 params.
set<std::vector<Point>>(
"positions") = {Point(0, 0, 0)};
87 if (!all_mgs_from_components)
89 "CombinerGenerator",
"component_combiner", params);
94 "CombinerGenerator",
"component_combiner", params);
98 mooseAssert(
false,
"Registered to a task but not doing anything on that task");
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
MeshGeneratorName getFinalMeshGeneratorName() const
Get the name of the final mesh generator.
std::vector< std::string > getMeshGeneratorNames() const
Get names of all mesh generators Note: This function should be called after all mesh generators are a...
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
Base class for components that are defined using an action.
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
void addMeshGenerator(const std::string &type, const std::string &name, const InputParameters ¶ms)
Add a mesh generator that will act on the meshes in the system.
Factory & _factory
The Factory associated with the MooseApp.
const MeshGenerator & appendMeshGenerator(const std::string &type, const std::string &name, InputParameters params)
Append a mesh generator that will act on the current final mesh generator in the system.
static InputParameters validParams()
registerMooseAction("MooseApp", CombineComponentsMeshes, "append_mesh_generator")
const std::string & _current_task
The current action (even though we have separate instances for each action)
MooseApp & _app
The MOOSE application this is associated with.
static InputParameters validParams()
CombineComponentsMeshes(const InputParameters ¶ms)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
MeshGeneratorSystem & getMeshGeneratorSystem()
Gets the system that manages the MeshGenerators.
std::vector< const T * > getActions()
Retrieve all actions in a specific type ordered by their names.
Action to combine the meshes of disjoined components.