OGS
ProcessLib::OutputDataSpecification Struct Referencefinal

Detailed Description

Holds information about which variables to write to output files.

Definition at line 33 of file OutputDataSpecification.h.

#include <OutputDataSpecification.h>

Public Member Functions

 OutputDataSpecification (std::set< std::string > &&output_variables_, std::vector< double > &&fixed_output_times_, std::vector< PairRepeatEachSteps > &&repeats_each_steps_, bool const output_residuals_)
 
bool isOutputStep (int timestep, double const time) const
 

Public Attributes

std::set< std::string > output_variables
 All variables that shall be output.
 
std::vector< double > fixed_output_times
 Given times that steps have to reach.
 
std::vector< PairRepeatEachStepsrepeats_each_steps
 Describes after which timesteps to write output.
 
bool output_residuals
 Tells if also to output extrapolation residuals.
 

Constructor & Destructor Documentation

◆ OutputDataSpecification()

ProcessLib::OutputDataSpecification::OutputDataSpecification ( std::set< std::string > && output_variables_,
std::vector< double > && fixed_output_times_,
std::vector< PairRepeatEachSteps > && repeats_each_steps_,
bool const output_residuals_ )

Definition at line 17 of file OutputDataSpecification.cpp.

22 : output_variables(std::move(output_variables_)),
23 fixed_output_times(std::move(fixed_output_times_)),
24 repeats_each_steps(std::move(repeats_each_steps_)),
25 output_residuals(output_residuals_)
26{
27 if (!std::is_sorted(cbegin(fixed_output_times), cend(fixed_output_times)))
28 {
30 "Vector of fixed output time steps passed to the "
31 "OutputDataSpecification constructor must be sorted");
32 }
33 // check the repeats_each_steps pairs
34 for (auto const& pair : repeats_each_steps)
35 {
36 if (pair.each_steps == 0)
37 {
39 "Step in pair of <repeats><steps> is zero but has to be "
40 "greater than zero.");
41 }
42 }
43 if (repeats_each_steps.empty())
44 {
45 repeats_each_steps.emplace_back(1, std::numeric_limits<int>::max());
46 }
47}
#define OGS_FATAL(...)
Definition Error.h:26
std::vector< PairRepeatEachSteps > repeats_each_steps
Describes after which timesteps to write output.
std::vector< double > fixed_output_times
Given times that steps have to reach.
bool output_residuals
Tells if also to output extrapolation residuals.
std::set< std::string > output_variables
All variables that shall be output.

References fixed_output_times, OGS_FATAL, and repeats_each_steps.

Member Function Documentation

◆ isOutputStep()

bool ProcessLib::OutputDataSpecification::isOutputStep ( int timestep,
double const time ) const

Determines if there should be output at the given timestep or time.

Definition at line 49 of file OutputDataSpecification.cpp.

51{
52 auto isFixedOutputStep = [this](double const time) -> bool
53 {
54 return std::any_of(cbegin(fixed_output_times), cend(fixed_output_times),
55 [&](auto fixed_output_time)
56 {
57 return (std::abs(fixed_output_time - time) <
59 });
60 };
61
62 auto isPairRepeatsEachTimeStepOutput = [this](int timestep) -> bool
63 {
64 int each_steps = 1;
65
66 for (auto const& pair : repeats_each_steps)
67 {
68 each_steps = pair.each_steps;
69
70 if (timestep > pair.repeat * each_steps)
71 {
72 timestep -= pair.repeat * each_steps;
73 }
74 else
75 {
76 break;
77 }
78 }
79
80 return timestep % each_steps == 0;
81 };
82
83 return isFixedOutputStep(time) || isPairRepeatsEachTimeStepOutput(timestep);
84}
static constexpr double minimalTimeStepSize
Definition TimeStep.h:100

References fixed_output_times, NumLib::TimeStep::minimalTimeStepSize, and repeats_each_steps.

Referenced by ProcessLib::Output::isOutputStep().

Member Data Documentation

◆ fixed_output_times

std::vector<double> ProcessLib::OutputDataSpecification::fixed_output_times

Given times that steps have to reach.

Definition at line 45 of file OutputDataSpecification.h.

Referenced by OutputDataSpecification(), ProcessLib::Output::getFixedOutputTimes(), isOutputStep(), and ProcessLib::operator<<().

◆ output_residuals

bool ProcessLib::OutputDataSpecification::output_residuals

Tells if also to output extrapolation residuals.

Definition at line 51 of file OutputDataSpecification.h.

Referenced by ProcessLib::addProcessDataToMesh(), and ProcessLib::operator<<().

◆ output_variables

std::set<std::string> ProcessLib::OutputDataSpecification::output_variables

All variables that shall be output.

Definition at line 42 of file OutputDataSpecification.h.

Referenced by ProcessLib::addProcessDataToMesh(), ProcessLib::operator<<(), and ProcessLib::Output::outputMeshes().

◆ repeats_each_steps

std::vector<PairRepeatEachSteps> ProcessLib::OutputDataSpecification::repeats_each_steps

Describes after which timesteps to write output.

Definition at line 48 of file OutputDataSpecification.h.

Referenced by OutputDataSpecification(), isOutputStep(), and ProcessLib::operator<<().


The documentation for this struct was generated from the following files: