19#include "libmesh/dof_map.h"
20#include "libmesh/nemesis_io.h"
29 params.
addParam<
bool>(
"write_hdf5",
false,
"Enables HDF5 output format for Nemesis files.");
30 params.
addClassDescription(
"Object for output data in the Nemesis (parallel ExodusII) format.");
36 _nemesis_io_ptr(nullptr),
37 _file_num(declareRestartableData<unsigned
int>(
"nemesis_file_num", 0)),
38 _nemesis_num(declareRestartableData<unsigned
int>(
"nemesis_num", 0)),
39 _nemesis_initialized(false),
40 _recovering(_app.isRecovering()),
41 _nemesis_mesh_changed(declareRestartableData<bool>(
"nemesis_mesh_changed", true)),
42 _write_hdf5(getParam<bool>(
"write_hdf5"))
84#ifndef LIBMESH_HAVE_HDF5
85 mooseError(
"Moose input requested HDF Nemesis output, but libMesh was built without HDF5.");
124 for (
const auto &
name : pps)
138 for (
const auto & out_name : out)
148 const std::vector<dof_id_type> & dof_indices = scalar_var.
dofIndices();
149 const unsigned int n = dof_indices.size();
152 const DofMap & dof_map = scalar_var.
sys().
dofMap();
153 for (
unsigned int i = 0; i != n; ++i)
155 const processor_id_type pid = dof_map.dof_owner(dof_indices[i]);
169 for (
unsigned int i = 0; i < n; ++i)
171 std::ostringstream os;
172 os << out_name <<
"_" << i;
222 std::ostringstream
output;
227 output <<
"-s" << std::setw(
_padding) << std::setprecision(0) << std::setfill(
'0') << std::right
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
OutputTools< Real >::VariableValue VariableValue
registerMooseObject("MooseApp", Nemesis)
void ErrorVector unsigned int
Based class for output objects.
static InputParameters enableOutputTypes(const std::string &names=std::string())
A method for enabling individual output type control.
virtual void output()
A single call to this function should output all the necessary data for a single timestep.
virtual void initialSetup()
Call init() method on setup.
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.
static InputParameters validParams()
const std::set< std::string > & getScalarOutput()
The list of scalar variables names that are set for output.
const std::set< std::string > & getPostprocessorOutput()
The list of postprocessor names that are set for output.
virtual MooseVariableScalar & getScalarVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the scalar variable reference from whichever system contains it.
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.
virtual MooseMesh & mesh() override
unsigned int _padding
Number of digits to pad the extensions.
std::string _file_base
The base filename from the input paramaters.
Real getGlobalTimeOffset() const
Each App has it's own local time.
const std::string & name() const
Get the name of the class.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
MooseApp & _app
The MOOSE application this is associated with.
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
SystemBase & sys()
Get the system this variable is part of.
Class for scalar variables (they are different).
const VariableValue & sln() const
void reinit(bool reinit_for_derivative_reordering=false)
Fill out the VariableValue arrays from the system solution vector.
unsigned int & _file_num
Current output filename; utilized by filename() to create the proper suffix.
virtual void outputPostprocessors() override
Writes postprocessor values to global output parameters.
std::vector< Real > _global_values
Storage for scalar values (postprocessors and scalar AuxVariables)
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.
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.
virtual std::string filename() override
Returns the current filename, this method handles the -s000 suffix common to NemesisII files.
bool _write_hdf5
Flag to output HDF5 format (when available) in Nemesis.
unsigned int & _nemesis_num
Count of outputs per exodus file.
Nemesis(const InputParameters ¶meters)
Class constructor.
std::vector< std::string > _global_names
Storage for names of the above scalar values.
bool _nemesis_initialized
Flag if the output has been initialized.
std::unique_ptr< libMesh::Nemesis_IO > _nemesis_io_ptr
Pointer to the libMesh::NemesisII_IO object that performs the actual data output.
virtual void initialSetup() override
Sets up the libMesh::NemesisII_IO object used for outputting to the Nemesis format.
virtual void output() override
Overload the Output::output method, this is required for Nemesis output due to the method utilized fo...
static InputParameters validParams()
bool _recovering
Flag indicating MOOSE is recovering via –recover command-line option.
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
libMesh::EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
virtual Real getOutputTime()
Get the time that will be used for stream/file outputting.
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
const Parallel::Communicator & comm() const