queso-0.53.0
InterpolationSurrogateData.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_INTERPOLATION_SURROGATE_DATA_H
26 #define UQ_INTERPOLATION_SURROGATE_DATA_H
27 
28 #include <queso/BoxSubset.h>
29 
30 namespace QUESO
31 {
32  class GslVector;
33  class GslMatrix;
34 
35  template<class V = GslVector, class M = GslMatrix>
36  class InterpolationSurrogateData
37  {
38  public:
39 
40  InterpolationSurrogateData( const BoxSubset<V,M>& domain,
41  const std::vector<unsigned int>& n_points );
42 
44 
46  { return this->m_domain; };
47 
48  const std::vector<unsigned int>& get_n_points() const
49  { return this->m_n_points; };
50 
51  const std::vector<double>& get_values() const
52  { return this->m_values; };
53 
54  std::vector<double>& get_values()
55  { return this->m_values; };
56 
57  double get_value( unsigned int n ) const
58  { queso_assert_less(n,this->m_values.size());
59  return this->m_values[n]; };
60 
61  unsigned int n_values() const
62  { return this->m_values.size(); };
63 
65 
67  void set_values( std::vector<double>& values );
68 
69  void set_value( unsigned int n, double value );
70 
72  unsigned int dim() const
73  { return this->m_domain.vectorSpace().dimGlobal(); };
74 
76  double x_min( unsigned int dim ) const
77  { return this->m_domain.minValues()[dim]; };
78 
80  double x_max( unsigned int dim ) const
81  { return this->m_domain.maxValues()[dim]; };
82 
84  double spacing( unsigned int dim ) const;
85 
87  double get_x( unsigned int dim, unsigned int index ) const;
88 
90 
94  void sync_values( unsigned int root );
95 
96  private:
97 
99 
101  void check_dim_consistency() const;
102 
104  void init_values( const std::vector<unsigned int>& n_points );
105 
108 
110 
112  const std::vector<unsigned int>& m_n_points;
113 
115 
120  std::vector<double> m_values;
121  };
122 
123 } // end namespace QUESO
124 
125 #endif // UQ_INTERPOLATION_SURROGATE_DATA_H
const BoxSubset< V, M > & get_paramDomain() const
void set_value(unsigned int n, double value)
unsigned int dim() const
Dimension of parameter space.
const std::vector< double > & get_values() const
double x_min(unsigned int dim) const
Lower bound of domain along dimension dim.
double get_value(unsigned int n) const
const std::vector< unsigned int > & get_n_points() const
double spacing(unsigned int dim) const
Spacing between points along dimension dim.
const BoxSubset< V, M > & m_domain
Parameter domain over which we use surrogate.
const std::vector< unsigned int > & m_n_points
vector to store number of points in each coordinate direction
double get_x(unsigned int dim, unsigned int index) const
Get spatial coordinate value at the node index along coordinate direction dim.
#define queso_assert_less(expr1, expr2)
Definition: asserts.h:155
Class representing a subset of a vector space shaped like a hypercube.
Definition: BoxSubset.h:44
void init_values(const std::vector< unsigned int > &n_points)
Helper function for sizing m_values.
void check_dim_consistency() const
Helper function for constructor.
double x_max(unsigned int dim) const
Upper bound of domain along dimension dim.
void set_values(std::vector< double > &values)
Set all values. Dimension must be consistent with internal m_values.
void sync_values(unsigned int root)
Sync values across all processors from root processor.
std::vector< double > m_values
vector to store values to be interpolated

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