SG++
sgpp::base::BoundingBox Class Reference

This class implements the boundaries of the sparse grid. More...

#include <BoundingBox.hpp>

Inheritance diagram for sgpp::base::BoundingBox:

## Public Member Functions

BoundingBox (size_t dimension)
Constructor for BoundingBox. More...

BoundingBox (const std::vector< BoundingBox1D > &boundingBox1Ds)
Constructor for BoundingBox. More...

const BoundingBox1DgetBoundary (size_t d) const
Returns the left and right boundary for a specific dimension. More...

size_t getDimension () const
Returns the number of dimensions of this bounding box. More...

double getIntervalOffset (size_t d) const
Returns the offset in positive x-direction of the interval in one dimension. More...

double getIntervalWidth (size_t d) const
Calculates the width of the interval in one dimension. More...

bool hasDirichletBoundaryLeft (size_t d) const
Determines if the interval in the specified dimension has left Dirichlet boundary conditions. More...

bool hasDirichletBoundaryRight (size_t d) const
Determines if the interval in the specified dimension has right Dirichlet boundary conditions. More...

bool isContainingPoint (DataVector &point) const
Check whether the BoundingBox contains a given point. More...

bool isContainingPoint (size_t d, double point) const
Check whether the BoundingBox contains a given point in a specific dimension. More...

bool isUnitCube () const
Determine if this bounding box describes the unit cube $$[0, 1]^d$$. More...

virtual std::string serialize (int version=SERIALIZATION_VERSION) const
Serialize the BoundingBox into a string. More...

virtual void serialize (std::ostream &ostream, int version=SERIALIZATION_VERSION) const
Serialize the BoundingBox into a stream. More...

void setBoundary (size_t d, const BoundingBox1D &boundingBox1D)
Sets left and right boundary for a specific dimension. More...

void toString (std::string &text) const
Converts the BoundingBox to a string. More...

std::string toString () const
Converts the BoundingBox to a string. More...

void transformPointToBoundingBox (DataVector &point) const
Transform a point in the unit cube $$[0, 1]^d$$ to a point in the BoundingBox. More...

double transformPointToBoundingBox (size_t d, double point) const
Transform a point in the unit interval $$[0, 1]$$ to a point in the BoundingBox in 1D. More...

void transformPointToUnitCube (DataVector &point) const
Transform a point in the BoundingBox to a point in the unit cube $$[0, 1]^d$$. More...

double transformPointToUnitCube (size_t d, double point) const
Transform a point in the BoundingBox to a point in the unit interval $$[0, 1]$$ in 1D. More...

virtual void unserialize (const std::string &istr, int version)
Unserialize from a string. More...

virtual void unserialize (std::istream &istr, int version)
Unserialize from a stream. More...

virtual ~BoundingBox ()
Destructor. More...

## Protected Attributes

std::vector< BoundingBox1DboundingBox1Ds
Array that contains all left boundaries for all dimensions. More...

size_t dimension
the number of dimensions used with the grid More...

## Detailed Description

This class implements the boundaries of the sparse grid.

Internally the grid is set up on a trivial cube.

This class gives the class gives the opportunity to stretch this cube in every dimension separately.

## Constructor & Destructor Documentation

 sgpp::base::BoundingBox::BoundingBox ( size_t dimension )
explicit

Constructor for BoundingBox.

initializes the Bounding with a N-d trivial cube

Parameters
 dimension number of the dimensions used with the grid
 sgpp::base::BoundingBox::BoundingBox ( const std::vector< BoundingBox1D > & boundingBox1Ds )
explicit

Constructor for BoundingBox.

initializes the Bounding with specific values for all dimensions

Parameters
 boundingBox1Ds array that contains all boundaries
 sgpp::base::BoundingBox::~BoundingBox ( )
virtual

Destructor.

## Member Function Documentation

 const BoundingBox1D& sgpp::base::BoundingBox::getBoundary ( size_t d ) const
inline

Returns the left and right boundary for a specific dimension.

Parameters
 d the dimension in which the boundary should be read
Returns
a BoundingBox1D object that contains the boundaries
 size_t sgpp::base::BoundingBox::getDimension ( ) const

Returns the number of dimensions of this bounding box.

Returns
number of dimensions

References dimension.

 double sgpp::base::BoundingBox::getIntervalOffset ( size_t d ) const
inline

Returns the offset in positive x-direction of the interval in one dimension.

