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");
47 MooseEnum new_row_detection_columns(
"time all",
"time");
48 new_row_detection_columns.addDocumentation(
50 "If the time for a new row would match the previous row's time within 'new_row_tolerance', " 51 "do not add the row.");
52 new_row_detection_columns.addDocumentation(
54 "If all columns for a new row would match the previous row's columns within " 55 "'new_row_tolerance', do not add the row.");
57 new_row_detection_columns,
58 "Columns to check for duplicate rows; duplicate rows are not output.");
61 "The independent variable tolerance for determining when a new row should " 62 "be added to the table (Note: This value must be set independently for " 63 "Postprocessor output to type=Console and type=CSV file separately.");
72 const std::string & param)
81 _tables_restartable(getParam<bool>(
"append_restart")),
82 _postprocessor_table(_tables_restartable
85 _vector_postprocessor_time_tables(
87 "vector_postprocessor_time_table")
89 "vector_postprocessor_time_table")),
90 _scalar_table(_tables_restartable ? declareRestartableData<
FormattedTable>(
"scalar_table")
92 _reporter_table(_tables_restartable ? declareRestartableData<
FormattedTable>(
"reporter_table")
94 _all_data_table(_tables_restartable ? declareRestartableData<
FormattedTable>(
"all_data_table")
96 _check_all_columns_for_new_row(getParam<
MooseEnum>(
"new_row_detection_columns") ==
"all"),
97 _new_row_tol(getParam<
Real>(
"new_row_tolerance")),
98 _time_data(getParam<bool>(
"time_data")),
99 _time_column(getParam<bool>(
"time_column"))
133 bool all_columns_are_identical =
true;
140 all_columns_are_identical =
false;
144 return !all_columns_are_identical;
169 outputReporter<bool>(r_name);
170 outputReporter<unsigned short int>(r_name);
171 outputReporter<unsigned int>(r_name);
172 outputReporter<unsigned long int>(r_name);
173 outputReporter<unsigned long long int>(r_name);
174 outputReporter<short int>(r_name);
175 outputReporter<int>(r_name);
176 outputReporter<long int>(r_name);
177 outputReporter<long long int>(r_name);
178 outputReporter<float>(r_name);
179 outputReporter<long double>(r_name);
180 outputReporter<char>(r_name);
181 outputReporter<std::string>(r_name);
186 outputReporter<Real>(r_name);
198 const std::string & vpp_name = r_name.getObjectName();
199 const std::string & vec_name = r_name.getValueName();
200 const bool vpp_out =
out.find(vpp_name) !=
out.end();
210 table.
addData(vec_name, vector);
228 for (
const auto & out_name :
out)
244 auto value_size =
value.size();
248 const std::vector<dof_id_type> & dof_indices = scalar_var.
dofIndices();
249 auto dof_size = dof_indices.size();
250 bool need_release =
false;
254 if (dof_size > value_size)
256 value.resize(dof_size);
265 const DofMap & dof_map = scalar_var.
sys().
dofMap();
266 for (decltype(dof_size) i = 0; i < dof_size; ++i)
281 for (decltype(dof_size) i = 0; i < dof_size; ++i)
283 std::ostringstream
os;
284 os << out_name <<
"_" << i;
const std::set< std::string > & getPostprocessorOutput()
The list of postprocessor names that are set for output.
A MultiMooseEnum object to hold "execute_on" flags.
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.
processor_id_type dof_owner(const dof_id_type dof) const
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
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
int & _t_step
The current time step.
std::basic_ostream< charT, traits > * os
static void addMultiAppFixedPointIterationEndExecFlag(InputParameters ¶ms, const std::string ¶m)
Adds the exec flag MULTIAPP_FIXED_POINT_ITERATION_END to a parameter.
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 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.
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.
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.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
std::string getDocString() const
Generate a documentation string for the "execute_on" parameter.
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
const bool _check_all_columns_for_new_row
If true, new postprocessor rows can be added if any column has a new value.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const ExecFlagType EXEC_MULTIAPP_FIXED_POINT_ITERATION_END
Class for scalar variables (they are different).
void outputPostprocessorsRow(FormattedTable &table)
Outputs a new postprocessor row.
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.
bool shouldOutputPostprocessorsRow(const FormattedTable &table)
Checks to see if a new postprocessor row should be added.
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()