IFEM  90A354
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
LinearFunc Class Reference

A scalar-valued linear function. More...

#include <Functions.h>

Inheritance diagram for LinearFunc:
Inheritance graph
[legend]
Collaboration diagram for LinearFunc:
Collaboration graph
[legend]

Public Member Functions

 LinearFunc (Real s=Real(1))
 Constructor initializing the scaling parameter.
 
 LinearFunc (const char *file, int c=2, Real s=Real(1))
 Constructor initializing piece-wise linear function values. More...
 
 LinearFunc (const std::vector< Real > &x, const std::vector< Real > &y)
 Constructor initializing piece-wise linear function values. More...
 
bool isZero () const override
 Returns whether the function is identically zero or not.
 
bool isConstant () const override
 Returns whether the function is constant or not.
 
Real deriv (Real x) const override
 Returns the first-derivative of the function.
 
- Public Member Functions inherited from ScalarFunc
Real eval (Real x) const
 Returns the function value for the argument x.
 
- Public Member Functions inherited from utl::Function< Real, Real >
virtual ~Function ()
 Empty destructor.
 
Real operator() (const Real &x) const
 Operator returning the function value for the given argument.
 

Protected Member Functions

Real evaluate (const Real &x) const override
 Evaluates the function at x.
 
- Protected Member Functions inherited from ScalarFunc
 ScalarFunc ()
 The constructor is protected to allow sub-class instances only.
 
- Protected Member Functions inherited from utl::Function< Real, Real >
 Function ()
 The constructor is protected to allow sub-class instances only.
 

Private Types

using Point = std::pair< Real, Real >
 Convenience type.
 

Private Member Functions

size_t locate (Real x) const
 Retuns the index of the first point after x.
 

Private Attributes

std::vector< Pointfvals
 Values for piece-wise linear function.
 
Real scale
 Scaling factor.
 

Additional Inherited Members

- Public Types inherited from utl::Function< Real, Real >
typedef Real Input
 Input type.
 
typedef Real Output
 Output type.
 

Detailed Description

A scalar-valued linear function.

Constructor & Destructor Documentation

◆ LinearFunc() [1/2]

LinearFunc::LinearFunc ( const char *  file,
int  c = 2,
Real  s = Real(1) 
)
explicit

Constructor initializing piece-wise linear function values.

Parameters
[in]fileName of file to read the function values from
[in]cWhich column of the file to read function values from
[in]sOptional scaling factor

References fvals, Real, and scale.

◆ LinearFunc() [2/2]

LinearFunc::LinearFunc ( const std::vector< Real > &  x,
const std::vector< Real > &  y 
)

Constructor initializing piece-wise linear function values.

Parameters
[in]xList of function argument values
[in]yList of function values associated with the x values

References fvals, Real, and scale.


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