Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::ComponentNeBem3dMap Class Reference

Component for interpolating field maps stored in a mesh generated by neBEM. More...

#include <ComponentNeBem3dMap.hh>

Inheritance diagram for Garfield::ComponentNeBem3dMap:

Classes

struct  Element

Public Member Functions

 ComponentNeBem3dMap ()
 Constructor.
 ~ComponentNeBem3dMap ()
 Destructor.
void ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, int &status) override
void ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override
void WeightingField (const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label) override
double WeightingPotential (const double x, const double y, const double z, const std::string &label) override
void MagneticField (const double x, const double y, const double z, double &bx, double &by, double &bz, int &status) override
void SetWeightingFieldOffset (const double x, const double y, const double z)
 Offset coordinates in the weighting field, such that the same numerical weighting field map can be used for electrodes at different positions.
Medium * GetMedium (const double x, const double y, const double z) override
bool GetVoltageRange (double &vmin, double &vmax) override
bool GetElectricFieldRange (double &exmin, double &exmax, double &eymin, double &eymax, double &ezmin, double &ezmax)
bool GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
bool LoadMapInfo (const std::string &MapInfoFile, std::string &MapVersion, int &OptMap, int &OptStaggerMap, unsigned int &NbOfXCells, unsigned int &NbOfYCells, unsigned int &NbOfZCells, double &Xmin, double &Xmax, double &Ymin, double &Ymax, double &Zmin, double &Zmax, double &XStagger, double &YStagger, double &ZStagger, std::string &MapDataFile)
 Map related information.
void SetMesh (const unsigned int nx, const unsigned int ny, const unsigned int nz, const double xmin, const double xmax, const double ymin, const double ymax, const double zmin, const double zmax)
 Define the grid.
bool LoadElectricField (const std::string &filename, const std::string &format, const bool withPotential, const bool withRegion, const double scaleX=1., const double scaleE=1., const double scaleP=1.)
 Import electric field and potential values from a file.
bool LoadMagneticField (const std::string &filename, const std::string &format, const double scaleX=1., const double scaleB=1.)
 Import magnetic field values from a file.
bool GetElement (const double xi, const double yi, const double zi, unsigned int &i, unsigned int &j, unsigned int &k, bool &xMirrored, bool &yMirrored, bool &zMirrored) const
 Return the indices of the element at a given point.
bool GetElement (const unsigned int i, const unsigned int j, const unsigned int k, double &v, double &ex, double &ey, double &ez) const
 Return the field for an element with given index.
void SetMedium (const unsigned int i, Medium *m)
 Set the medium in region i.
Medium * GetMedium (const unsigned int i) const
 Get the medium in region i.
void PrintRegions () const
 Print all regions.

Private Member Functions

bool LoadData (const std::string &filename, std::string format, const bool withPotential, const bool withRegion, const double scaleX, const double scaleF, const double scaleP, const char field)
 Read data from file.
void Reset () override
void UpdatePeriodicity () override
double Reduce (const double xin, const double xmin, const double xmax, const bool simplePeriodic, const bool mirrorPeriodic, bool &isMirrored) const
 Reduce a coordinate to the basic cell (in case of periodicity).
double TriLinInt (const double xd, const double yd, const double zd, const double c000, const double c100, const double c010, const double c001, const double c110, const double c101, const double c011, const double c111)
 Interpolate tri-linear.

Private Attributes

std::vector< Medium * > m_media
std::vector< std::vector< std::vector< Element > > > m_efields
 Electric field values and potentials at each mesh element.
std::vector< std::vector< std::vector< Element > > > m_bfields
 Magnetic field values at each mesh element.
std::vector< std::vector< std::vector< int > > > m_regions
 Region indices.
unsigned int m_nX = 0
unsigned int m_nY = 0
unsigned int m_nZ = 0
double m_xMin = 0.
double m_yMin = 0.
double m_zMin = 0.
double m_xMax = 0.
double m_yMax = 0.
double m_zMax = 0.
bool m_hasMesh = false
bool m_hasPotential = false
bool m_hasEfield = false
bool m_hasBfield = false
double m_wField_xOffset = 0.
double m_wField_yOffset = 0.
double m_wField_zOffset = 0.
double m_pMin = 0.
double m_pMax = 0.

Detailed Description

Component for interpolating field maps stored in a mesh generated by neBEM.

Definition at line 10 of file ComponentNeBem3dMap.hh.

Constructor & Destructor Documentation

◆ ComponentNeBem3dMap()

Garfield::ComponentNeBem3dMap::ComponentNeBem3dMap ( )

Constructor.

◆ ~ComponentNeBem3dMap()

Garfield::ComponentNeBem3dMap::~ComponentNeBem3dMap ( )
inline

Destructor.

Definition at line 15 of file ComponentNeBem3dMap.hh.

15{}

Member Function Documentation

◆ ElectricField() [1/2]

void Garfield::ComponentNeBem3dMap::ElectricField ( const double x,
const double y,
const double z,
double & ex,
double & ey,
double & ez,
double & v,
Medium *& m,
int & status )
override

◆ ElectricField() [2/2]

void Garfield::ComponentNeBem3dMap::ElectricField ( const double x,
const double y,
const double z,
double & ex,
double & ey,
double & ez,
Medium *& m,
int & status )
override

◆ GetBoundingBox()

bool Garfield::ComponentNeBem3dMap::GetBoundingBox ( double & xmin,
double & ymin,
double & zmin,
double & xmax,
double & ymax,
double & zmax )
override

◆ GetElectricFieldRange()

bool Garfield::ComponentNeBem3dMap::GetElectricFieldRange ( double & exmin,
double & exmax,
double & eymin,
double & eymax,
double & ezmin,
double & ezmax )

◆ GetElement() [1/2]

bool Garfield::ComponentNeBem3dMap::GetElement ( const double xi,
const double yi,
const double zi,
unsigned int & i,
unsigned int & j,
unsigned int & k,
bool & xMirrored,
bool & yMirrored,
bool & zMirrored ) const

Return the indices of the element at a given point.

◆ GetElement() [2/2]

bool Garfield::ComponentNeBem3dMap::GetElement ( const unsigned int i,
const unsigned int j,
const unsigned int k,
double & v,
double & ex,
double & ey,
double & ez ) const

Return the field for an element with given index.

◆ GetMedium() [1/2]

Medium * Garfield::ComponentNeBem3dMap::GetMedium ( const double x,
const double y,
const double z )
override

◆ GetMedium() [2/2]

Medium * Garfield::ComponentNeBem3dMap::GetMedium ( const unsigned int i) const

Get the medium in region i.

◆ GetVoltageRange()

bool Garfield::ComponentNeBem3dMap::GetVoltageRange ( double & vmin,
double & vmax )
override

◆ LoadData()

bool Garfield::ComponentNeBem3dMap::LoadData ( const std::string & filename,
std::string format,
const bool withPotential,
const bool withRegion,
const double scaleX,
const double scaleF,
const double scaleP,
const char field )
private

Read data from file.

◆ LoadElectricField()

bool Garfield::ComponentNeBem3dMap::LoadElectricField ( const std::string & filename,
const std::string & format,
const bool withPotential,
const bool withRegion,
const double scaleX = 1.,
const double scaleE = 1.,
const double scaleP = 1. )

Import electric field and potential values from a file.

The file is supposed to contain one line for each mesh point starting with

  • either two or three floating point numbers, specifying the coordinates (in cm) of the element centre or
  • two or three integers specifying the index of the element in the mesh,

followed by

  • two or three floating point numbers for the electric field (in V/cm), and (depending on the values of withPotential and withRegion),
  • a floating point number specifying the potential (in V), and
  • an integer specifying the "region" of the element.

Format types are:

  • "xy", "xyz": elements are specified by the coordinates of their centres
  • "ij", "ijk": elements are specified by their indices

◆ LoadMagneticField()

bool Garfield::ComponentNeBem3dMap::LoadMagneticField ( const std::string & filename,
const std::string & format,
const double scaleX = 1.,
const double scaleB = 1. )

Import magnetic field values from a file.

◆ LoadMapInfo()

bool Garfield::ComponentNeBem3dMap::LoadMapInfo ( const std::string & MapInfoFile,
std::string & MapVersion,
int & OptMap,
int & OptStaggerMap,
unsigned int & NbOfXCells,
unsigned int & NbOfYCells,
unsigned int & NbOfZCells,
double & Xmin,
double & Xmax,
double & Ymin,
double & Ymax,
double & Zmin,
double & Zmax,
double & XStagger,
double & YStagger,
double & ZStagger,
std::string & MapDataFile )

Map related information.

◆ MagneticField()

void Garfield::ComponentNeBem3dMap::MagneticField ( const double x,
const double y,
const double z,
double & bx,
double & by,
double & bz,
int & status )
override

◆ PrintRegions()

void Garfield::ComponentNeBem3dMap::PrintRegions ( ) const

Print all regions.

◆ Reduce()

double Garfield::ComponentNeBem3dMap::Reduce ( const double xin,
const double xmin,
const double xmax,
const bool simplePeriodic,
const bool mirrorPeriodic,
bool & isMirrored ) const
private

Reduce a coordinate to the basic cell (in case of periodicity).

◆ Reset()

void Garfield::ComponentNeBem3dMap::Reset ( )
overrideprivate

◆ SetMedium()

void Garfield::ComponentNeBem3dMap::SetMedium ( const unsigned int i,
Medium * m )

Set the medium in region i.

◆ SetMesh()

void Garfield::ComponentNeBem3dMap::SetMesh ( const unsigned int nx,
const unsigned int ny,
const unsigned int nz,
const double xmin,
const double xmax,
const double ymin,
const double ymax,
const double zmin,
const double zmax )

Define the grid.

Parameters
nx,ny,nznumber of bins along x, y, z.
xmin,xmaxrange along $x$.
ymin,ymaxrange along $y$.
zmin,zmaxrange along $z$.

◆ SetWeightingFieldOffset()

