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

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

#include <1D1DFunction.h>

Inheritance diagram for QUESO::Generic1D1DFunction:
QUESO::Base1D1DFunction

Public Member Functions

Constructor/Destructor methods
 Generic1D1DFunction (double minDomainValue, double maxDomainValue, double(*valueRoutinePtr)(double domainValue, const void *routinesDataPtr), double(*derivRoutinePtr)(double domainValue, const void *routinesDataPtr), const void *routinesDataPtr)
 Default constructor. More...
 
 ~Generic1D1DFunction ()
 Destructor. More...
 
Mathematical methods
double value (double domainValue) const
 Returns the value of the (one-dimensional) function at point domainValue. More...
 
double deriv (double domainValue) const
 Returns the value of the derivative of the 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_valueRoutinePtr )(double domainValue, const void *routinesDataPtr)
 
double(* m_derivRoutinePtr )(double domainValue, const void *routinesDataPtr)
 
const void * m_routinesDataPtr
 
- Protected Attributes inherited from QUESO::Base1D1DFunction
double m_minDomainValue
 
double m_maxDomainValue
 

Detailed Description

Class for generic one-dimensional functions.

This class implements generic one-dimensional functions.

Definition at line 97 of file 1D1DFunction.h.

Constructor & Destructor Documentation

QUESO::Generic1D1DFunction::Generic1D1DFunction ( double  minDomainValue,
double  maxDomainValue,
double(*)(double domainValue, const void *routinesDataPtr)  valueRoutinePtr,
double(*)(double domainValue, const void *routinesDataPtr)  derivRoutinePtr,
const void *  routinesDataPtr 
)

Default constructor.

Definition at line 76 of file 1D1DFunction.C.

82  :
84  m_valueRoutinePtr (valueRoutinePtr),
85  m_derivRoutinePtr (derivRoutinePtr),
86  m_routinesDataPtr (routinesDataPtr)
87 {
88 }
const void * m_routinesDataPtr
Definition: 1D1DFunction.h:129
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_derivRoutinePtr)(double domainValue, const void *routinesDataPtr)
Definition: 1D1DFunction.h:128
double(* m_valueRoutinePtr)(double domainValue, const void *routinesDataPtr)
Definition: 1D1DFunction.h:127
QUESO::Generic1D1DFunction::~Generic1D1DFunction ( )

Destructor.

Definition at line 90 of file 1D1DFunction.C.

91 {
92 }

Member Function Documentation

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

Returns the value of the derivative of the 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.

Implements QUESO::Base1D1DFunction.

Definition at line 112 of file 1D1DFunction.C.

References m_derivRoutinePtr, QUESO::Base1D1DFunction::m_maxDomainValue, QUESO::Base1D1DFunction::m_minDomainValue, and m_routinesDataPtr.

113 {
114  if ((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)) {
115  std::cerr << "In Generic1D1DFunction::deriv()"
116  << ": requested x (" << domainValue
117  << ") is out of the interval (" << m_minDomainValue
118  << ", " << m_maxDomainValue
119  << ")"
120  << std::endl;
121  }
122 
123  queso_require_msg(!((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)), "x out of range");
124 
125  return (*m_derivRoutinePtr)(domainValue,m_routinesDataPtr);
126 }
const void * m_routinesDataPtr
Definition: 1D1DFunction.h:129
double(* m_derivRoutinePtr)(double domainValue, const void *routinesDataPtr)
Definition: 1D1DFunction.h:128
double QUESO::Generic1D1DFunction::value ( double  domainValue) const
virtual

Returns the value of the (one-dimensional) 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 95 of file 1D1DFunction.C.

References QUESO::Base1D1DFunction::m_maxDomainValue, QUESO::Base1D1DFunction::m_minDomainValue, m_routinesDataPtr, and m_valueRoutinePtr.

96 {
97  if ((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)) {
98  std::cerr << "In Generic1D1DFunction::value()"
99  << ": requested x (" << domainValue
100  << ") is out of the interval (" << m_minDomainValue
101  << ", " << m_maxDomainValue
102  << ")"
103  << std::endl;
104  }
105 
106  queso_require_msg(!((domainValue < m_minDomainValue) || (domainValue > m_maxDomainValue)), "x out of range");
107 
108  return (*m_valueRoutinePtr)(domainValue,m_routinesDataPtr);
109 }
const void * m_routinesDataPtr
Definition: 1D1DFunction.h:129
double(* m_valueRoutinePtr)(double domainValue, const void *routinesDataPtr)
Definition: 1D1DFunction.h:127

Member Data Documentation

double(* QUESO::Generic1D1DFunction::m_derivRoutinePtr)(double domainValue, const void *routinesDataPtr)
protected

Definition at line 128 of file 1D1DFunction.h.

Referenced by deriv().

const void* QUESO::Generic1D1DFunction::m_routinesDataPtr
protected

Definition at line 129 of file 1D1DFunction.h.

Referenced by deriv(), and value().

double(* QUESO::Generic1D1DFunction::m_valueRoutinePtr)(double domainValue, const void *routinesDataPtr)
protected

Definition at line 127 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:15 for queso-0.57.1 by  doxygen 1.8.5