queso-0.53.0
Public Member Functions | Protected Attributes | List of all members
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 >:
Inheritance graph
[legend]
Collaboration diagram for QUESO::BoxSubset< V, M >:
Collaboration graph
[legend]

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...
 
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, queso_require_equal_to_msg, and queso_require_less_equal_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 }
#define queso_require_less_equal_msg(expr1, expr2, msg)
Definition: asserts.h:89
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
const V & maxValues() const
Vector of the maximum values of the box subset.
Definition: BoxSubset.C:79
const V & minValues() const
Vector of the minimum values of the box subset.
Definition: BoxSubset.C:73
V m_minValues
Vector of templated type V to store the minimum values of the box subset class.
Definition: BoxSubset.h:86
const VectorSpace< V, M > * m_vectorSpace
Definition: VectorSubset.h:81
V m_maxValues
Vector of templated type V to store the maximum values of the box subset class.
Definition: BoxSubset.h:89
const VectorSpace< V, M > & vectorSpace() const
Vector space to which this set belongs to. See template specialization.
Definition: VectorSubset.C:68
const std::string & prefix() const
Access to private attribute m_prefix.
Definition: VectorSet.C:84
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 >
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:86
V m_maxValues
Vector of templated type V to store the maximum values of the box subset class.
Definition: BoxSubset.h:89
template<class V , class M >
const V & QUESO::BoxSubset< V, M >::maxValues ( ) const
template<class V , class M >
const V & QUESO::BoxSubset< V, M >::minValues ( ) const
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 86 of file BoxSubset.C.

87 {
88  os << "In BoxSubset<V,M>::print()"
89  << ": m_minValues = " << m_minValues
90  << ", m_maxValues = " << m_maxValues
91  << ", m_volume = " << m_volume
92  << std::endl;
93 
94  return;
95 }
V m_minValues
Vector of templated type V to store the minimum values of the box subset class.
Definition: BoxSubset.h:86
V m_maxValues
Vector of templated type V to store the maximum values of the box subset class.
Definition: BoxSubset.h:89

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 89 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 86 of file BoxSubset.h.

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


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

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