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

Base class for accommodating one-dimensional grids. More...

#include <OneDGrid.h>

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

Public Member Functions

Constructor/Destructor methods
 BaseOneDGrid (const BaseEnvironment &env, const char *prefix)
 Default constructor. More...
 
virtual ~BaseOneDGrid ()
 Virtual destructor. More...
 
Accessor methods
virtual T operator[] (unsigned int i) const =0
 Returns the position of the i-th point in the grid. See template specialization. More...
 
Mathematical methods
virtual unsigned int size () const =0
 Grid size; the amount of points which defines the grid. See template specialization. More...
 
virtual unsigned int findIntervalId (const T &paramValue) const =0
 Finds the ID of an interval. See template specialization. More...
 

Protected Attributes

const BaseEnvironmentm_env
 
std::string m_prefix
 

I/O methods

void print (std::ostream &ofsvar) const
 Prints the values of the grid points. More...
 
std::ostream & operator<< (std::ostream &os, const BaseOneDGrid< T > &obj)
 

Detailed Description

template<class T>
class QUESO::BaseOneDGrid< T >

Base class for accommodating one-dimensional grids.

Definition at line 46 of file OneDGrid.h.

Constructor & Destructor Documentation

template<class T >
QUESO::BaseOneDGrid< T >::BaseOneDGrid ( const BaseEnvironment env,
const char *  prefix 
)

Default constructor.

Definition at line 30 of file OneDGrid.C.

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

33  :
34  m_env (env),
35  m_prefix((std::string)(prefix)+"grid")
36 {
37  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
38  *m_env.subDisplayFile() << "Entering BaseOneDGrid<T>::constructor()"
39  << ": prefix = " << m_prefix
40  << std::endl;
41  }
42 
43  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
44  *m_env.subDisplayFile() << "Leaving BaseOneDGrid<T>::constructor()"
45  << ": prefix = " << m_prefix
46  << std::endl;
47  }
48 }
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::BaseOneDGrid< T >::~BaseOneDGrid ( )
virtual

Virtual destructor.

Definition at line 51 of file OneDGrid.C.

52 {
53 }

Member Function Documentation

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

Finds the ID of an interval. See template specialization.

Implemented in QUESO::StdOneDGrid< T >, and QUESO::UniformOneDGrid< T >.

template<class T>
virtual T QUESO::BaseOneDGrid< T >::operator[] ( unsigned int  i) const
pure virtual

Returns the position of the i-th point in the grid. See template specialization.

Implemented in QUESO::StdOneDGrid< T >, and QUESO::UniformOneDGrid< T >.

template<class T >
void QUESO::BaseOneDGrid< T >::print ( std::ostream &  ofsvar) const

Prints the values of the grid points.

Definition at line 57 of file OneDGrid.C.

References QUESO::size.

58 {
59  // Print values *of* grid points
60  os << m_prefix << "_sub" << m_env.subIdString() << " = zeros(" << this->size()
61  << "," << 1
62  << ");"
63  << std::endl;
64  os << m_prefix << "_sub" << m_env.subIdString() << " = [";
65  for (unsigned int j = 0; j < this->size(); ++j) {
66  os << (*this)[j] << " ";
67  }
68  os << "];"
69  << std::endl;
70 
71  return;
72 }
std::string m_prefix
Definition: OneDGrid.h:83
const BaseEnvironment & m_env
Definition: OneDGrid.h:82
virtual unsigned int size() const =0
Grid size; the amount of points which defines the grid. See template specialization.
const std::string & subIdString() const
Access to the attribute m_subIdString; which stores the string for the sub-environment, and it will be used, for instance, to create the output files for each sub-environment.
Definition: Environment.C:348
template<class T>
virtual unsigned int QUESO::BaseOneDGrid< T >::size ( ) const
pure virtual

Grid size; the amount of points which defines the grid. See template specialization.

Implemented in QUESO::StdOneDGrid< T >, and QUESO::UniformOneDGrid< T >.

Friends And Related Function Documentation

template<class T>
std::ostream& operator<< ( std::ostream &  os,
const BaseOneDGrid< T > &  obj 
)
friend

Definition at line 73 of file OneDGrid.h.

75  {
76  obj.print(os);
77  return os;
78  }

Member Data Documentation

template<class T>
std::string QUESO::BaseOneDGrid< T >::m_prefix
protected

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

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