18 #include "libmesh/checkpoint_io.h" 38 if (
mesh->getFileName() ==
"" && split_file_arg ==
"")
39 mooseError(
"Output mesh file name must be specified (with --split-file) when splitting " 40 "non-file-based meshes");
43 std::vector<unsigned int> splits;
46 mooseError(
"invalid argument for --split-mesh: '", splitstr,
"'");
58 bool checkpoint_binary_flag =
false;
60 if (split_file_arg_ext !=
"")
62 if (split_file_arg_ext ==
"cpr")
63 checkpoint_binary_flag =
true;
64 else if (split_file_arg_ext ==
"cpa.gz")
65 checkpoint_binary_flag =
false;
69 ", must not end in a file extension other than .cpr or .cpa.gz");
76 auto fname =
mesh->getFileName();
78 fname = split_file_arg;
81 for (std::size_t i = 0; i < splits.size(); i++)
84 Moose::out <<
"Splitting " << n <<
" ways..." << std::endl;
87 Moose::out <<
" - writing " << cp->current_processor_ids().size() <<
" files per process..." 89 cp->binary() = checkpoint_binary_flag;
99 Moose::out <<
"Mesh meta data written into " 100 << std::filesystem::absolute(filenames[0].parent_path()) <<
"." << std::endl;
SplitMeshAction(const InputParameters ¶ms)
bool tokenizeAndConvert(const std::string &str, std::vector< T > &tokenized_vector, const std::string &delimiter=" \\\)
tokenizeAndConvert splits a string using delimiter and then converts to type T.
static const RestartableDataMapName MESH_META_DATA
std::vector< std::filesystem::path > writeRestartableMetaData(const RestartableDataMapName &name, const std::filesystem::path &folder_base)
Writes the restartable meta data for name with a folder base of folder_base.
const InputParameters & parameters()
Get the parameters of the object.
std::string getExtension(const std::string &filename, const bool rfind=false)
Gets the extension of the passed file name.
std::shared_ptr< MooseMesh > & mesh()
uint8_t processor_id_type
static InputParameters validParams()
std::string stripExtension(const std::string &s, const bool rfind=false)
Removes any file extension from the given string s (i.e.
static InputParameters validParams()
registerMooseAction("MooseApp", SplitMeshAction, "split_mesh")
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
MooseApp & _app
The MOOSE application this is associated with.
std::unique_ptr< CheckpointIO > split_mesh(MeshBase &mesh, processor_id_type nsplits)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
processor_id_type processor_id() const
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.