1 #ifndef NPSTAT_BOXND_HH_
2 #define NPSTAT_BOXND_HH_
16 #include "geners/ClassId.hh"
23 template <
typename Numeric>
24 struct BoxND :
public std::vector<Interval<Numeric> >
26 typedef Numeric value_type;
32 inline explicit BoxND(
const unsigned long dim) :
44 template <
typename Num2>
45 explicit BoxND(
const std::vector<Num2>& limits);
48 template <
typename Num2>
55 template <
typename Num2>
59 inline unsigned long dim()
const {
return this->size();}
70 template <
typename Num2>
72 template <
typename Num2>
73 bool isInsideUpper(
const Num2* coord,
unsigned long coordLen)
const;
74 template <
typename Num2>
75 bool isInsideWithBounds(
const Num2* coord,
unsigned long coordLen)
const;
76 template <
typename Num2>
77 bool isInside(
const Num2* coord,
unsigned long coordLen)
const;
78 template <
typename Num2>
79 bool isInside(
const Num2* coord,
unsigned long coordLen,
80 const BoundaryInclusion* bi,
unsigned long nBi)
const;
86 BoxND& operator/=(
double r);
92 BoxND& operator/=(
const std::vector<double>& scales);
108 BoxND&
expand(
const double* scales,
unsigned long lenScales);
113 template <
typename Num2>
115 template <
typename Num2>
116 BoxND& operator-=(
const std::vector<Num2>& shifts);
117 template <
typename Num2>
118 BoxND& shift(
const Num2* shifts,
unsigned long lenShifts);
133 std::vector<Numeric> lowerCorner()
const;
139 std::vector<Numeric> upperCorner()
const;
144 void getLengths(Numeric* coord,
unsigned long coordLen)
const;
145 std::vector<Numeric> lengths()
const;
151 std::vector<Numeric> midpoint()
const;
173 inline gs::ClassId
classId()
const {
return gs::ClassId(*
this);}
174 bool write(std::ostream& of)
const;
177 static const char* classname();
178 static inline unsigned version() {
return 1;}
179 static void restore(
const gs::ClassId&
id, std::istream& in,
BoxND* box);
185 template <
typename Numeric>
188 template <
typename Numeric>
192 #include "npstat/nm/BoxND.icc"
bool operator==(const npstat::BoxND< Numeric > &l, const npstat::BoxND< Numeric > &r)
Template to represent intervals in one dimension.
Definition: Interval.hh:29
Definition: AbsArrayProjector.hh:14
void getMidpoint(Numeric *coord, unsigned long coordLen) const
Numeric overlapVolume(const BoxND &r) const
static BoxND sizeTwoBox(unsigned long ndim)
BoxND()
Definition: BoxND.hh:29
BoxND & operator*=(double r)
void getLengths(Numeric *coord, unsigned long coordLen) const
BoxND & operator+=(const std::vector< Num2 > &shifts)
BoxND & copyFrom(const BoxND< Num2 > &r)
BoxND & operator*=(const std::vector< double > &scales)
bool isInsideLower(const Num2 *coord, unsigned long coordLen) const
BoxND(const std::vector< Num2 > &limits)
double overlapFraction(const BoxND &r) const
void getLowerCorner(Numeric *coord, unsigned long coordLen) const
unsigned long dim() const
Definition: BoxND.hh:59
BoxND & expand(const std::vector< double > &scales)
static BoxND allSpace(unsigned long ndim)
BoxND(const unsigned long dim)
Definition: BoxND.hh:32
static BoxND unitBox(unsigned long ndim)
void getUpperCorner(Numeric *coord, unsigned long coordLen) const
BoxND(const unsigned long dim, const Interval< Numeric > &v)
Definition: BoxND.hh:36
gs::ClassId classId() const
Definition: BoxND.hh:173
BoxND(const BoxND< Num2 > &r)