Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
mesh_utils_base.hpp
Go to the documentation of this file.
1 // Copyright (c) Lawrence Livermore National Security, LLC and
2 // other Smith Project Developers. See the top-level LICENSE file for
3 // details.
4 //
5 // SPDX-License-Identifier: (BSD-3-Clause)
6 
14 #pragma once
15 
16 #include <memory>
17 #include <variant>
18 
19 #include "mfem.hpp"
20 
22 
23 namespace smith {
24 
34 mfem::Mesh buildMeshFromFile(const std::string& mesh_file);
35 
45 mfem::Mesh buildDiskMesh(int approx_number_of_elements);
46 
56 mfem::Mesh buildBallMesh(int approx_number_of_elements);
57 
67 mfem::Mesh buildRectangleMesh(int elements_in_x, int elements_in_y, double size_x = 1., double size_y = 1.);
68 
80 mfem::Mesh buildCuboidMesh(int elements_in_x, int elements_in_y, int elements_in_z, double size_x = 1.,
81  double size_y = 1., double size_z = 1.);
82 
93 mfem::Mesh buildCylinderMesh(int radial_refinement, int elements_lengthwise, double radius, double height);
94 
108 mfem::Mesh buildHollowCylinderMesh(int radial_refinement, int elements_lengthwise, double inner_radius,
109  double outer_radius, double height, double total_angle = M_PI, int sectors = 8);
110 
123 mfem::Mesh build_hollow_quarter_cylinder(std::size_t radial_divisions, std::size_t angular_divisions,
124  std::size_t vertical_divisions, double inner_radius, double outer_radius,
125  double height);
126 
138 mfem::Mesh buildRingMesh(int radial_refinement, double inner_radius, double outer_radius, double total_angle = M_PI,
139  int sectors = 8);
140 
145 namespace mesh {
146 
157  static void defineInputFileSchema(axom::inlet::Container& container);
158 
163 
167  mutable std::string absolute_mesh_file_name{};
168 };
169 
180  static void defineInputFileSchema(axom::inlet::Container& container);
181 
186  std::vector<int> elements;
187 
192  std::vector<double> overall_size;
193 };
194 
204 
209 };
210 
224 std::unique_ptr<mfem::ParMesh> refineAndDistribute(mfem::Mesh&& serial_mesh, const int refine_serial = 0,
225  const int refine_parallel = 0, const MPI_Comm comm = MPI_COMM_WORLD);
226 
227 } // namespace mesh
228 
229 } // namespace smith
This file contains the all the necessary functions for reading input files.
std::unique_ptr< mfem::ParMesh > refineAndDistribute(mfem::Mesh &&serial_mesh, const int refine_serial, const int refine_parallel, const MPI_Comm comm)
Finalizes a serial mesh into a refined parallel mesh.
Definition: mesh_utils.cpp:458
Accelerator functionality.
Definition: smith.cpp:36
mfem::Mesh buildRingMesh(int radial_refinement, double inner_radius, double outer_radius, double total_angle, int sectors)
Constructs a 2D MFEM mesh of a ring.
Definition: mesh_utils.cpp:350
mfem::Mesh buildRectangleMesh(int elements_in_x, int elements_in_y, double size_x, double size_y)
Constructs a 2D MFEM mesh of a rectangle.
Definition: mesh_utils.cpp:150
mfem::Mesh buildHollowCylinderMesh(int radial_refinement, int elements_lengthwise, double inner_radius, double outer_radius, double height, double total_angle, int sectors)
Constructs a 3D MFEM mesh of a hollow cylinder.
Definition: mesh_utils.cpp:356
mfem::Mesh buildCylinderMesh(int radial_refinement, int elements_lengthwise, double radius, double height)
Constructs a 3D MFEM mesh of a cylinder.
Definition: mesh_utils.cpp:162
mfem::Mesh buildBallMesh(int approx_number_of_elements)
Constructs a 3D MFEM mesh of a unit ball, centered at the origin.
Definition: mesh_utils.cpp:113
mfem::Mesh buildCuboidMesh(int elements_in_x, int elements_in_y, int elements_in_z, double size_x, double size_y, double size_z)
Constructs a 3D MFEM mesh of a cuboid.
Definition: mesh_utils.cpp:155
mfem::Mesh buildDiskMesh(int approx_number_of_elements)
Constructs a 2D MFEM mesh of a unit disk, centered at the origin.
Definition: mesh_utils.cpp:80
mfem::Mesh buildMeshFromFile(const std::string &mesh_file)
Constructs an MFEM mesh from a file.
Definition: mesh_utils.cpp:25
mfem::Mesh build_hollow_quarter_cylinder(std::size_t radial_divisions, std::size_t angular_divisions, std::size_t vertical_divisions, double inner_radius, double outer_radius, double height)
Constructs an MFEM mesh of a hollow cylinder restricted to the first orthant.
Definition: mesh_utils.cpp:364
Input options for generated meshes.
std::vector< int > elements
The number of elements in each direction.
static void defineInputFileSchema(axom::inlet::Container &container)
Input file parameters for mesh generation.
std::vector< double > overall_size
The physical size in each direction.
Input options for meshes read from files.
std::string absolute_mesh_file_name
The absolute path for the mesh file, intended to be populated by the user directly.
std::string relative_mesh_file_name
The relative path for the mesh file.
static void defineInputFileSchema(axom::inlet::Container &container)
Input file parameters specific to this class.
Input options for generated meshes.
int approx_elements
The approximate total number of desired elements.
int dimension
The space dimension of the n-ball.