npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
npstat::BoxND< Numeric > Struct Template Reference

#include <BoxND.hh>

Inheritance diagram for npstat::BoxND< Numeric >:

Public Types

typedef Numeric value_type
 

Public Member Functions

 BoxND ()
 
 BoxND (const unsigned long dim)
 
 BoxND (const unsigned long dim, const Interval< Numeric > &v)
 
template<typename Num2 >
 BoxND (const std::vector< Num2 > &limits)
 
template<typename Num2 >
 BoxND (const BoxND< Num2 > &r)
 
template<typename Num2 >
BoxNDcopyFrom (const BoxND< Num2 > &r)
 
unsigned long dim () const
 
Numeric volume () const
 
template<typename Num2 >
bool isInsideLower (const Num2 *coord, unsigned long coordLen) const
 
template<typename Num2 >
bool isInsideUpper (const Num2 *coord, unsigned long coordLen) const
 
template<typename Num2 >
bool isInsideWithBounds (const Num2 *coord, unsigned long coordLen) const
 
template<typename Num2 >
bool isInside (const Num2 *coord, unsigned long coordLen) const
 
template<typename Num2 >
bool isInside (const Num2 *coord, unsigned long coordLen, const BoundaryInclusion *bi, unsigned long nBi) const
 
BoxNDoperator*= (double r)
 
BoxNDoperator/= (double r)
 
BoxNDoperator*= (const std::vector< double > &scales)
 
BoxNDoperator/= (const std::vector< double > &scales)
 
BoxNDexpand (double r)
 
BoxNDexpand (const std::vector< double > &scales)
 
BoxNDexpand (const double *scales, unsigned long lenScales)
 
template<typename Num2 >
BoxNDoperator+= (const std::vector< Num2 > &shifts)
 
template<typename Num2 >
BoxNDoperator-= (const std::vector< Num2 > &shifts)
 
template<typename Num2 >
BoxNDshift (const Num2 *shifts, unsigned long lenShifts)
 
BoxNDmoveToOrigin ()
 
Numeric overlapVolume (const BoxND &r) const
 
double overlapFraction (const BoxND &r) const
 
void getLowerCorner (Numeric *coord, unsigned long coordLen) const
 
std::vector< Numeric > lowerCorner () const
 
void getUpperCorner (Numeric *coord, unsigned long coordLen) const
 
std::vector< Numeric > upperCorner () const
 
void getLengths (Numeric *coord, unsigned long coordLen) const
 
std::vector< Numeric > lengths () const
 
void getMidpoint (Numeric *coord, unsigned long coordLen) const
 
std::vector< Numeric > midpoint () const
 
gs::ClassId classId () const
 
bool write (std::ostream &of) const
 

Static Public Member Functions

static BoxND unitBox (unsigned long ndim)
 
static BoxND sizeTwoBox (unsigned long ndim)
 
static BoxND allSpace (unsigned long ndim)
 
static const char * classname ()
 
static unsigned version ()
 
static void restore (const gs::ClassId &id, std::istream &in, BoxND *box)
 

Detailed Description

template<typename Numeric>
struct npstat::BoxND< Numeric >

Class to represent rectangles, boxes, and hyperboxes

Constructor & Destructor Documentation

◆ BoxND() [1/5]

template<typename Numeric >
npstat::BoxND< Numeric >::BoxND ( )
inline

Default constructor makes a 0-dimensional box

◆ BoxND() [2/5]

template<typename Numeric >
npstat::BoxND< Numeric >::BoxND ( const unsigned long  dim)
inlineexplicit

Interval in each dimension is made by its default constructor

◆ BoxND() [3/5]

template<typename Numeric >
npstat::BoxND< Numeric >::BoxND ( const unsigned long  dim,
const Interval< Numeric > &  v 
)
inline

Use the same interval in each dimension

◆ BoxND() [4/5]

template<typename Numeric >
template<typename Num2 >
npstat::BoxND< Numeric >::BoxND ( const std::vector< Num2 > &  limits)
explicit

Constructor where one of the limits will be 0 and the other will be generated from the given vector (which also determines the dimensionality)

◆ BoxND() [5/5]

template<typename Numeric >
template<typename Num2 >
npstat::BoxND< Numeric >::BoxND ( const BoxND< Num2 > &  r)
explicit