Parameters
 d dimension in which the offset of the interval should be determined
Returns
offset in positive x-direction of the interval
 bool sgpp::base::BoundingBox::hasDirichletBoundaryLeft ( size_t d ) const

Determines if the interval in the specified dimension has left Dirichlet boundary conditions.

Parameters
 d the dimension for which the left boundary condition should be determined
Returns
true if Dirichlet Boundary conditions, otherwise false

References boundingBox1Ds.

 bool sgpp::base::BoundingBox::hasDirichletBoundaryRight ( size_t d ) const

Determines if the interval in the specified dimension has right Dirichlet boundary conditions.

Parameters
 d the dimension for which the right boundary condition should be determined
Returns
true if Dirichlet Boundary conditions, otherwise false

References boundingBox1Ds.

 bool sgpp::base::BoundingBox::isContainingPoint ( DataVector & point ) const
inline

Check whether the BoundingBox contains a given point.

Parameters
 point point to be checked
Returns
whether the point is contained in the BoundingBox
 bool sgpp::base::BoundingBox::isContainingPoint ( size_t d, double point ) const
inline

Check whether the BoundingBox contains a given point in a specific dimension.

Parameters
 d dimension to be checked point 1D point to be checked
Returns
whether the point is contained in the BoundingBox in the given dimension

References sgpp::base::BoundingBox1D::leftBoundary, and SERIALIZATION_VERSION.

 bool sgpp::base::BoundingBox::isUnitCube ( ) const

Determine if this bounding box describes the unit cube $$[0, 1]^d$$.

Returns
true if this bounding box is the unit cube, otherwise false

References boundingBox1Ds, and dimension.

 std::string sgpp::base::BoundingBox::serialize ( int version = SERIALIZATION_VERSION ) const
virtual

Serialize the BoundingBox into a string.

Parameters
 version the serialization version of the file
Returns
string that contains all BoundingBox information

Reimplemented in sgpp::base::Stretching.

 void sgpp::base::BoundingBox::serialize ( std::ostream & ostream, int version = SERIALIZATION_VERSION ) const
virtual

Serialize the BoundingBox into a stream.

Parameters
 ostream reference to a stream into that all BoundingBox information is written version the serialization version of the file

Reimplemented in sgpp::base::Stretching.

 void sgpp::base::BoundingBox::setBoundary ( size_t d, const BoundingBox1D & boundingBox1D )

Sets left and right boundary for a specific dimension.

Parameters
 d the dimension in which the boundary should be changed boundingBox1D reference to a BoundingBox1D object that contains the new boundaries

References boundingBox1Ds.

 void sgpp::base::BoundingBox::toString ( std::string & text ) const

Converts the BoundingBox to a string.

Parameters
 text string to which the data is written

References boundingBox1Ds, and dimension.

 std::string sgpp::base::BoundingBox::toString ( ) const

Converts the BoundingBox to a string.

Returns
string to which the data is written
 void sgpp::base::BoundingBox::transformPointToBoundingBox ( DataVector & point ) const
inline

Transform a point in the unit cube $$[0, 1]^d$$ to a point in the BoundingBox.

Parameters
 [in,out] point point to be transformed in-place
 double sgpp::base::BoundingBox::transformPointToBoundingBox ( size_t d, double point ) const
inline

Transform a point in the unit interval $$[0, 1]$$ to a point in the BoundingBox in 1D.

Parameters
 d dimension point 1D point in unit interval
Returns
transformed 1D point in the BoundingBox
 double sgpp::base::BoundingBox::transformPointToUnitCube ( size_t d, double point ) const
inline

Transform a point in the BoundingBox to a point in the unit interval $$[0, 1]$$ in 1D.

Parameters
 d dimension point 1D point in the BoundingBox
Returns
transformed 1D point in the unit interval
 void sgpp::base::BoundingBox::unserialize ( const std::string & istr, int version )
virtual

Unserialize from a string.

Parameters
 istr string which contains a serialized BoundingBox version the serialization version of the file
 void sgpp::base::BoundingBox::unserialize ( std::istream & istr, int version )
virtual

Unserialize from a stream.

Parameters
 istr stream which contains a serialized BoundingBox version the serialization version of the file

## Member Data Documentation

 std::vector sgpp::base::BoundingBox::boundingBox1Ds
protected

Array that contains all left boundaries for all dimensions.

 size_t sgpp::base::BoundingBox::dimension
protected

the number of dimensions used with the grid

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