19 params.
addClassDescription(
"Perform a point reduction of the tabulated data upon initialization, " 20 "then evaluate using a linear interpolation.");
23 "Significant distance in the function below which points are considered removable noise");
26 "Scaling factor to apply to the function nodes for the purpose of " 27 "computing distances in the Douglas-Peucker point reduction algorithm. " 28 "This permits shifting the weight between x and y-direction distances.");
31 "Scaling factor to apply to the function nodes for the purpose of " 32 "computing distances in the Douglas-Peucker point reduction algorithm. " 33 "This permits shifting the weight between x and y-direction distances.");
54 mooseError(
"Data has still not been loaded at setup time. Something has gone wrong during " 55 "Function initialization, contact a developer");
61 const Real x_scale = getParam<Real>(
"x_scale");
62 const Real y_scale = getParam<Real>(
"y_scale");
63 const Real epsilon = getParam<Real>(
"epsilon");
67 list.reserve(
_raw_x.size());
69 list.emplace_back(
_raw_x[i] * x_scale,
_raw_y[i] * y_scale);
72 _console <<
"Reduced size for function '" <<
name() <<
"' from " << list.size();
74 _console <<
" to " << list.size() <<
" points." << std::endl;
77 _raw_x.resize(list.size());
78 _raw_y.resize(list.size());
79 for (MooseIndex(list) i = 0; i < list.size(); ++i)
81 _raw_x[i] = list[i].first / x_scale;
82 _raw_y[i] = list[i].second / y_scale;
registerMooseObject("MooseApp", CoarsenedPiecewiseLinear)
static InputParameters validParams()
static InputParameters validParams()
void initialSetup() override
Needed to process data loaded from user objects that are not available at construction.
Function class that reads in a list of (x,y) value pairs representing a point-wise defined function s...
virtual const std::string & name() const
Get the name of the class.
std::vector< Real > _raw_x
raw function data as read
Base class for functions which provides a piecewise continuous linear interpolation of an (x...
std::vector< FunctionNode > FunctionNodeList
CoarsenedPiecewiseLinear(const InputParameters ¶meters)
void buildCoarsenedGrid()
Builds the coarse linear interpolation from the fine raw data.
FunctionNodeList douglasPeucker(const FunctionNodeList &, libMesh::Real epsilon)
Generate a pruned function node list using the Ramer-Douglas-Peucker algorithm.
void initialSetup() override
Needed to load data from user objects that are not available at construction.
void buildInterpolation(const bool extrap=false)
Builds the linear interpolation object from the x/y data.
bool isRawDataLoaded() const
Returns whether the raw data has been loaded already.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
std::vector< Real > _raw_y
bool _interpolation_created
Whether the interpolation has been created.