queso-0.51.1
Protected Attributes | List of all members
QUESO::Linear1D1DFunction Class Reference

Class for linear one-dimensional functions. More...

#include <1D1DFunction.h>

Inheritance diagram for QUESO::Linear1D1DFunction:
Inheritance graph
[legend]
Collaboration diagram for QUESO::Linear1D1DFunction:
Collaboration graph
[legend]

Public Member Functions

Constructor/Destructor methods
 Linear1D1DFunction (double minDomainValue, double maxDomainValue, double referenceDomainValue, double referenceImageValue, double rateValue)
 Default constructor. More...
 
 ~Linear1D1DFunction ()
 Destructor. More...
 
Mathematical methods
double value (double domainValue) const
 Returns the value of the linear function at point domainValue. More...
 
double deriv (double domainValue) const
 Returns the value of the derivative of the linear function at point domainValue. More...
 
- Public Member Functions inherited from QUESO::Base1D1DFunction
 Base1D1DFunction (double minDomainValue, double maxDomainValue)
 Default constructor. More...
 
virtual ~Base1D1DFunction ()
 Destructor. More...
 
double minDomainValue () const
 Returns the minimum value of the domain of the (one-dimensional) function. More...
 
double maxDomainValue () const
 Returns the maximum value of the domain of the (one-dimensional) function. More...
 
virtual double multiplyAndIntegrate (const Base1D1DFunction &func, unsigned int quadratureOrder, double *resultWithMultiplicationByTAsWell) const
 TODO: Multiplies this function with function, and integrates it numerically. See template specialization. More...
 

Protected Attributes

double m_referenceDomainValue
 Reference value in the function domain; $ x_1 $ in $ f(x) = y_1 + m (x - x_1)$. More...
 
double m_referenceImageValue
 Reference value in the function image; $ y_1 $ in $ f(x) = y_1 + m (x - x_1)$. More...
 
double m_rateValue
 Rate value; $ m$ in $f(x) = y_1 + m (x - x_1)$. More...
 
- Protected Attributes inherited from QUESO::Base1D1DFunction
double m_minDomainValue
 
double m_maxDomainValue
 

Detailed Description

Class for linear one-dimensional functions.

This class implements linear one-dimensional functions. A common linear function is the the equation of a line:

\[f(x) = y_1 + m (x - x_1), \]

which is a linear function with slope (or rate) $ m $ and passing through the point $(x_1,y_1)$.

This class implements a linear function such as the one describe above where the rate is given by rateValue, and the point is (referenceDomainValue,referenceImageValue).

Definition at line 186 of file 1D1DFunction.h.

Constructor & Destructor Documentation

QUESO::Linear1D1DFunction::Linear1D1DFunction ( double  minDomainValue,
double  maxDomainValue,
double  referenceDomainValue,
double  referenceImageValue,
double  rateValue 
)

Default constructor.

Constructs a linear function of constant rate of change rateValue which passes through the point (x,y)=(referenceDomainValue,referenceImageValue).

Definition at line 200 of file 1D1DFunction.C.

206  :
208  m_referenceDomainValue (referenceDomainValue),
209  m_referenceImageValue (referenceImageValue),
210  m_rateValue (rateValue)
211 {
212 }
Base1D1DFunction(double minDomainValue, double maxDomainValue)
Default constructor.
Definition: 1D1DFunction.C:33
double maxDomainValue() const
Returns the maximum value of the domain of the (one-dimensional) function.
Definition: 1D1DFunction.C:57
double m_referenceDomainValue
Reference value in the function domain; in .
Definition: 1D1DFunction.h:220
double m_rateValue
Rate value; in .
Definition: 1D1DFunction.h:226
double m_referenceImageValue
Reference value in the function image; in .
Definition: 1D1DFunction.h:223
double minDomainValue() const
Returns the minimum value of the domain of the (one-dimensional) function.
Definition: 1D1DFunction.C:51
QUESO::Linear1D1DFunction::~Linear1D1DFunction ( )

