queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::BoxSubset< V, M > Class Template Reference

Class representing a subset of a vector space shaped like a hypercube. More...

#include <BoxSubset.h>

Inheritance diagram for QUESO::BoxSubset< V, M >:
QUESO::VectorSubset< V, M > QUESO::VectorSet< V, M >

Public Member Functions

void print (std::ostream &os) const
 Prints the volume, the minimum and the maximum values of this. More...
 
Constructor/Destructor methods
 BoxSubset (const char *prefix, const VectorSpace< V, M > &vectorSpace, const V &minValues, const V &maxValues)
 Shaped, default constructor. More...
 
 ~BoxSubset ()
 Destructor. More...
 
Mathematical methods.
bool contains (const V &vec) const
 Checks whether this box subset contains vector vec. More...
 
void centroid (V &vec) const
 Returns the centroid of this box subset in the vector vec. More...
 
void moments (M &mat) const
 Returns the moments of inertia of this box subset in the matrix mat. More...
 
const V & minValues () const
 Vector of the minimum values of the box subset. More...
 
const V & maxValues () const
 Vector of the maximum values of the box subset. More...
 
- Public Member Functions inherited from QUESO::VectorSubset< V, M >
 VectorSubset ()
 Default Constructor. More...
 
 VectorSubset (const char *prefix, const VectorSpace< V, M > &vectorSpace, double volume)
 Shaped constructor (with volume). More...
 
virtual ~VectorSubset ()
 Destructor. More...
 
const VectorSpace< V, M > & vectorSpace () const
 Vector space to which this set belongs to. See template specialization. More...
 
- Public Member Functions inherited from QUESO::VectorSet< V, M >
 VectorSet (const BaseEnvironment &env, const char *prefix, double volume)
 Shaped constructor. More...
 
virtual ~VectorSet ()
 Virtual destructor. More...
 
const BaseEnvironmentenv () const
 Environment. Access to private attribute m_env. More...
 
const std::string & prefix () const
 Access to private attribute m_prefix. More...
 
double volume () const
 Set volume; access to private attribute m_volume. More...
 

Protected Attributes

m_minValues
 Vector of templated type V to store the minimum values of the box subset class. More...
 
m_maxValues
 Vector of templated type V to store the maximum values of the box subset class. More...
 
- Protected Attributes inherited from QUESO::VectorSubset< V, M >
const VectorSpace< V, M > * m_vectorSpace
 
- Protected Attributes inherited from QUESO::VectorSet< V, M >
const BaseEnvironmentm_env
 
std::string m_prefix
 
double m_volume
 

Detailed Description

template<class V = GslVector, class M = GslMatrix>
class QUESO::BoxSubset< V, M >

Class representing a subset of a vector space shaped like a hypercube.

This class is determined by a collection of upper and lower limits of the hypercube. (line segment in \( R \), rectangle in \( R^2 \), and so on).

Definition at line 44 of file BoxSubset.h.

Constructor & Destructor Documentation

template<class V, class M>
QUESO::BoxSubset< V, M >::BoxSubset ( const char *  prefix,
const VectorSpace< V, M > &  vectorSpace,
const V &  minValues,
const V &  maxValues 
)

Shaped, default constructor.

Construct a subspace of vectorSpace, with min and max values given by the vectors minValues and maxValues, respectively. It checks for possible inconsistencies between the values stored in minValues and maxValues, and calculates the volume of the box subset, assigning it to m_volume.

Definition at line 34 of file BoxSubset.C.

References QUESO::VectorSpace< V, M >::dimLocal(), QUESO::BoxSubset< V, M >::m_maxValues, QUESO::BoxSubset< V, M >::m_minValues, QUESO::VectorSubset< V, M >::m_vectorSpace, QUESO::VectorSet< V, M >::m_volume, and QUESO::queso_require_equal_to_msg.

38  : VectorSubset<V,M>(prefix,vectorSpace,0.),
41 {
42  queso_require_equal_to_msg(minValues.sizeLocal(), maxValues.sizeLocal(), "vectors 'minValues' and 'maxValues' should have the same size");
43  queso_require_equal_to_msg(minValues.sizeLocal(), vectorSpace.dimLocal(), "sizes of vectors 'minValues' and 'maxValues' should be equal to dimension of the vector space");
44  for (unsigned int i = 0; i < m_vectorSpace->dimLocal(); ++i) {
45  queso_require_less_equal_msg(minValues[i], maxValues[i], "it should happen minValue <= maxValue for all dimensions");
46  }
47 
48  m_volume = 1.;
49  for (unsigned int i = 0; i < m_vectorSpace->dimLocal(); ++i) {
50  m_volume *= (m_maxValues[i] - m_minValues[i]);
51  }
52 }
const std::string & prefix() const
Access to private attribute m_prefix.
Definition: VectorSet.C:84
const VectorSpace< V, M > * m_vectorSpace
Definition: VectorSubset.h:81
const V & minValues() const
Vector of the minimum values of the box subset.
Definition: BoxSubset.C:95
V m_minValues
Vector of templated type V to store the minimum values of the box subset class.
Definition: BoxSubset.h:92
V m_maxValues
Vector of templated type V to store the maximum values of the box subset class.
Definition: BoxSubset.h:95
MonteCarloSGOptions::MonteCarloSGOptions(const BaseEnvironment &env, const char *prefix, const McOptionsValues &alternativeOptionsValues queso_require_equal_to_msg)(m_env.optionsInputFileName(), std::string(""), std::string("this constructor is incompatible with the existence of an options input file"))
const V & maxValues() const
Vector of the maximum values of the box subset.
Definition: BoxSubset.C:101
const VectorSpace< V, M > & vectorSpace() const
Vector space to which this set belongs to. See template specialization.
Definition: VectorSubset.C:68
template<class V , class M >
QUESO::BoxSubset< V, M >::~BoxSubset ( )

