queso-0.51.1
Protected Attributes | List of all members
QUESO::StdOneDGrid< T > Class Template Reference

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

#include <StdOneDGrid.h>

Inheritance diagram for QUESO::StdOneDGrid< T >:
Inheritance graph
[legend]
Collaboration diagram for QUESO::StdOneDGrid< T >:
Collaboration graph
[legend]

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::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:305
std::vector< T > m_points
Definition: StdOneDGrid.h:76
unsigned int displayVerbosity() const
Definition: Environment.C:436
std::string m_prefix
Definition: OneDGrid.h:83
const BaseEnvironment & m_env
Definition: OneDGrid.h:82
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 77 of file StdOneDGrid.C.

References UQ_FATAL_TEST_MACRO.

78 {
79  UQ_FATAL_TEST_MACRO((paramValue < m_points[0]) || (m_points[m_points.size()-1] < paramValue),
80  m_env.worldRank(),
81  "StdOneDGrid<V,M>::findIntervalId[]",
82  "paramValue is out of domain");
83 
84  unsigned int iMax = m_points.size();
85  unsigned int i = 1; // Yes, '1'
86  for (i = 1; i < iMax; ++i) { // Yes, '1'
87  if (paramValue < m_points[i]) {
88  i--;
89  break;
90  }
91  }
92 
93  return i;
94 }
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
std::vector< T > m_points
Definition: StdOneDGrid.h:76
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
const BaseEnvironment & m_env
Definition: OneDGrid.h:82
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.

References UQ_FATAL_TEST_MACRO.

66 {
67  UQ_FATAL_TEST_MACRO(i >= m_points.size(),
68  m_env.worldRank(),
69  "StdOneDGrid<V,M>::operator[]",
70  "too large i");
71 
72  return m_points[i];
73 }
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
std::vector< T > m_points
Definition: StdOneDGrid.h:76
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
const BaseEnvironment & m_env
Definition: OneDGrid.h:82
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 Thu Apr 23 2015 19:26:17 for queso-0.51.1 by  doxygen 1.8.5