www.mooseframework.org
Piecewise.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef PIECEWISE_H
16 #define PIECEWISE_H
17 
18 #include "Function.h"
19 #include "LinearInterpolation.h"
20 
21 class Piecewise;
22 
23 template <>
25 
31 class Piecewise : public Function
32 {
33 public:
35 
36  virtual Real functionSize();
37  virtual Real domain(int i);
38  virtual Real range(int i);
39 
43  void setData(const std::vector<Real> & x, const std::vector<Real> & y);
44 
45 protected:
49  std::pair<std::vector<Real>, std::vector<Real>> buildFromFile();
50 
54  std::pair<std::vector<Real>, std::vector<Real>> buildFromXandY();
55 
59  std::pair<std::vector<Real>, std::vector<Real>> buildFromXY();
60 
61  const Real _scale_factor;
62  std::unique_ptr<LinearInterpolation> _linear_interp;
63  int _axis;
64  bool _has_axis;
65 };
66 
67 #endif
Base class for function objects.
Definition: Function.h:46
int _axis
Definition: Piecewise.h:63
bool _has_axis
Definition: Piecewise.h:64
const Real _scale_factor
Definition: Piecewise.h:61
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static PetscErrorCode Vec x
std::pair< std::vector< Real >, std::vector< Real > > buildFromXY()
Builds data from &#39;xy_data&#39; parameter.
Definition: Piecewise.C:205
InputParameters validParams< Piecewise >()
Definition: Piecewise.C:22
void setData(const std::vector< Real > &x, const std::vector< Real > &y)
Provides a means for explicitly setting the x and y data.
Definition: Piecewise.C:72
std::pair< std::vector< Real >, std::vector< Real > > buildFromXandY()
Builds data from &#39;x&#39; and &#39;y&#39; parameters.
Definition: Piecewise.C:192
virtual Real domain(int i)
Definition: Piecewise.C:114
std::unique_ptr< LinearInterpolation > _linear_interp
Definition: Piecewise.h:62
virtual Real range(int i)
Definition: Piecewise.C:120
std::pair< std::vector< Real >, std::vector< Real > > buildFromFile()
Reads data from supplied CSV file.
Definition: Piecewise.C:126
Piecewise(const InputParameters &parameters)
Definition: Piecewise.C:49
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
Function which provides a piecewise approximation to a provided (x,y) point data set.
Definition: Piecewise.h:31
virtual Real functionSize()
Definition: Piecewise.C:108