15#include "libmesh/mesh_modification.h"
16#include "libmesh/serial_mesh.h"
17#include "libmesh/exodusII_io.h"
25 params.
addRequiredParam<MeshFileName>(
"file",
"The name of the mesh file to read");
27 params.
addParam<Real>(
"x_width", 0,
"The tile width in the x direction");
28 params.
addParam<Real>(
"y_width", 0,
"The tile width in the y direction");
29 params.
addParam<Real>(
"z_width", 0,
"The tile width in the z direction");
32 params.
addParam<BoundaryName>(
"left_boundary",
"left_boundary",
"name of the left (x) boundary");
34 "right_boundary",
"right_boundary",
"name of the right (x) boundary");
37 params.
addParam<BoundaryName>(
"top_boundary",
"top_boundary",
"name of the top (y) boundary");
39 "bottom_boundary",
"bottom_boundary",
"name of the bottom (y) boundary");
43 "front_boundary",
"front_boundary",
"name of the front (z) boundary");
44 params.
addParam<BoundaryName>(
"back_boundary",
"back_boundary",
"name of the back (z) boundary");
50 "x_tiles", 1,
"Number of tiles to stitch together (left to right) in the x-direction");
52 "y_tiles", 1,
"Number of tiles to stitch together (top to bottom) in the y-direction");
54 "z_tiles", 1,
"Number of tiles to stitch together (front to back) in the z-direction");
56 params.
addClassDescription(
"Use the supplied mesh and create a tiled grid by repeating this mesh "
57 "in the x,y, and z directions.");
64 _x_width(getParam<Real>(
"x_width")),
65 _y_width(getParam<Real>(
"y_width")),
66 _z_width(getParam<Real>(
"z_width"))
74 _x_width(other_mesh._x_width),
75 _y_width(other_mesh._y_width),
76 _z_width(other_mesh._z_width)
80std::unique_ptr<MooseMesh>
89 return getParam<MeshFileName>(
"file");
97 ReplicatedMesh * serial_mesh =
dynamic_cast<ReplicatedMesh *
>(&
getMesh());
100 mooseError(
"Error, TiledMesh calls stitch_meshes() which only works on ReplicatedMesh.");
103 std::string mesh_file(getParam<MeshFileName>(
"file"));
105 if (mesh_file.rfind(
".exo") < mesh_file.size() || mesh_file.rfind(
".e") < mesh_file.size())
109 serial_mesh->prepare_for_use();
112 serial_mesh->read(mesh_file);
122 std::unique_ptr<MeshBase>
clone = serial_mesh->
clone();
125 for (
unsigned int i = 1; i < getParam<unsigned int>(
"x_tiles"); ++i)
128 serial_mesh->stitch_meshes(
dynamic_cast<ReplicatedMesh &
>(*
clone),
136 std::unique_ptr<MeshBase>
clone = serial_mesh->
clone();
139 for (
unsigned int i = 1; i < getParam<unsigned int>(
"y_tiles"); ++i)
142 serial_mesh->stitch_meshes(
dynamic_cast<ReplicatedMesh &
>(*
clone),
150 std::unique_ptr<MeshBase>
clone = serial_mesh->
clone();
153 for (
unsigned int i = 1; i < getParam<unsigned int>(
"z_tiles"); ++i)
156 serial_mesh->stitch_meshes(
dynamic_cast<ReplicatedMesh &
>(*
clone),
boundary_id_type BoundaryID
registerMooseObject("MooseApp", TiledMesh)
std::unique_ptr< T > copyConstruct(const T &object)
Copy constructs the object object.
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
virtual MooseMesh & clone() const
Clone method.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
static InputParameters validParams()
Typical "Moose-style" constructor and copy constructor.
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
MooseApp & _app
The MOOSE application this is associated with.
TiledMesh(const InputParameters ¶meters)
virtual std::string getFileName() const override
Returns the name of the mesh file read to produce this mesh if any or an empty string otherwise.
static InputParameters validParams()
virtual void buildMesh() override
Must be overridden by child classes.
virtual std::unique_ptr< MooseMesh > safeClone() const override
A safer version of the clone() method that hands back an allocated object wrapped in a smart pointer.
virtual void read(const std::string &name) override