https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PiecewiseFunction.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "Function.h"
13#include "FunctionInterface.h"
14
19{
20public:
22
23 using Function::value;
24 virtual Real value(Real t, const Point & p) const override;
25 virtual RealVectorValue gradient(Real t, const Point & p) const override;
26 virtual Real timeDerivative(Real t, const Point & p) const override;
27
28protected:
37 unsigned int getFunctionIndex(Real t, const Point & p) const;
38
40 const unsigned int _component;
42 const bool _use_time;
44 const std::vector<Real> & _axis_coordinates;
45
47 const std::vector<FunctionName> & _function_names;
49 const unsigned int _n_functions;
51 std::vector<const Function *> _functions;
52
53public:
55};
Interface for objects that need to use functions.
Base class for function objects.
Definition Function.h:30
virtual Real value(Real t, const Point &p) const
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero,...
Definition Function.C:30
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Function which provides a piecewise representation of arbitrary functions.
unsigned int getFunctionIndex(Real t, const Point &p) const
Gets the index of the function at the specified time and spatial point.
const std::vector< Real > & _axis_coordinates
N-1 coordinates in the chosen axis, in increasing order, delimiting the N function regions.
const unsigned int _n_functions
Number of functions, N.
const unsigned int _component
Axis on which the N-1 delimiting points lie.
std::vector< const Function * > _functions
Functions in the N regions.
const std::vector< FunctionName > & _function_names
Names of the functions in the N regions.
const bool _use_time
Use the time axis?
static InputParameters validParams()
virtual Real value(Real t, const Point &p) const override
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero,...
virtual Real timeDerivative(Real t, const Point &p) const override
Get the time derivative of the function.
virtual RealVectorValue gradient(Real t, const Point &p) const override
Function objects can optionally provide a gradient at a point.