CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 > Class Template Reference

#include <rescanArray.h>

Public Member Functions

 ArrayMapper (const ArrayND< Num1, Len1, Dim1 > &from, const ArrayND< Num2, Len2, Dim2 > &to, const unsigned interpolationDegree)
 
Num1 operator() (const unsigned *index, unsigned indexLen) const
 

Private Attributes

unsigned dim_
 
const ArrayND< Num1, Len1, Dim1 > & from_
 
unsigned ideg_
 
std::vector< double > mapped_
 
std::vector< LinearMapper1dmappers_
 

Detailed Description

template<typename Num1, unsigned Len1, unsigned Dim1, typename Num2, unsigned Len2, unsigned Dim2>
class npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >

Definition at line 44 of file rescanArray.h.

Constructor & Destructor Documentation

template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::ArrayMapper ( const ArrayND< Num1, Len1, Dim1 > &  from,
const ArrayND< Num2, Len2, Dim2 > &  to,
const unsigned  interpolationDegree 
)
inline

Definition at line 47 of file rescanArray.h.

References assert(), npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::dim_, i, npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::mappers_, npstat::ArrayND< Numeric, StackLen, StackDim >::rank(), and npstat::ArrayND< Numeric, StackLen, StackDim >::span().

50  : mapped_(from.rank()),
51  from_(from),
52  dim_(from.rank()),
53  ideg_(interpolationDegree)
54  {
55  assert(dim_ == to.rank());
56  if (dim_)
57  {
58  mappers_.reserve(dim_);
59  for (unsigned i=0; i<dim_; ++i)
60  mappers_.push_back(LinearMapper1d(-0.5, -0.5,
61  to.span(i) - 0.5,
62  from.span(i) - 0.5));
63  }
64  }
int i
Definition: DBlmapReader.cc:9
unsigned rank() const
Definition: ArrayND.h:240
assert(m_qm.get())
const ArrayND< Num1, Len1, Dim1 > & from_
Definition: rescanArray.h:95
unsigned span(unsigned dim) const
Definition: ArrayND.h:5622
std::vector< LinearMapper1d > mappers_
Definition: rescanArray.h:93
std::vector< double > mapped_
Definition: rescanArray.h:94

Member Function Documentation

template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
Num1 npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::operator() ( const unsigned *  index,
unsigned  indexLen 
) const
inline

Definition at line 66 of file rescanArray.h.

References assert(), npstat::ArrayND< Numeric, StackLen, StackDim >::closest(), npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::dim_, npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::from_, i, npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::ideg_, npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate3(), visualization-live-secondInstance_cfg::m, npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::mapped_, and npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::mappers_.

67  {
68  if (dim_)
69  {
70  const LinearMapper1d* m = &mappers_[0];
71  double* coords = &mapped_[0];
72  for (unsigned i=0; i<dim_; ++i)
73  coords[i] = m[i](index[i]);
74  switch (ideg_)
75  {
76  case 0U:
77  return from_.closest(coords, dim_);
78 
79  case 1U:
80  return from_.interpolate1(coords, dim_);
81 
82  case 3U:
83  return from_.interpolate3(coords, dim_);
84 
85  default:
86  assert(0);
87  }
88  }
89  return from_();
90  }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
const ArrayND< Num1, Len1, Dim1 > & from_
Definition: rescanArray.h:95
Numeric & closest(const double *x, unsigned xDim)
Definition: ArrayND.h:3387
Numeric interpolate1(const double *x, unsigned xDim) const
Definition: ArrayND.h:4610
std::vector< LinearMapper1d > mappers_
Definition: rescanArray.h:93
std::vector< double > mapped_
Definition: rescanArray.h:94
Numeric interpolate3(const double *x, unsigned xDim) const
Definition: ArrayND.h:4726

Member Data Documentation

template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
unsigned npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::dim_
private
template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
const ArrayND<Num1,Len1,Dim1>& npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::from_
private
template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
unsigned npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::ideg_
private
template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
std::vector<double> npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::mapped_
mutableprivate
template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
std::vector<LinearMapper1d> npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::mappers_
private