queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::StdOneDGrid< T > Class Template Reference

Class for accommodating standard one-dimensional grids. More...

#include <StdOneDGrid.h>

Inheritance diagram for QUESO::StdOneDGrid< T >:
QUESO::BaseOneDGrid< T >

Public Member Functions

Constructor/Destructor methods
 StdOneDGrid (const BaseEnvironment &env, const char *prefix, const std::vector< T > &points)
 Default constructor. More...
 
 ~StdOneDGrid ()
 Destructor. More...
 
Accessor methods
operator[] (unsigned int i) const
 Returns the position of the i-th point in the grid. More...
 
Mathematical methods
unsigned int size () const
 Grid size; the amount of points which defines the grid. More...
 
unsigned int findIntervalId (const T &paramValue) const
 Finds the ID of an interval. See template specialization. More...
 
- Public Member Functions inherited from QUESO::BaseOneDGrid< T >
 BaseOneDGrid (const BaseEnvironment &env, const char *prefix)
 Default constructor. More...
 
virtual ~BaseOneDGrid ()
 Virtual destructor. More...
 
void print (std::ostream &ofsvar) const
 Prints the values of the grid points. More...
 

Protected Attributes

std::vector< T > m_points
 
- Protected Attributes inherited from QUESO::BaseOneDGrid< T >
const BaseEnvironmentm_env
 
std::string m_prefix
 

Detailed Description

template<class T>
class QUESO::StdOneDGrid< T >

Class for accommodating standard one-dimensional grids.

This class implements a standard one-dimensional grid, which is required, for instance, in the evaluation of the cumulative distribution function (CDF) of a random variable.

Definition at line 45 of file StdOneDGrid.h.

Constructor & Destructor Documentation

template<class T >
QUESO::StdOneDGrid< T >::StdOneDGrid ( const BaseEnvironment env,
const char *  prefix,
const std::vector< T > &  points 
)

Default constructor.

Definition at line 30 of file StdOneDGrid.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::BaseOneDGrid< T >::m_env, QUESO::BaseOneDGrid< T >::m_prefix, and QUESO::BaseEnvironment::subDisplayFile().

34  :
35  BaseOneDGrid<T>(env,prefix),
36  m_points (points)
37 {
38  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
39  *m_env.subDisplayFile() << "Entering StdOneDGrid<T>::constructor()"
40  << ": prefix = " << m_prefix
41  << std::endl;
42  }
43 
44  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
45  *m_env.subDisplayFile() << "Leaving StdOneDGrid<T>::constructor()"
46  << ": prefix = " << m_prefix
47  << std::endl;
48  }
49 }
std::vector< T > m_points
Definition: StdOneDGrid.h:76
std::string m_prefix
Definition: OneDGrid.h:83
const BaseEnvironment & m_env
Definition: OneDGrid.h:82
unsigned int displayVerbosity() const
Definition: Environment.C:450
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
template<class T >
QUESO::StdOneDGrid< T >::~StdOneDGrid ( )

Destructor.

Definition at line 52 of file StdOneDGrid.C.

53 {
54 }

Member Function Documentation

template<class T >
unsigned int QUESO::StdOneDGrid< T >::findIntervalId ( const T &  paramValue) const
virtual

Finds the ID of an interval. See template specialization.

Implements QUESO::BaseOneDGrid< T >.

Definition at line 74 of file StdOneDGrid.C.

75 {
76  queso_require_msg(!((paramValue < m_points[0]) || (m_points[m_points.size()-1] < paramValue)), "paramValue is out of domain");
77 
78  unsigned int iMax = m_points.size();
79  unsigned int i = 1; // Yes, '1'
80  for (i = 1; i < iMax; ++i) { // Yes, '1'
81  if (paramValue < m_points[i]) {
82  i--;
83  break;
84  }
85  }
86 
87  return i;
88 }
std::vector< T > m_points
Definition: StdOneDGrid.h:76
template<class T >
T QUESO::StdOneDGrid< T >::operator[] ( unsigned int  i) const
virtual

Returns the position of the i-th point in the grid.

Implements QUESO::BaseOneDGrid< T >.

Definition at line 65 of file StdOneDGrid.C.

66 {
67  queso_require_less_msg(i, m_points.size(), "too large i");
68 
69  return m_points[i];
70 }
std::vector< T > m_points
Definition: StdOneDGrid.h:76
template<class T >
unsigned int QUESO::StdOneDGrid< T >::size ( ) const
virtual

Grid size; the amount of points which defines the grid.

Implements QUESO::BaseOneDGrid< T >.

Definition at line 58 of file StdOneDGrid.C.

59 {
60  return m_points.size();
61 }
std::vector< T > m_points
Definition: StdOneDGrid.h:76

Member Data Documentation

template<class T >
std::vector<T> QUESO::StdOneDGrid< T >::m_points
protected

Definition at line 76 of file StdOneDGrid.h.


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

Generated on Tue Jun 5 2018 19:49:21 for queso-0.57.1 by  doxygen 1.8.5