CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
Grid3D Class Reference

#include <Grid3D.h>

Public Types

using BVector = BStorageArray
 
using Container = std::vector< BVector >
 
typedef ValueType ReturnType
 
typedef float Scalar
 
typedef Basic3DVector< ScalarValueType
 

Public Member Functions

const Containerdata () const
 
void dump () const
 
 Grid3D ()
 
 Grid3D (const Grid1D &ga, const Grid1D &gb, const Grid1D &gc, std::vector< BVector > &data)
 
const Grid1Dgrida () const
 
const Grid1Dgridb () const
 
const Grid1Dgridc () const
 
int index (int i, int j, int k) const
 
ValueType operator() (int i) const
 
ValueType operator() (int i, int j, int k) const
 
int stride1 () const
 
int stride2 () const
 
int stride3 () const
 

Private Attributes

Container data_
 
Grid1D grida_
 
Grid1D gridb_
 
Grid1D gridc_
 
int stride1_
 
int stride2_
 

Detailed Description

Implementation of a 3D regular grid.

Author
T. Todorov

Definition at line 28 of file Grid3D.h.

Member Typedef Documentation

◆ BVector

Definition at line 35 of file Grid3D.h.

◆ Container

using Grid3D::Container = std::vector<BVector>

Definition at line 37 of file Grid3D.h.

◆ ReturnType

Definition at line 33 of file Grid3D.h.

◆ Scalar

typedef float Grid3D::Scalar

Definition at line 31 of file Grid3D.h.

◆ ValueType

Definition at line 32 of file Grid3D.h.

Constructor & Destructor Documentation

◆ Grid3D() [1/2]

Grid3D::Grid3D ( )
inline

Definition at line 39 of file Grid3D.h.

39 {}

◆ Grid3D() [2/2]

Grid3D::Grid3D ( const Grid1D ga,
const Grid1D gb,
const Grid1D gc,
std::vector< BVector > &  data 
)
inline

Definition at line 41 of file Grid3D.h.

42  : grida_(ga), gridb_(gb), gridc_(gc) {
43  data_.swap(data);
45  stride2_ = gridc_.nodes();
46  }

References data.

Member Function Documentation

◆ data()

const Container& Grid3D::data ( ) const
inline

◆ dump()

void Grid3D::dump ( void  ) const

Definition at line 17 of file Grid3D.cc.

17  {
18  for (int j = 0; j < gridb().nodes(); ++j) {
19  for (int k = 0; k < gridc().nodes(); ++k) {
20  for (int i = 0; i < grida().nodes(); ++i) {
21  std::cout << grida().node(i) << " " << gridb().node(j) << " " << gridc().node(k) << " " << operator()(i, j, k)
22  << std::endl;
23  }
24  }
25  }
26 }

References gather_cfg::cout, grida(), gridb(), gridc(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, Grid1D::node(), Grid1D::nodes(), and operator()().

◆ grida()

const Grid1D& Grid3D::grida ( ) const
inline

◆ gridb()

const Grid1D& Grid3D::gridb ( ) const
inline

◆ gridc()

const Grid1D& Grid3D::gridc ( ) const
inline

◆ index()

int Grid3D::index ( int  i,
int  j,
int  k 
) const
inline

Definition at line 51 of file Grid3D.h.

51 { return i * stride1_ + j * stride2_ + k; }

References mps_fire::i, dqmiolumiharvest::j, and dqmdumpme::k.

Referenced by BeautifulSoup.PageElement::insert(), and LinearGridInterpolator3D::interpolate().

◆ operator()() [1/2]

ValueType Grid3D::operator() ( int  i) const
inline

Definition at line 55 of file Grid3D.h.

55 { return ValueType(data_[i][0], data_[i][1], data_[i][2]); }

References mps_fire::i.

Referenced by dump().

◆ operator()() [2/2]

ValueType Grid3D::operator() ( int  i,
int  j,
int  k 
) const
inline

Definition at line 57 of file Grid3D.h.

57 { return (*this)(index(i, j, k)); }

References mps_fire::i, dqmiolumiharvest::j, and dqmdumpme::k.

◆ stride1()

int Grid3D::stride1 ( ) const
inline

Definition at line 52 of file Grid3D.h.

52 { return stride1_; }

Referenced by LinearGridInterpolator3D::interpolate().

◆ stride2()

int Grid3D::stride2 ( ) const
inline

Definition at line 53 of file Grid3D.h.

53 { return stride2_; }

Referenced by LinearGridInterpolator3D::interpolate().

◆ stride3()

int Grid3D::stride3 ( ) const
inline

Definition at line 54 of file Grid3D.h.

54 { return 1; }

Referenced by LinearGridInterpolator3D::interpolate().

Member Data Documentation

◆ data_

Container Grid3D::data_
private

Definition at line 72 of file Grid3D.h.

◆ grida_

Grid1D Grid3D::grida_
private

Definition at line 68 of file Grid3D.h.

◆ gridb_

Grid1D Grid3D::gridb_
private

Definition at line 69 of file Grid3D.h.

◆ gridc_

Grid1D Grid3D::gridc_
private

Definition at line 70 of file Grid3D.h.

◆ stride1_

int Grid3D::stride1_
private

Definition at line 74 of file Grid3D.h.

◆ stride2_

int Grid3D::stride2_
private

Definition at line 75 of file Grid3D.h.

Grid3D::stride1_
int stride1_
Definition: Grid3D.h:74
mps_fire.i
i
Definition: mps_fire.py:428
Grid3D::ValueType
Basic3DVector< Scalar > ValueType
Definition: Grid3D.h:32
gather_cfg.cout
cout
Definition: gather_cfg.py:144
Grid3D::index
int index(int i, int j, int k) const
Definition: Grid3D.h:51
Grid1D::nodes
int nodes() const
Definition: Grid1D.h:21
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Grid3D::data
const Container & data() const
Definition: Grid3D.h:63
Grid3D::gridb_
Grid1D gridb_
Definition: Grid3D.h:69
Grid3D::grida
const Grid1D & grida() const
Definition: Grid3D.h:59
Grid3D::data_
Container data_
Definition: Grid3D.h:72
Grid3D::grida_
Grid1D grida_
Definition: Grid3D.h:68
Grid3D::stride2_
int stride2_
Definition: Grid3D.h:75
Grid3D::operator()
ValueType operator()(int i) const
Definition: Grid3D.h:55
Grid1D::node
Scalar node(int i) const
Definition: Grid1D.h:24
Grid3D::gridc_
Grid1D gridc_
Definition: Grid3D.h:70
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
Grid3D::gridb
const Grid1D & gridb() const
Definition: Grid3D.h:60
Grid3D::gridc
const Grid1D & gridc() const
Definition: Grid3D.h:61