14 #include "libmesh/mesh_modification.h" 15 #include "libmesh/serial_mesh.h" 16 #include "libmesh/exodusII_io.h" 24 params.
addRequiredParam<MeshFileName>(
"file",
"The name of the mesh file to read");
26 params.
addParam<
Real>(
"x_width", 0,
"The tile width in the x direction");
27 params.
addParam<
Real>(
"y_width", 0,
"The tile width in the y direction");
28 params.
addParam<
Real>(
"z_width", 0,
"The tile width in the z direction");
31 params.
addParam<BoundaryName>(
"left_boundary",
"left_boundary",
"name of the left (x) boundary");
33 "right_boundary",
"right_boundary",
"name of the right (x) boundary");
36 params.
addParam<BoundaryName>(
"top_boundary",
"top_boundary",
"name of the top (y) boundary");
38 "bottom_boundary",
"bottom_boundary",
"name of the bottom (y) boundary");
42 "front_boundary",
"front_boundary",
"name of the front (z) boundary");
43 params.
addParam<BoundaryName>(
"back_boundary",
"back_boundary",
"name of the back (z) boundary");
49 "x_tiles", 1,
"Number of tiles to stitch together (left to right) in the x-direction");
51 "y_tiles", 1,
"Number of tiles to stitch together (top to bottom) in the y-direction");
53 "z_tiles", 1,
"Number of tiles to stitch together (front to back) in the z-direction");
55 params.
addClassDescription(
"Use the supplied mesh and create a tiled grid by repeating this mesh " 56 "in the x,y, and z directions.");
63 _x_width(getParam<
Real>(
"x_width")),
64 _y_width(getParam<
Real>(
"y_width")),
65 _z_width(getParam<
Real>(
"z_width"))
73 _x_width(other_mesh._x_width),
74 _y_width(other_mesh._y_width),
75 _z_width(other_mesh._z_width)
79 std::unique_ptr<MooseMesh>
82 return std::make_unique<TiledMesh>(*this);
88 return getParam<MeshFileName>(
"file");
96 ReplicatedMesh * serial_mesh =
dynamic_cast<ReplicatedMesh *
>(&
getMesh());
99 mooseError(
"Error, TiledMesh calls stitch_meshes() which only works on ReplicatedMesh.");
102 std::string mesh_file(getParam<MeshFileName>(
"file"));
104 if (mesh_file.rfind(
".exd") < mesh_file.size() || mesh_file.rfind(
".e") < mesh_file.size())
106 ExodusII_IO ex(*
this);
108 serial_mesh->prepare_for_use();
111 serial_mesh->read(mesh_file);
121 std::unique_ptr<MeshBase>
clone = serial_mesh->
clone();
124 for (
unsigned int i = 1; i < getParam<unsigned int>(
"x_tiles"); ++i)
127 serial_mesh->stitch_meshes(dynamic_cast<ReplicatedMesh &>(*
clone),
135 std::unique_ptr<MeshBase>
clone = serial_mesh->
clone();
138 for (
unsigned int i = 1; i < getParam<unsigned int>(
"y_tiles"); ++i)
141 serial_mesh->stitch_meshes(dynamic_cast<ReplicatedMesh &>(*
clone),
149 std::unique_ptr<MeshBase>
clone = serial_mesh->
clone();
152 for (
unsigned int i = 1; i < getParam<unsigned int>(
"z_tiles"); ++i)
155 serial_mesh->stitch_meshes(dynamic_cast<ReplicatedMesh &>(*
clone),
static InputParameters validParams()
Typical "Moose-style" constructor and copy constructor.
virtual MooseMesh & clone() const
Clone method.
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()
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
boundary_id_type BoundaryID
TiledMesh(const InputParameters ¶meters)
virtual void buildMesh() override
Must be overridden by child classes.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
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...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
registerMooseObject("MooseApp", TiledMesh)
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.