Destructor.

Definition at line 214 of file 1D1DFunction.C.

215 {
216 }

Member Function Documentation

double QUESO::Linear1D1DFunction::deriv ( double  domainValue) const
virtual

Returns the value of the derivative of the linear function at point domainValue.

This function checks if point domainValue belongs to the domain of this function, and in affirmative case, it returns the value of the derivative at such point (namely m_rateValue).

Implements QUESO::Base1D1DFunction.

Definition at line 241 of file 1D1DFunction.C.

References QUESO::Base1D1DFunction::m_maxDomainValue, QUESO::Base1D1DFunction::m_minDomainValue, m_rateValue, UQ_FATAL_TEST_MACRO, and QUESO::UQ_UNAVAILABLE_RANK.

242 {
243  if ((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)) {
244  std::cerr << "In Linear1D1DFunction::deriv()"
245  << ": requested x (" << domainValue
246  << ") is out of the interval (" << m_minDomainValue
247  << ", " << m_maxDomainValue
248  << ")"
249  << std::endl;
250  }
251 
252  UQ_FATAL_TEST_MACRO(((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)),
254  "Linear1D1DFunction::deriv()",
255  "x out of range");
256 
257  return m_rateValue;
258 }
const int UQ_UNAVAILABLE_RANK
Definition: Defines.h:74
double m_rateValue
Rate value; in .
Definition: 1D1DFunction.h:226
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
double QUESO::Linear1D1DFunction::value ( double  domainValue) const
virtual

Returns the value of the linear function at point domainValue.

This function checks if point domainValue belongs to the domain of this function, and in affirmative case, it evaluates the function at such point.

Implements QUESO::Base1D1DFunction.

Definition at line 219 of file 1D1DFunction.C.

References QUESO::Base1D1DFunction::m_maxDomainValue, QUESO::Base1D1DFunction::m_minDomainValue, m_rateValue, m_referenceDomainValue, m_referenceImageValue, UQ_FATAL_TEST_MACRO, and QUESO::UQ_UNAVAILABLE_RANK.

220 {
221  if ((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)) {
222  std::cerr << "In Linear1D1DFunction::value()"
223  << ": requested x (" << domainValue
224  << ") is out of the interval (" << m_minDomainValue
225  << ", " << m_maxDomainValue
226  << ")"
227  << std::endl;
228  }
229 
230  UQ_FATAL_TEST_MACRO(((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)),
232  "Linear1D1DFunction::value()",
233  "x out of range");
234 
235  double imageValue = m_referenceImageValue + m_rateValue*(domainValue - m_referenceDomainValue);
236 
237  return imageValue;
238 }
const int UQ_UNAVAILABLE_RANK
Definition: Defines.h:74
double m_referenceDomainValue
Reference value in the function domain; in .
Definition: 1D1DFunction.h:220
double m_rateValue
Rate value; in .
Definition: 1D1DFunction.h:226
double m_referenceImageValue
Reference value in the function image; in .
Definition: 1D1DFunction.h:223
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223

Member Data Documentation

double QUESO::Linear1D1DFunction::m_rateValue
protected

Rate value; $ m$ in $f(x) = y_1 + m (x - x_1)$.

Definition at line 226 of file 1D1DFunction.h.

Referenced by deriv(), and value().

double QUESO::Linear1D1DFunction::m_referenceDomainValue
protected

Reference value in the function domain; $ x_1 $ in $ f(x) = y_1 + m (x - x_1)$.

Definition at line 220 of file 1D1DFunction.h.

Referenced by value().

double QUESO::Linear1D1DFunction::m_referenceImageValue
protected

Reference value in the function image; $ y_1 $ in $ f(x) = y_1 + m (x - x_1)$.

Definition at line 223 of file 1D1DFunction.h.

Referenced by value().


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

Generated on Thu Apr 23 2015 19:26:17 for queso-0.51.1 by  doxygen 1.8.5