17 #include "libmesh/exodusII_io.h" 18 #include "libmesh/mesh_tools.h" 19 #include "libmesh/nemesis_io.h" 20 #include "libmesh/parallel_mesh.h" 31 params.
addRequiredParam<MeshFileName>(
"file",
"The name of the mesh file to read");
35 "This is only required for certain mesh formats where " 36 "the dimension of the mesh cannot be autodetected. " 37 "In particular you must supply this for GMSH meshes. " 38 "Note: This is completely ignored for ExodusII meshes!");
39 params.
addParam<
bool>(
"clear_spline_nodes",
41 "If clear_spline_nodes=true, IsoGeometric Analyis spline nodes " 42 "and constraints are removed from an IGA mesh, after which only " 43 "C^0 Rational-Bernstein-Bezier elements will remain.");
46 "If nemesis=true and file=foo.n, actually reads " 47 "foo.n.N.0, foo.n.N.1, ... foo.n.N.N-1, " 48 "where N = # CPUs, with NemesisIO.",
49 "This parameter should no longer be necessary if you use the " 50 "'.n' or '.nem' file extension for Nemesis files");
56 :
MooseMesh(parameters), _file_name(getParam<MeshFileName>(
"file"))
70 :
MooseMesh(other_mesh), _file_name(other_mesh._file_name)
76 std::unique_ptr<MooseMesh>
85 TIME_SECTION(
"buildMesh", 2,
"Reading Mesh");
88 getMesh().set_mesh_dimension(getParam<MooseEnum>(
"dim"));
93 DistributedMesh & pmesh = cast_ref<DistributedMesh &>(
getMesh());
96 getMesh().allow_renumbering(
false);
101 bool skip_partitioning_later =
getMesh().skip_partitioning();
102 getMesh().skip_partitioning(
true);
104 getMesh().skip_partitioning(skip_partitioning_later);
117 auto exreader = std::make_shared<ExodusII_IO>(
getMesh());
121 getMesh().allow_renumbering(
false);
134 const bool skip_partitioning_later = restarting &&
getMesh().skip_partitioning();
135 const bool allow_renumbering_later = restarting &&
getMesh().allow_renumbering();
139 getMesh().skip_partitioning(
true);
140 getMesh().allow_renumbering(
false);
146 if (getParam<bool>(
"clear_spline_nodes"))
147 MeshTools::clear_spline_nodes(
getMesh());
153 getMesh().allow_renumbering(allow_renumbering_later);
154 getMesh().skip_partitioning(skip_partitioning_later);
164 getMesh().read(file_name, NULL,
false);
166 getMesh().read(file_name, NULL,
true);
static InputParameters validParams()
Typical "Moose-style" constructor and copy constructor.
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...
bool _is_nemesis
True if a Nemesis Mesh was read in.
virtual void read(const std::string &base_filename) override
virtual void buildMesh() override
Must be overridden by child classes.
static const RestartableDataMapName MESH_META_DATA
std::string _file_name
the file_name from whence this mesh came
void determineUseDistributedMesh()
Determine whether to use a distributed mesh.
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.
bool getExodusFileRestart() const
Whether or not we need to use a separate Exodus reader to read the mesh BEFORE we create the mesh...
void possiblyLoadRestartableMetaData(const RestartableDataMapName &name, const std::filesystem::path &folder_base)
Loads the restartable meta data for name if it is available with the folder base folder_base.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
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 std::string deduceCheckpointPath(const MooseObject &object, const std::string &file_name)
Helper for deducing a checkpoint file given the path.
FileMesh(const InputParameters ¶meters)
bool hasExtension(const std::string &filename, std::string ext, bool strip_exodus_ext)
void read(const std::string &file_name)
static InputParameters validParams()
registerMooseObject("MooseApp", FileMesh)
bool checkFileReadable(const std::string &filename, bool check_line_endings, bool throw_on_unreadable, bool check_for_git_lfs_pointer)
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
void setExReaderForRestart(std::shared_ptr< libMesh::ExodusII_IO > &&exreader)
Set the Exodus reader to restart variables from an Exodus mesh file.