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

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

#include <1D1DFunction.h>

Inheritance diagram for QUESO::Quadratic1D1DFunction:
QUESO::Base1D1DFunction

Public Member Functions

Constructor/Destructor methods
 Quadratic1D1DFunction (double minDomainValue, double maxDomainValue, double a, double b, double c)
 Default constructor. More...
 
 ~Quadratic1D1DFunction ()
 Destructor. More...
 
Mathematical methods
double value (double domainValue) const
 Returns the value of the quadratic function at point domainValue. More...
 
double deriv (double domainValue) const
 Returns the value of the derivative of the quadratic 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_a
 'Quadratic' coefficient of the quadratic function; \( a \) in \( f(x)=ax^2+bx+c \). More...
 
double m_b
 'Linear' coefficient of the quadratic function; \( b \) in \( f(x)=ax^2+bx+c \). More...
 
double m_c
 'Free' coefficient of the quadratic function; \( c \) in \( f(x)=ax^2+bx+c \). More...
 
- Protected Attributes inherited from QUESO::Base1D1DFunction
double m_minDomainValue
 
double m_maxDomainValue
 

Detailed Description

Class for one-dimensional quadratic functions.

This class implements quadratic one-dimensional functions. A quadratic function, in mathematics, is a polynomial function of the form

\[ f(x)=ax^2+bx+c,\quad a \ne 0.\]

The graph of a quadratic function is a parabola whose axis of symmetry is parallel to the y-axis.

Definition at line 292 of file 1D1DFunction.h.

Constructor & Destructor Documentation

QUESO::Quadratic1D1DFunction::Quadratic1D1DFunction ( double  minDomainValue,
double  maxDomainValue,
double  a,
double  b,
double  c 
)

Default constructor.

Constructs a quadratic function in the interval [minDomainValue,maxDomainValue], of the type: \( f(x)=ax^2+bx+c \).

Definition at line 370 of file 1D1DFunction.C.

376  :
378  m_a (a),
379  m_b (b),
380  m_c (c)
381 {
382 }
double m_b
&#39;Linear&#39; coefficient of the quadratic function; in .
Definition: 1D1DFunction.h:329
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
Base1D1DFunction(double minDomainValue, double maxDomainValue)
Default constructor.
Definition: 1D1DFunction.C:33
double m_c
&#39;Free&#39; coefficient of the quadratic function; in .
Definition: 1D1DFunction.h:332
double m_a
&#39;Quadratic&#39; coefficient of the quadratic function; in .
Definition: 1D1DFunction.h:326
QUESO::Quadratic1D1DFunction::~Quadratic1D1DFunction ( )

Destructor.

Definition at line 384 of file 1D1DFunction.C.

385 {
386 }

Member Function Documentation

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

Returns the value of the derivative of the quadratic 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 2*a*domainValue + b .

Implements QUESO::Base1D1DFunction.

Definition at line 408 of file 1D1DFunction.C.

References m_a, m_b, QUESO::Base1D1DFunction::m_maxDomainValue, and QUESO::Base1D1DFunction::m_minDomainValue.

409 {
410  if ((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)) {
411  std::cerr << "In Quadratic1D1DFunction::deriv()"
412  << ": requested x (" << domainValue
413  << ") is out of the interval (" << m_minDomainValue
414  << ", " << m_maxDomainValue
415  << ")"
416  << std::endl;
417  }
418 
419  queso_require_msg(!((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)), "x out of range");
420 
421  return 2.*m_a*domainValue + m_b;
422 }
double m_b
&#39;Linear&#39; coefficient of the quadratic function; in .
Definition: 1D1DFunction.h:329
double m_a
&#39;Quadratic&#39; coefficient of the quadratic function; in .
Definition: 1D1DFunction.h:326
double QUESO::Quadratic1D1DFunction::value ( double  domainValue) const
virtual

Returns the value of the quadratic 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, namely: imageValue = a*domainValue^2 + b*domainValue + c .

Implements QUESO::Base1D1DFunction.

Definition at line 389 of file 1D1DFunction.C.

References m_a, m_b, m_c, QUESO::Base1D1DFunction::m_maxDomainValue, and QUESO::Base1D1DFunction::m_minDomainValue.

390 {
391  if ((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)) {
392  std::cerr << "In Quadratic1D1DFunction::value()"
393  << ": requested x (" << domainValue
394  << ") is out of the interval (" << m_minDomainValue
395  << ", " << m_maxDomainValue
396  << ")"
397  << std::endl;
398  }
399 
400  queso_require_msg(!((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)), "x out of range");
401 
402  double imageValue = m_a*domainValue*domainValue + m_b*domainValue + m_c;
403 
404  return imageValue;
405 }
double m_b
&#39;Linear&#39; coefficient of the quadratic function; in .
Definition: 1D1DFunction.h:329
double m_c
&#39;Free&#39; coefficient of the quadratic function; in .
Definition: 1D1DFunction.h:332
double m_a
&#39;Quadratic&#39; coefficient of the quadratic function; in .
Definition: 1D1DFunction.h:326

Member Data Documentation

double QUESO::Quadratic1D1DFunction::m_a
protected

'Quadratic' coefficient of the quadratic function; \( a \) in \( f(x)=ax^2+bx+c \).

Definition at line 326 of file 1D1DFunction.h.

Referenced by deriv(), and value().

double QUESO::Quadratic1D1DFunction::m_b
protected

'Linear' coefficient of the quadratic function; \( b \) in \( f(x)=ax^2+bx+c \).

Definition at line 329 of file 1D1DFunction.h.

Referenced by deriv(), and value().

double QUESO::Quadratic1D1DFunction::m_c
protected

'Free' coefficient of the quadratic function; \( c \) in \( f(x)=ax^2+bx+c \).

Definition at line 332 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