19 #include "libmesh/dof_map.h" 20 #include "libmesh/nemesis_io.h" 31 params.
addParam<
bool>(
"write_hdf5",
false,
"Enables HDF5 output format for Nemesis files.");
32 params.
addClassDescription(
"Object for output data in the Nemesis (parallel ExodusII) format.");
38 _nemesis_io_ptr(nullptr),
39 _file_num(declareRestartableData<unsigned
int>(
"nemesis_file_num", 0)),
40 _nemesis_num(declareRestartableData<unsigned
int>(
"nemesis_num", 0)),
41 _nemesis_initialized(false),
42 _recovering(_app.isRecovering()),
43 _nemesis_mesh_changed(declareRestartableData<bool>(
"nemesis_mesh_changed", true)),
44 _write_hdf5(getParam<bool>(
"write_hdf5"))
86 #ifndef LIBMESH_HAVE_HDF5 87 mooseError(
"Moose input requested HDF Nemesis output, but libMesh was built without HDF5.");
126 for (
const auto &
name : pps)
140 for (
const auto & out_name : out)
150 const std::vector<dof_id_type> & dof_indices = scalar_var.
dofIndices();
151 const unsigned int n = dof_indices.size();
155 for (
unsigned int i = 0; i != n; ++i)
171 for (
unsigned int i = 0; i < n; ++i)
173 std::ostringstream
os;
174 os << out_name <<
"_" << i;
224 std::ostringstream
output;
229 output <<
"-s" << std::setw(
_padding) << std::setprecision(0) << std::setfill(
'0') << std::right
const std::set< std::string > & getPostprocessorOutput()
The list of postprocessor names that are set for output.
virtual void outputScalarVariables() override
Writes scalar AuxVariables to global output parameters.
virtual void meshChanged() override
Creates a new NemesisII_IO output object for outputting a new mesh.
std::vector< Real > _global_values
Storage for scalar values (postprocessors and scalar AuxVariables)
processor_id_type dof_owner(const dof_id_type dof) const
bool _recovering
Flag indicating MOOSE is recovering via –recover command-line option.
void reinit(bool reinit_for_derivative_reordering=false)
Fill out the VariableValue arrays from the system solution vector.
std::unique_ptr< libMesh::Nemesis_IO > _nemesis_io_ptr
Pointer to the libMesh::NemesisII_IO object that performs the actual data output. ...
std::vector< std::string > _global_names
Storage for names of the above scalar values.
bool _write_hdf5
Flag to output HDF5 format (when available) in Nemesis.
unsigned int & _nemesis_num
Count of outputs per exodus file.
const Parallel::Communicator & comm() const
std::string _file_base
The base filename from the input paramaters.
virtual void output()
A single call to this function should output all the necessary data for a single timestep.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
std::basic_ostream< charT, traits > * os
virtual void outputPostprocessors() override
Writes postprocessor values to global output parameters.
virtual const std::string & name() const
Get the name of the class.
virtual void outputSetup()
Performs the necessary deletion and re-creating of NemesisII_IO object.
bool & _nemesis_mesh_changed
A flag indicating to the Nemesis object that the mesh has changed.
unsigned int _padding
Number of digits to pad the extensions.
uint8_t processor_id_type
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const std::set< std::string > & getScalarOutput()
The list of scalar variables names that are set for output.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
virtual void output() override
Overload the Output::output method, this is required for Nemesis output due to the method utilized fo...
virtual MooseVariableScalar & getScalarVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the scalar variable reference from whichever system contains it.
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
static InputParameters validParams()
MooseApp & _app
The MOOSE application this is associated with.
static InputParameters enableOutputTypes(const std::string &names=std::string())
A method for enabling individual output type control.
const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name, std::size_t t_index=0) const
Get a read-only reference to the value associated with a Postprocessor that exists.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
Based class for output objects.
OutputTools< Real >::VariableValue VariableValue
virtual void initialSetup()
Call init() method on setup.
bool _nemesis_initialized
Flag if the output has been initialized.
virtual void initialSetup() override
Sets up the libMesh::NemesisII_IO object used for outputting to the Nemesis format.
libMesh::EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Class for scalar variables (they are different).
virtual std::string filename() override
Returns the current filename, this method handles the -s000 suffix common to NemesisII files...
virtual MooseMesh & mesh() override
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
const std::set< std::string > & getElementalVariableOutput()
The list of elemental nonlinear variables names that are set for output.
const std::set< std::string > & getNodalVariableOutput()
The list of nodal nonlinear variables names that are set for output.
registerMooseObject("MooseApp", Nemesis)
static InputParameters validParams()
SystemBase & sys()
Get the system this variable is part of.
Nemesis(const InputParameters ¶meters)
Class constructor.
Real getGlobalTimeOffset() const
Each App has it's own local time.
const VariableValue & sln() const
virtual Real getOutputTime()
Get the time that will be used for stream/file outputting.
void ErrorVector unsigned int
Class for output data to the Nemesis format.
unsigned int & _file_num
Current output filename; utilized by filename() to create the proper suffix.