Converting constructor

Member Function Documentation

◆ allSpace()

template<typename Numeric >
static BoxND npstat::BoxND< Numeric >::allSpace ( unsigned long  ndim)
static

Box with all upper limits set to maximum possible Numeric number and with lower limits set to negative maximum (or to zero with unsigned types)

◆ classId()

template<typename Numeric >
gs::ClassId npstat::BoxND< Numeric >::classId ( ) const
inline

Methods related to I/O

◆ copyFrom()

template<typename Numeric >
template<typename Num2 >
BoxND& npstat::BoxND< Numeric >::copyFrom ( const BoxND< Num2 > &  r)

Get the data from a box of a different type. This method works essentially as a converting assignment operator.

◆ dim()

template<typename Numeric >
unsigned long npstat::BoxND< Numeric >::dim ( ) const
inline

Box dimensionality

◆ expand() [1/2]

template<typename Numeric >
BoxND& npstat::BoxND< Numeric >::expand ( const std::vector< double > &  scales)

Scaling of all limits in such a way that the midpoint remains unchanged, using a different scaling factor in each dimension

◆ expand() [2/2]

template<typename Numeric >
BoxND& npstat::BoxND< Numeric >::expand ( double  r)

Scaling of all limits by a constant in such a way that the midpoint remains unchanged

◆ getLengths()

template<typename Numeric >
void npstat::BoxND< Numeric >::getLengths ( Numeric *  coord,
unsigned long  coordLen 
) const

Get interval length in all dimensions

◆ getLowerCorner()

template<typename Numeric >
void npstat::BoxND< Numeric >::getLowerCorner ( Numeric *  coord,
unsigned long  coordLen 
) const

Get lower corner

◆ getMidpoint()

template<typename Numeric >
void npstat::BoxND< Numeric >::getMidpoint ( Numeric *  coord,
unsigned long  coordLen 
) const

Get midpoint

◆ getUpperCorner()

template<typename Numeric >
void npstat::BoxND< Numeric >::getUpperCorner ( Numeric *  coord,
unsigned long  coordLen 
) const

Get upper corner

◆ isInsideLower()

template<typename Numeric >
template<typename Num2 >
bool npstat::BoxND< Numeric >::isInsideLower ( const Num2 *  coord,
unsigned long  coordLen 
) const

This method return "true" if the corresponding function of the Interval returns "true" for every coordinate. There must be an automatic conversion from Num2 type into Numeric.

◆ moveToOrigin()

template<typename Numeric >
BoxND& npstat::BoxND< Numeric >::moveToOrigin ( )

Moving this object so that the midpoint is (0, 0, ..., 0)

◆ operator*=() [1/2]

template<typename Numeric >
BoxND& npstat::BoxND< Numeric >::operator*= ( const std::vector< double > &  scales)

Scaling by a different constant in each dimension

◆ operator*=() [2/2]

template<typename Numeric >
BoxND& npstat::BoxND< Numeric >::operator*= ( double  r)

Scaling of all limits by a constant

◆ operator+=()

template<typename Numeric >
template<typename Num2 >
BoxND& npstat::BoxND< Numeric >::operator+= ( const std::vector< Num2 > &  shifts)

Shifting this object

◆ overlapFraction()

template<typename Numeric >
double npstat::BoxND< Numeric >::overlapFraction ( const BoxND< Numeric > &  r) const

A faster way to calculate overlapVolume(r)/volume()

◆ overlapVolume()

template<typename Numeric >
Numeric npstat::BoxND< Numeric >::overlapVolume ( const BoxND< Numeric > &  r) const

Overlap volume with another box

◆ sizeTwoBox()

template<typename Numeric >
static BoxND npstat::BoxND< Numeric >::sizeTwoBox ( unsigned long  ndim)
static

Box with lower limit -1 and upper limit 1 in all coordinates. Note that this will produce nonsense in case the Numeric type is unsigned.

◆ unitBox()

template<typename Numeric >
static BoxND npstat::BoxND< Numeric >::unitBox ( unsigned long  ndim)
static

Box with lower limit 0 and upper limit 1 in all coordinates

◆ volume()

template<typename Numeric >
Numeric npstat::BoxND< Numeric >::volume ( ) const

Box volume


The documentation for this struct was generated from the following file: