queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::Linear1D1DFunction Class Reference

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

#include <1D1DFunction.h>

Inheritance diagram for QUESO::Linear1D1DFunction:
QUESO::Base1D1DFunction

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 182 of file 1D1DFunction.C.

188  :
190  m_referenceDomainValue (referenceDomainValue),
191  m_referenceImageValue (referenceImageValue),
192  m_rateValue (rateValue)
193 {
194 }
double maxDomainValue() const
Returns the maximum value of the domain of the (one-dimensional) function.
Definition: 1D1DFunction.C:54
double minDomainValue() const
Returns the minimum value of the domain of the (one-dimensional) function.
Definition: 1D1DFunction.C:48
double m_referenceImageValue
Reference value in the function image; in .
Definition: 1D1DFunction.h:223
double m_referenceDomainValue
Reference value in the function domain; in .
Definition: 1D1DFunction.h:220
Base1D1DFunction(double minDomainValue, double maxDomainValue)
Default constructor.
Definition: 1D1DFunction.C:33
double m_rateValue
Rate value; in .
Definition: 1D1DFunction.h:226
QUESO::Linear1D1DFunction::~Linear1D1DFunction ( )

Destructor.

Definition at line 196 of file 1D1DFunction.C.

197 {
198 }

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 220 of file 1D1DFunction.C.

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

221 {
222  if ((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)) {
223  std::cerr << "In Linear1D1DFunction::deriv()"
224  << ": requested x (" << domainValue
225  << ") is out of the interval (" << m_minDomainValue
226  << ", " << m_maxDomainValue
227  << ")"
228  << std::endl;
229  }
230 
231  queso_require_msg(!((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)), "x out of range");
232 
233  return m_rateValue;
234 }
double m_rateValue
Rate value; in .
Definition: 1D1DFunction.h:226
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 201 of file 1D1DFunction.C.

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

202 {
203  if ((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)) {
204  std::cerr << "In Linear1D1DFunction::value()"
205  << ": requested x (" << domainValue
206  << ") is out of the interval (" << m_minDomainValue
207  << ", " << m_maxDomainValue
208  << ")"
209  << std::endl;
210  }
211 
212  queso_require_msg(!((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)), "x out of range");
213 
214  double imageValue = m_referenceImageValue + m_rateValue*(domainValue - m_referenceDomainValue);
215 
216  return imageValue;
217 }
double m_referenceImageValue
Reference value in the function image; in .
Definition: 1D1DFunction.h:223
double m_referenceDomainValue
Reference value in the function domain; in .
Definition: 1D1DFunction.h:220
double m_rateValue
Rate value; in .
Definition: 1D1DFunction.h:226

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 Tue Jun 5 2018 19:49:16 for queso-0.57.1 by  doxygen 1.8.5