queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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-2017 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 
107  void check_domain_bounds() const;
108 
111 
113 
115  const std::vector<unsigned int>& m_n_points;
116 
118 
123  std::vector<double> m_values;
124  };
125 
126 } // end namespace QUESO
127 
128 #endif // UQ_INTERPOLATION_SURROGATE_DATA_H
const BoxSubset< V, M > & get_paramDomain() const
const std::vector< unsigned int > & m_n_points
vector to store number of points in each coordinate direction
double get_value(unsigned int n) const
const std::vector< unsigned int > & get_n_points() const
std::vector< double > m_values
vector to store values to be interpolated
double spacing(unsigned int dim) const
Spacing between points along dimension dim.
void set_value(unsigned int n, double value)
Class representing a subset of a vector space shaped like a hypercube.
Definition: BoxSubset.h:44
double x_max(unsigned int dim) const
Upper bound of domain along dimension dim.
void check_domain_bounds() const
Helper function for checking domain extent.
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.
const BoxSubset< V, M > & m_domain
Parameter domain over which we use surrogate.
double get_x(unsigned int dim, unsigned int index) const
Get spatial coordinate value at the node index along coordinate direction 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.
const std::vector< double > & get_values() const
unsigned int dim() const
Dimension of parameter space.
double x_min(unsigned int dim) const
Lower bound of domain along dimension dim.

Generated on Tue Jun 5 2018 19:48:56 for queso-0.57.1 by  doxygen 1.8.5