16 #include "libmesh/mesh_modification.h" 17 #include "libmesh/mesh_tools.h" 27 params.
addRequiredParam<MeshGeneratorName>(
"input",
"The base mesh we want to overlay");
30 "the input mesh region.");
38 _mesh_name(getParam<MeshGeneratorName>(
"input"))
63 "num_cores_for_partition",
68 _mesh_name +
"_distributedrectilinearmeshgenerator",
72 std::unique_ptr<MeshBase>
75 std::unique_ptr<MeshBase> input_mesh = std::move(*
_input_mesh);
76 std::unique_ptr<MeshBase> build_mesh = std::move(*
_build_mesh);
79 auto bbox_input = MeshTools::create_bounding_box(*input_mesh);
83 scale_factor = bbox_input.max() - bbox_input.min();
86 if (scale_factor(0) != 1 || scale_factor(1) != 1 || scale_factor(2) != 1)
87 MeshTools::Modification::scale(*build_mesh, scale_factor(0), scale_factor(1), scale_factor(2));
90 translation_vector = bbox_input.min();
93 if (translation_vector(0) != 0 || translation_vector(1) != 0 || translation_vector(2) != 0)
94 MeshTools::Modification::translate(
95 *build_mesh, translation_vector(0), translation_vector(1), translation_vector(2));
std::unique_ptr< MeshBase > & getMeshByName(const MeshGeneratorName &mesh_generator_name)
Like getMesh(), but takes the name of another MeshGenerator directly.
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
void declareMeshForSub(const std::string ¶m_name)
Declares that a MeshGenerator referenced in the InputParameters is to be used as a dependency of a su...
std::unique_ptr< MeshBase > * _input_mesh
Hold the input mesh.
const MeshGeneratorName _mesh_name
Name of the input mesh.
void addMeshSubgenerator(const std::string &type, const std::string &name, Ts... extra_input_parameters)
Construct a "subgenerator", a different MeshGenerator subclass that will be added to the same MooseAp...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
MooseApp & _app
The MOOSE application this is associated with.
static InputParameters validParams()
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
const InputParameters & parameters() const
Get the parameters of the object.
registerMooseObject("MooseApp", OverlayMeshGenerator)
std::unique_ptr< MeshBase > * _build_mesh
Hold the generated mesh.
static InputParameters validParams()
OverlayMeshGenerator(const InputParameters ¶meters)
MeshGenerators are objects that can modify or add to an existing mesh.
static InputParameters validParams()