Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4KDTree::HyperRect Class Reference

#include <G4KDTree.hh>

Public Member Functions

 HyperRect (size_t dim)
 
template<typename Position >
void SetMinMax (const Position &min, const Position &max)
 
 ~HyperRect ()
 
 HyperRect (const HyperRect &rect)
 
template<typename Position >
void Extend (const Position &pos)
 
template<typename Position >
bool CompareDistSqr (const Position &pos, const double *bestmatch)
 
size_t GetDim ()
 
double * GetMin ()
 
double * GetMax ()
 

Protected Attributes

size_t fDim
 
double * fMin
 
double * fMax
 

Detailed Description

Definition at line 135 of file G4KDTree.hh.

Constructor & Destructor Documentation

G4KDTree::HyperRect::HyperRect ( size_t  dim)
inline

Definition at line 138 of file G4KDTree.hh.

139  {
140  fDim = dim;
141  fMin = new double[fDim];
142  fMax = new double[fDim];
143  }
G4KDTree::HyperRect::~HyperRect ( )
inline

Definition at line 155 of file G4KDTree.hh.

156  {
157  delete[] fMin;
158  delete[] fMax;
159  }
G4KDTree::HyperRect::HyperRect ( const HyperRect rect)
inline

Definition at line 161 of file G4KDTree.hh.

162  {
163  fDim = rect.fDim;
164  fMin = new double[fDim];
165  fMax = new double[fDim];
166 
167  for (size_t i = 0; i < fDim; i++)
168  {
169  fMin[i] = rect.fMin[i];
170  fMax[i] = rect.fMax[i];
171  }
172  }

Member Function Documentation

template<typename Position >
bool G4KDTree::HyperRect::CompareDistSqr ( const Position &  pos,
const double *  bestmatch 
)
inline

Definition at line 191 of file G4KDTree.hh.

192  {
193  double result = 0;
194 
195  for (size_t i = 0; i < fDim; i++)
196  {
197  if (pos[i] < fMin[i])
198  {
199  result += sqr(fMin[i] - pos[i]);
200  }
201  else if (pos[i] > fMax[i])
202  {
203  result += sqr(fMax[i] - pos[i]);
204  }
205 
206  if (result >= *bestmatch) return false;
207  }
208 
209  return true;
210  }
G4double G4ParticleHPJENDLHEData::G4double result
T sqr(const T &x)
Definition: templates.hh:145
static const G4double pos

Here is the call graph for this function:

template<typename Position >
void G4KDTree::HyperRect::Extend ( const Position &  pos)
inline

Definition at line 175 of file G4KDTree.hh.

176  {
177  for (size_t i = 0; i < fDim; i++)
178  {
179  if (pos[i] < fMin[i])
180  {
181  fMin[i] = pos[i];
182  }
183  if (pos[i] > fMax[i])
184  {
185  fMax[i] = pos[i];
186  }
187  }
188  }
static const G4double pos

Here is the caller graph for this function:

size_t G4KDTree::HyperRect::GetDim ( )
inline

Definition at line 212 of file G4KDTree.hh.

213  {
214  return fDim;
215  }
double* G4KDTree::HyperRect::GetMax ( )
inline

Definition at line 220 of file G4KDTree.hh.

221  {
222  return fMax;
223  }
double* G4KDTree::HyperRect::GetMin ( )
inline

Definition at line 216 of file G4KDTree.hh.

217  {
218  return fMin;
219  }
template<typename Position >
void G4KDTree::HyperRect::SetMinMax ( const Position &  min,
const Position &  max 
)
inline

Definition at line 146 of file G4KDTree.hh.

147  {
148  for (size_t i = 0; i < fDim; i++)
149  {
150  fMin[i] = min[i];
151  fMax[i] = max[i];
152  }
153  }
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments

Here is the caller graph for this function:

Member Data Documentation

size_t G4KDTree::HyperRect::fDim
protected

Definition at line 226 of file G4KDTree.hh.

double * G4KDTree::HyperRect::fMax
protected

Definition at line 227 of file G4KDTree.hh.

double* G4KDTree::HyperRect::fMin
protected

Definition at line 227 of file G4KDTree.hh.


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