void Garfield::ComponentNeBem3dMap::SetWeightingFieldOffset ( const double x,
const double y,
const double z )

Offset coordinates in the weighting field, such that the same numerical weighting field map can be used for electrodes at different positions.

◆ TriLinInt()

double Garfield::ComponentNeBem3dMap::TriLinInt ( const double xd,
const double yd,
const double zd,
const double c000,
const double c100,
const double c010,
const double c001,
const double c110,
const double c101,
const double c011,
const double c111 )
private

Interpolate tri-linear.

◆ UpdatePeriodicity()

void Garfield::ComponentNeBem3dMap::UpdatePeriodicity ( )
overrideprivate

◆ WeightingField()

void Garfield::ComponentNeBem3dMap::WeightingField ( const double x,
const double y,
const double z,
double & wx,
double & wy,
double & wz,
const std::string & label )
override

◆ WeightingPotential()

double Garfield::ComponentNeBem3dMap::WeightingPotential ( const double x,
const double y,
const double z,
const std::string & label )
override

Member Data Documentation

◆ m_bfields

std::vector<std::vector<std::vector<Element> > > Garfield::ComponentNeBem3dMap::m_bfields
private

Magnetic field values at each mesh element.

Definition at line 112 of file ComponentNeBem3dMap.hh.

◆ m_efields

std::vector<std::vector<std::vector<Element> > > Garfield::ComponentNeBem3dMap::m_efields
private

Electric field values and potentials at each mesh element.

Definition at line 110 of file ComponentNeBem3dMap.hh.

◆ m_hasBfield

bool Garfield::ComponentNeBem3dMap::m_hasBfield = false
private

Definition at line 123 of file ComponentNeBem3dMap.hh.

◆ m_hasEfield

bool Garfield::ComponentNeBem3dMap::m_hasEfield = false
private

Definition at line 122 of file ComponentNeBem3dMap.hh.

◆ m_hasMesh

bool Garfield::ComponentNeBem3dMap::m_hasMesh = false
private

Definition at line 120 of file ComponentNeBem3dMap.hh.

◆ m_hasPotential

bool Garfield::ComponentNeBem3dMap::m_hasPotential = false
private

Definition at line 121 of file ComponentNeBem3dMap.hh.

◆ m_media

std::vector<Medium*> Garfield::ComponentNeBem3dMap::m_media
private

Definition at line 104 of file ComponentNeBem3dMap.hh.

◆ m_nX

unsigned int Garfield::ComponentNeBem3dMap::m_nX = 0
private

Definition at line 116 of file ComponentNeBem3dMap.hh.

◆ m_nY

unsigned int Garfield::ComponentNeBem3dMap::m_nY = 0
private

Definition at line 116 of file ComponentNeBem3dMap.hh.

◆ m_nZ

unsigned int Garfield::ComponentNeBem3dMap::m_nZ = 0
private

Definition at line 116 of file ComponentNeBem3dMap.hh.

◆ m_pMax

double Garfield::ComponentNeBem3dMap::m_pMax = 0.
private

Definition at line 131 of file ComponentNeBem3dMap.hh.

◆ m_pMin

double Garfield::ComponentNeBem3dMap::m_pMin = 0.
private

Definition at line 131 of file ComponentNeBem3dMap.hh.

◆ m_regions

std::vector<std::vector<std::vector<int> > > Garfield::ComponentNeBem3dMap::m_regions
private

Region indices.

Definition at line 114 of file ComponentNeBem3dMap.hh.

◆ m_wField_xOffset

double Garfield::ComponentNeBem3dMap::m_wField_xOffset = 0.
private

Definition at line 126 of file ComponentNeBem3dMap.hh.

◆ m_wField_yOffset

double Garfield::ComponentNeBem3dMap::m_wField_yOffset = 0.
private

Definition at line 127 of file ComponentNeBem3dMap.hh.

◆ m_wField_zOffset

double Garfield::ComponentNeBem3dMap::m_wField_zOffset = 0.
private

Definition at line 128 of file ComponentNeBem3dMap.hh.

◆ m_xMax

double Garfield::ComponentNeBem3dMap::m_xMax = 0.
private

Definition at line 118 of file ComponentNeBem3dMap.hh.

◆ m_xMin

double Garfield::ComponentNeBem3dMap::m_xMin = 0.
private

Definition at line 117 of file ComponentNeBem3dMap.hh.

◆ m_yMax

double Garfield::ComponentNeBem3dMap::m_yMax = 0.
private

Definition at line 118 of file ComponentNeBem3dMap.hh.

◆ m_yMin

double Garfield::ComponentNeBem3dMap::m_yMin = 0.
private

Definition at line 117 of file ComponentNeBem3dMap.hh.

◆ m_zMax

double Garfield::ComponentNeBem3dMap::m_zMax = 0.
private

Definition at line 118 of file ComponentNeBem3dMap.hh.

◆ m_zMin

double Garfield::ComponentNeBem3dMap::m_zMin = 0.
private

Definition at line 117 of file ComponentNeBem3dMap.hh.


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