CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions
npstat::BoxND< Numeric > Struct Template Reference

#include <BoxND.h>

Inheritance diagram for npstat::BoxND< Numeric >:

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)
 
template<typename Num2 >
BoxND< Numeric > & copyFrom (const BoxND< Num2 > &r)
 
unsigned long dim () const
 
BoxNDexpand (double r)
 
void getMidpoint (Numeric *coord, unsigned long coordLen) const
 
BoxNDmoveToOrigin ()
 
template<typename Num2 >
BoxND< Numeric > & operator+= (const std::vector< Num2 > &shifts)
 
template<typename Num2 >
BoxND< Numeric > & operator-= (const std::vector< Num2 > &shifts)
 
double overlapFraction (const BoxND &r) const
 
Numeric overlapVolume (const BoxND &r) const
 
template<typename Num2 >
BoxND< Numeric > & shift (const Num2 *shifts, const unsigned long shiftsLen)
 
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
 
BoxNDoperator*= (double r)
 
BoxNDoperator/= (double r)
 
BoxNDoperator*= (const std::vector< double > &scales)
 
BoxNDoperator/= (const std::vector< double > &scales)
 
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)
 
gs::ClassId classId () const
 
bool write (std::ostream &of) const
 

Static Public Member Functions

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

Detailed Description

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

Class to represent rectangles, boxes, and hyperboxes

Definition at line 24 of file BoxND.h.

Constructor & Destructor Documentation

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

Default constructor makes a 0-dimensional box

Definition at line 27 of file BoxND.h.

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

Interval in each dimension is made by its default constructor

Definition at line 30 of file BoxND.h.

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

Use the same interval in each dimension

Definition at line 34 of file BoxND.h.

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)

Definition at line 195 of file BoxND.h.

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

Converting constructor

Definition at line 179 of file BoxND.h.

Member Function Documentation

template<typename Numeric >
BoxND< Numeric > 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 (this will not work with unsigned long types)

Definition at line 494 of file BoxND.h.

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

Methods related to I/O

Definition at line 150 of file BoxND.h.

template<typename Numeric >
const char * npstat::BoxND< Numeric >::classname ( )
static

Definition at line 504 of file BoxND.h.

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.

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

Definition at line 215 of file BoxND.h.

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

Box dimensionality

Definition at line 57 of file BoxND.h.

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

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

Definition at line 363 of file BoxND.h.

template<typename Numeric >
BoxND< Numeric > & 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

Definition at line 385 of file BoxND.h.

template<typename Numeric >
BoxND< Numeric > & npstat::BoxND< Numeric >::expand ( const double *  scales,
unsigned long  lenScales 
)

Definition at line 397 of file BoxND.h.

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

Midpoint for every coordinate. The size of the "coord" array should be at least as large as the box dimensionality.

Definition at line 271 of file BoxND.h.

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

Definition at line 332 of file BoxND.h.

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.

Definition at line 287 of file BoxND.h.

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

Definition at line 302 of file BoxND.h.

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

Definition at line 317 of file BoxND.h.

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

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

Definition at line 354 of file BoxND.h.

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

Scaling of all limits by a constant

Definition at line 345 of file BoxND.h.

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

Scaling by a different constant in each dimension

Definition at line 372 of file BoxND.h.

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

Shifting this object

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

Definition at line 436 of file BoxND.h.

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

Definition at line 466 of file BoxND.h.

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

Definition at line 413 of file BoxND.h.

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

Definition at line 422 of file BoxND.h.

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

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

Definition at line 256 of file BoxND.h.

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

Overlap volume with another box

Definition at line 241 of file BoxND.h.

template<typename Numeric >
void npstat::BoxND< Numeric >::restore ( const gs::ClassId &  id,
std::istream &  in,
BoxND< Numeric > *  box 
)
static

Definition at line 525 of file BoxND.h.

template<typename Numeric>
template<typename Num2 >
BoxND& npstat::BoxND< Numeric >::shift ( const Num2 *  shifts,
unsigned long  lenShifts 
)
template<typename Numeric>
template<typename Num2 >
BoxND<Numeric>& npstat::BoxND< Numeric >::shift ( const Num2 *  shifts,
const unsigned long  shiftsLen 
)

Definition at line 449 of file BoxND.h.

template<typename Numeric >
BoxND< Numeric > 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.

Definition at line 486 of file BoxND.h.

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

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

Definition at line 478 of file BoxND.h.

template<typename Numeric>
static unsigned npstat::BoxND< Numeric >::version ( )
inlinestatic

Definition at line 155 of file BoxND.h.

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

Box volume

Definition at line 231 of file BoxND.h.

template<typename Numeric >
bool npstat::BoxND< Numeric >::write ( std::ostream &  of) const

Definition at line 511 of file BoxND.h.