22 #include "libmesh/dof_map.h" 23 #include "libmesh/string_to_enum.h" 35 "When true and VectorPostprocessor data exists, write " 36 "a csv file containing the timestep and time " 40 params.
addParam<
bool>(
"append_restart",
false,
"Append existing file on restart");
45 "Whether or not the 'time' column should be written for Postprocessor CSV files");
49 "The independent variable tolerance for determining when a new row should " 50 "be added to the table (Note: This value must be set independently for " 51 "Postprocessor output to type=Console and type=CSV file separately.");
59 _tables_restartable(getParam<bool>(
"append_restart")),
60 _postprocessor_table(_tables_restartable
63 _vector_postprocessor_time_tables(
65 "vector_postprocessor_time_table")
67 "vector_postprocessor_time_table")),
68 _scalar_table(_tables_restartable ? declareRestartableData<
FormattedTable>(
"scalar_table")
70 _reporter_table(_tables_restartable ? declareRestartableData<
FormattedTable>(
"reporter_table")
72 _all_data_table(_tables_restartable ? declareRestartableData<
FormattedTable>(
"all_data_table")
74 _new_row_tol(getParam<
Real>(
"new_row_tolerance")),
75 _time_data(getParam<bool>(
"time_data")),
76 _time_column(getParam<bool>(
"time_column"))
102 for (
const auto & out_name :
out)
120 outputReporter<bool>(r_name);
121 outputReporter<unsigned short int>(r_name);
122 outputReporter<unsigned int>(r_name);
123 outputReporter<unsigned long int>(r_name);
124 outputReporter<unsigned long long int>(r_name);
125 outputReporter<short int>(r_name);
126 outputReporter<int>(r_name);
127 outputReporter<long int>(r_name);
128 outputReporter<long long int>(r_name);
129 outputReporter<float>(r_name);
130 outputReporter<long double>(r_name);
131 outputReporter<char>(r_name);
132 outputReporter<std::string>(r_name);
137 outputReporter<Real>(r_name);
149 const std::string & vpp_name = r_name.getObjectName();
150 const std::string & vec_name = r_name.getValueName();
151 const bool vpp_out =
out.find(vpp_name) !=
out.end();
161 table.
addData(vec_name, vector);
179 for (
const auto & out_name :
out)
195 auto value_size =
value.size();
199 const std::vector<dof_id_type> & dof_indices = scalar_var.
dofIndices();
200 auto dof_size = dof_indices.size();
201 bool need_release =
false;
205 if (dof_size > value_size)
207 value.resize(dof_size);
216 const DofMap & dof_map = scalar_var.
sys().
dofMap();
217 for (decltype(dof_size) i = 0; i < dof_size; ++i)
232 for (decltype(dof_size) i = 0; i < dof_size; ++i)
234 std::ostringstream
os;
235 os << out_name <<
"_" << i;
const std::set< std::string > & getPostprocessorOutput()
The list of postprocessor names that are set for output.
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
void reinit(bool reinit_for_derivative_reordering=false)
Fill out the VariableValue arrays from the system solution vector.
static constexpr Real TOLERANCE
FormattedTable & _postprocessor_table
Table containing postprocessor data.
const Parallel::Communicator & comm() const
int & _t_step
The current time step.
std::basic_ostream< charT, traits > * os
const std::set< std::string > & getVectorPostprocessorOutput()
The list of VectorPostprocessor names that are set for output.
std::pair< typename M::iterator, bool > moose_try_emplace(M &m, const typename M::key_type &k, Args &&... args)
Function to mirror the behavior of the C++17 std::map::try_emplace() method (no hint).
virtual void outputVectorPostprocessors() override
Populates the tables with VectorPostprocessor values.
const std::set< std::string > & getReporterOutput()
The list of Reporter names that are set for output.
uint8_t processor_id_type
virtual 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.
const T & getReporterValue(const ReporterName &reporter_name, const MooseObject &consumer, const ReporterMode &mode, const std::size_t time_index=0) const
Method for returning read only references to Reporter values.
TableOutput(const InputParameters ¶meters)
Class constructor.
bool hasPostprocessorByName(const PostprocessorName &name) const
Determine if the Postprocessor data exists.
FormattedTable & _scalar_table
Table containing scalar aux variables.
Real PostprocessorValue
various MOOSE typedefs
const bool _time_column
Enable/disable output of time column for Postprocessors.
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
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.
virtual void outputReporters() override
Populates the tables with Reporter values.
const std::string & getObjectName() const
Return the object name that produces the Reporter value.
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.
const bool _time_data
Enable/disable VecptorPostprocessor time data file.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
std::set< ReporterName > getReporterNames() const
Return a list of all reporter names.
virtual void outputPostprocessors() override
Populates the tables with postprocessor values.
const ReporterData & _reporter_data
Storage for Reporter values.
FormattedTable & _all_data_table
Table containing postprocessor values, scalar aux variables, and Real Reporters.
Based class for output objects.
OutputTools< Real >::VariableValue VariableValue
std::vector< Real > VectorPostprocessorValue
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Class for scalar variables (they are different).
FormattedTable & _reporter_table
Table containing Real Reporter values.
bool hasReporterValue(const ReporterName &reporter_name) const
Return True if a Reporter value with the given type and name have been created.
const Real _new_row_tol
Tolerance used when deciding whether or not to add a new row to the table.
static InputParameters validParams()
SystemBase & sys()
Get the system this variable is part of.
const VariableValue & sln() const
Real & _time
The current time for output purposes.
virtual Real getOutputTime()
Get the time that will be used for stream/file outputting.
std::map< std::string, FormattedTable > _vector_postprocessor_tables
Formatted tables for outputting vector postprocessor data. One per VectorPostprocessor.
The Reporter system is comprised of objects that can contain any number of data values.
virtual void outputScalarVariables() override
Populates the tables with scalar aux variables.
std::map< std::string, FormattedTable > & _vector_postprocessor_time_tables
Table for vector postprocessor time data.
static InputParameters validParams()