Destructor.

Definition at line 56 of file BoxSubset.C.

57 {
58 }

Member Function Documentation

template<class V, class M >
void QUESO::BoxSubset< V, M >::centroid ( V &  vec) const
virtual

Returns the centroid of this box subset in the vector vec.

Implements QUESO::VectorSet< V, M >.

Definition at line 73 of file BoxSubset.C.

74 {
75  vec = m_minValues;
76  vec += m_maxValues;
77  vec *= 0.5;
78 }
V m_minValues
Vector of templated type V to store the minimum values of the box subset class.
Definition: BoxSubset.h:92
V m_maxValues
Vector of templated type V to store the maximum values of the box subset class.
Definition: BoxSubset.h:95
template<class V, class M >
bool QUESO::BoxSubset< V, M >::contains ( const V &  vec) const
virtual

Checks whether this box subset contains vector vec.

It checks if both statements are true: 1) all components in vec are larger than m_minValues, and 2) all all components in vec are smaller than m_maxValues.

Implements QUESO::VectorSubset< V, M >.

Definition at line 62 of file BoxSubset.C.

63 {
64  // prudenci, 2012-09-26: allow boundary values because of 'beta' realizer, which can generate a sample with boundary value '1'
65  //return (!vec.atLeastOneComponentSmallerOrEqualThan(m_minValues) &&
66  // !vec.atLeastOneComponentBiggerOrEqualThan (m_maxValues));
67  return (!vec.atLeastOneComponentSmallerThan(m_minValues) &&
68  !vec.atLeastOneComponentBiggerThan (m_maxValues));
69 }
V m_minValues
Vector of templated type V to store the minimum values of the box subset class.
Definition: BoxSubset.h:92
V m_maxValues
Vector of templated type V to store the maximum values of the box subset class.
Definition: BoxSubset.h:95
template<class V , class M>
void QUESO::BoxSubset< V, M >::moments ( M &  mat) const
virtual

Returns the moments of inertia of this box subset in the matrix mat.

Implements QUESO::VectorSet< V, M >.

Definition at line 83 of file BoxSubset.C.

84 {
85  mat.zeroLower();
86  mat.zeroUpper();
87  for (unsigned int i = 0; i < m_vectorSpace->dimLocal(); ++i) {
88  double length_i = (m_maxValues[i] - m_minValues[i]);
89  mat(i,i) = length_i*length_i*length_i/12;
90  }
91 }
const VectorSpace< V, M > * m_vectorSpace
Definition: VectorSubset.h:81
V m_minValues
Vector of templated type V to store the minimum values of the box subset class.
Definition: BoxSubset.h:92
V m_maxValues
Vector of templated type V to store the maximum values of the box subset class.
Definition: BoxSubset.h:95
template<class V , class M >
void QUESO::BoxSubset< V, M >::print ( std::ostream &  os) const
virtual

Prints the volume, the minimum and the maximum values of this.

Reimplemented from QUESO::VectorSubset< V, M >.

Definition at line 108 of file BoxSubset.C.

109 {
110  os << "In BoxSubset<V,M>::print()"
111  << ": m_minValues = " << m_minValues
112  << ", m_maxValues = " << m_maxValues
113  << ", m_volume = " << m_volume
114  << std::endl;
115 
116  return;
117 }
V m_minValues
Vector of templated type V to store the minimum values of the box subset class.
Definition: BoxSubset.h:92
V m_maxValues
Vector of templated type V to store the maximum values of the box subset class.
Definition: BoxSubset.h:95

Member Data Documentation

template<class V = GslVector, class M = GslMatrix>
V QUESO::BoxSubset< V, M >::m_maxValues
protected

Vector of templated type V to store the maximum values of the box subset class.

Definition at line 95 of file BoxSubset.h.

Referenced by QUESO::BoxSubset< V, M >::BoxSubset().

template<class V = GslVector, class M = GslMatrix>
V QUESO::BoxSubset< V, M >::m_minValues
protected

Vector of templated type V to store the minimum values of the box subset class.

Definition at line 92 of file BoxSubset.h.

Referenced by QUESO::BoxSubset< V, M >::BoxSubset().


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

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