queso-0.53.0
OneDGrid.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2015 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef UQ_ONE_D_GRID_FUNCTION_H
26 #define UQ_ONE_D_GRID_FUNCTION_H
27 
28 #include <queso/Environment.h>
29 #include <math.h>
30 
31 namespace QUESO {
32 
33 //*****************************************************
34 // Classes to accommodate a one dimensional grid
35 //*****************************************************
42 //*****************************************************
43 // Base class
44 //*****************************************************
45 template<class T>
46 class BaseOneDGrid {
47 public:
49 
50  BaseOneDGrid(const BaseEnvironment& env,
52  const char* prefix);
54  virtual ~BaseOneDGrid();
56 
58  virtual T operator[] (unsigned int i) const = 0;
61 
63  virtual unsigned int size () const = 0;
65 
67  virtual unsigned int findIntervalId(const T& paramValue) const = 0;
69 
71  void print (std::ostream& ofsvar) const;
73  friend std::ostream& operator<< (std::ostream& os,
74  const BaseOneDGrid<T>& obj)
75  {
76  obj.print(os);
77  return os;
78  }
80 
81 protected:
83  std::string m_prefix;
84 };
85 
86 } // End namespace QUESO
87 
88 #endif // UQ_ONE_D_GRID_FUNCTION_H
std::string m_prefix
Definition: OneDGrid.h:83
BaseOneDGrid(const BaseEnvironment &env, const char *prefix)
Default constructor.
Definition: OneDGrid.C:30
virtual ~BaseOneDGrid()
Virtual destructor.
Definition: OneDGrid.C:51
virtual unsigned int size() const =0
Grid size; the amount of points which defines the grid. See template specialization.
friend std::ostream & operator<<(std::ostream &os, const BaseOneDGrid< T > &obj)
Definition: OneDGrid.h:73
virtual T operator[](unsigned int i) const =0
Returns the position of the i-th point in the grid. See template specialization.
const BaseEnvironment & m_env
Definition: OneDGrid.h:82
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:193
void print(std::ostream &ofsvar) const
Prints the values of the grid points.
Definition: OneDGrid.C:57
Base class for accommodating one-dimensional grids.
Definition: OneDGrid.h:46
virtual unsigned int findIntervalId(const T &paramValue) const =0
Finds the ID of an interval. See template specialization.

Generated on Thu Jun 11 2015 13:52:32 for queso-0.53.0 by  doxygen 1.8.5