All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
LinearScalarFunction Class Reference

#include <ScalarFunctionsImpl.h>

Inheritance diagram for LinearScalarFunction:
Collaboration diagram for LinearScalarFunction:

Public Member Functions

 LinearScalarFunction (const doublereal t_i, const doublereal y_i, const doublereal t_f, const doublereal y_f)
virtual ~LinearScalarFunction (void)
virtual doublereal operator() (const doublereal x) const
virtual doublereal ComputeDiff (const doublereal t, const integer order=1) const
- Public Member Functions inherited from DifferentiableScalarFunction
virtual ~DifferentiableScalarFunction ()
- Public Member Functions inherited from BasicScalarFunction
virtual ~BasicScalarFunction ()

Private Attributes

doublereal m
doublereal y0

Detailed Description

Definition at line 67 of file ScalarFunctionsImpl.h.

Constructor & Destructor Documentation

LinearScalarFunction::LinearScalarFunction ( const doublereal  t_i,
const doublereal  y_i,
const doublereal  t_f,
const doublereal  y_f 

Definition at line 184 of file ScalarFunctionsImpl.cc.

References ASSERTMSGBREAK, m, and y0.

189 {
190  ASSERTMSGBREAK(t_i != t_f, "LinearScalarFunction error, t_i == t_f");
191  m = (y_f - y_i)/(t_f - t_i);
192  y0 = y_i - m*t_i;
193 }
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
LinearScalarFunction::~LinearScalarFunction ( void  )

Definition at line 195 of file ScalarFunctionsImpl.cc.

References NO_OP.

196 {
197  NO_OP;
198 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

doublereal LinearScalarFunction::ComputeDiff ( const doublereal  t,
const integer  order = 1 
) const

Implements DifferentiableScalarFunction.

Definition at line 207 of file ScalarFunctionsImpl.cc.

References ASSERTMSGBREAK, m, and operator()().

208 {
209  ASSERTMSGBREAK(order >=0, "Error in LinearScalarFunction::ComputeDiff, order<0");
210  switch (order) {
211  case 0:
212  return this->operator()(x);
214  case 1:
215  return m;
217  default:
218  return 0.;
220  }
221 }
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
virtual doublereal operator()(const doublereal x) const
enum @55 order

Here is the call graph for this function:

doublereal LinearScalarFunction::operator() ( const doublereal  x) const

Implements DifferentiableScalarFunction.

Definition at line 201 of file ScalarFunctionsImpl.cc.

References m, and y0.

Referenced by ComputeDiff().

202 {
203  return y0 + m*x;
204 }

Member Data Documentation

doublereal LinearScalarFunction::m

Definition at line 69 of file ScalarFunctionsImpl.h.

Referenced by ComputeDiff(), LinearScalarFunction(), and operator()().

doublereal LinearScalarFunction::y0

Definition at line 70 of file ScalarFunctionsImpl.h.

Referenced by LinearScalarFunction(), and operator()().

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