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

Box with a cylindrical hole. More...

#include <SolidHole.hh>

Inheritance diagram for Garfield::SolidHole:
Garfield::Solid

Public Member Functions

 SolidHole (const double cx, const double cy, const double cz, const double rup, const double rlow, const double lx, const double ly, const double lz)
 Constructor from centre, upper/lower radii, half-lengths of the box.
 SolidHole (const double cx, const double cy, const double cz, const double rup, const double rlow, const double lx, const double ly, const double lz, const double dx, const double dy, const double dz)
 Constructor from centre, upper/lower radii, half-lengths of the box and orientation.
 ~SolidHole ()
 Destructor.
bool IsInside (const double x, const double y, const double z, const bool tesselated) const override
 Check whether a given point is inside the solid.
bool GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const override
 Return the bounding box of the solid.
bool IsHole () const override
 Return true if the solid is a hole.
void SetHalfLengthX (const double lx)
 Set the half-length of the box along x.
void SetHalfLengthY (const double ly)
 Set the half-length of the box along y.
void SetHalfLengthZ (const double lz)
 Set the half-length of the box along z.
void SetUpperRadius (const double r)
 Set the radius at z = +lz.
void SetLowerRadius (const double r)
 Set the radius at z = -lz.
double GetHalfLengthX () const override
 Return the half-length along x.
double GetHalfLengthY () const override
 Return the half-length along y.
double GetHalfLengthZ () const override
 Return the half-length along z.
double GetUpperRadius () const override
 Return the upper radius (of a hole).
double GetLowerRadius () const override
 Return the lower radius (of a hole).
void SetSectors (const unsigned int n)
 When calculating the surface panels, the hole is approximated as a polygon with a finite number of panels.
void SetAverageRadius (const bool average)
 By default, the polygon used for approximating the hole when calculating surface panels is inscribed in a circle of the specified radius.
unsigned int GetSectors () const
 Return the order of the approximating polygon.
bool GetAverage () const
 Return the state of the "average-radius" flag.
bool SolidPanels (std::vector< Panel > &panels) override
 Retrieve the surface panels of the solid.
void SetDiscretisationLevel (const double dis) override
 Set the discretisation level (for all panels).
double GetDiscretisationLevel (const Panel &panel) override
 Retrieve the discretisation level of a panel.
void Cut (const double x0, const double y0, const double z0, const double xn, const double yn, const double zn, std::vector< Panel > &panels) override
Public Member Functions inherited from Garfield::Solid
 Solid ()=delete
 Default constructor.
 Solid (const double cx, const double cy, const double cz, const std::string &name)
 Constructor.
virtual ~Solid ()
 Destructor.
virtual bool IsBox () const
 Return true if the solid is a box.
virtual bool IsTube () const
 Return true if the solid is a tube.
virtual bool IsSphere () const
 Return true if the solid is a sphere.
virtual bool IsRidge () const
 Return true if the solid is a ridge.
virtual bool IsExtrusion () const
 Return true if the solid is an extrusion.
virtual bool IsWire () const
 Return true if the solid is a wire.
void SetLabel (const std::string &label)
 Set a label.
std::string GetLabel () const
 Return the label.
bool GetCentre (double &x, double &y, double &z) const
 Retrieve the centre point of the solid.
bool GetDirection (double &dx, double &dy, double &dz) const
 Retrieve the direction vector.
bool GetOrientation (double &ctheta, double &stheta, double &cphi, double &sphi) const
 Retrieve the orientation (azimuthal and polar angles) of the solid.
virtual double GetInnerRadius () const
 Return the inner radius.
virtual double GetOuterRadius () const
 Return the outer radius.
virtual double GetRadius () const
 Return the radius.
virtual double GetRidgeOffset () const
 Return the x-offset of a ridge.
virtual double GetRidgeHeight () const
 Return the height of a ridge.
virtual bool GetProfile (std::vector< double > &xv, std::vector< double > &yv) const
 Get the vertices defining an extrusion.
unsigned int GetId () const
 Get the ID of the solid.
void SetBoundaryPotential (const double v)
 Apply Dirichlet boundary conditions (fixed voltage).
void SetBoundaryChargeDensity (const double q)
 Apply fixed-charge boundary conditions.
void SetBoundaryFloat ()
 Make the potential at the surface of the solid floating.
void SetBoundaryDielectric ()
 Make the surfaces of the solid dielectric-dielectric interfaces.
void SetBoundaryParallelField ()
void SetBoundaryPerpendicularField ()
BoundaryCondition GetBoundaryConditionType () const
 Retrieve the type of boundary condition.
double GetBoundaryPotential () const
 Retrieve the potential.
double GetBoundaryChargeDensity () const
 Retrieve the surface charge density.
void EnableDebugging (const bool on=true)
 Switch debugging messages on/off.
void SetColour (const int col)
 Set the colour of the solid.
int GetColour () const
 Get the colour of the solid.

Private Member Functions

void Update ()

Private Attributes

std::mutex m_mutex
 Mutex.
double m_rUp
 Upper radius.
double m_rLow
 Lower radius.
double m_lX
 Half-length in x.
double m_lY
 Half-length in y.
double m_lZ
 Half-length in z.
unsigned int m_n = 2
 Number of sectors.
bool m_average = false
 Average chord over the sectors.
double m_fp = 1.
 Ratio between the approximating polygon's radius and the hole radius.
double m_fi = 1.
 Ratio between inradius and exradius of the approximating polygon.
std::array< double, 7 > m_dis {{-1., -1., -1., -1., -1., -1., -1.}}
 Discretisation levels.

Additional Inherited Members

Public Types inherited from Garfield::Solid
enum  BoundaryCondition {
  Unknown = 0 , Voltage , Charge , Float ,
  Dielectric , DielectricCharge , ParallelField , PerpendicularField
}
Static Public Member Functions inherited from Garfield::Solid
static bool Intersect (const double x1, const double y1, const double z1, const double x2, const double y2, const double z2, const double x0, const double y0, const double z0, const double a, const double b, const double c, double &xc, double &yc, double &zc)
Protected Member Functions inherited from Garfield::Solid
void ToLocal (const double x, const double y, const double z, double &u, double &v, double &w) const
 Transform a point from global coordinates (x, y, z) to local coordinates (u, v, w).
void ToGlobal (const double u, const double v, const double w, double &x, double &y, double &z) const
 Transform a point from local coordinates (u, v, w) to global coordinates (x, y, z).
void VectorToLocal (const double x, const double y, const double z, double &u, double &v, double &w)
 Transform a vector from global to local coordinates.
void SetDirection (const double dx, const double dy, const double dz)
Protected Attributes inherited from Garfield::Solid
double m_cX = 0.
 Centre of the solid.
double m_cY = 0.
double m_cZ = 0.
double m_dX = 0.
 Direction vector.
double m_dY = 0.
double m_dZ = 1.
double m_cPhi = 1.
 Azimuthal angle.
double m_sPhi = 0.
double m_cTheta = 1.
 Polar angle.
double m_sTheta = 0.
std::string m_className = "Solid"
 Class name.
std::string m_label = ""
 Label.
bool m_debug = false
 Debug flag.
BoundaryCondition m_bctype = Unknown
 Type of boundary condition.
double m_volt = 0.
 Potential at the surface.
double m_charge = 0.
 Surface charge density.
double m_eps = 0.
 Dielectric constant.
int m_colour = -1
 Colour.

Detailed Description

Box with a cylindrical hole.

Definition at line 13 of file SolidHole.hh.

Constructor & Destructor Documentation

◆ SolidHole() [1/2]

Garfield::SolidHole::SolidHole ( const double cx,
const double cy,
const double cz,
const double rup,
const double rlow,
const double lx,
const double ly,
const double lz )

Constructor from centre, upper/lower radii, half-lengths of the box.

◆ SolidHole() [2/2]

Garfield::SolidHole::SolidHole ( const double cx,
const double cy,
const double cz,
const double rup,
const double rlow,
const double lx,
const double ly,
const double lz,
const double dx,
const double dy,
const double dz )

Constructor from centre, upper/lower radii, half-lengths of the box and orientation.

◆ ~SolidHole()

Garfield::SolidHole::~SolidHole ( )
inline

Destructor.

Definition at line 25 of file SolidHole.hh.

25{}

Member Function Documentation

◆ Cut()

void Garfield::SolidHole::Cut ( const double x0,
const double y0,
const double z0,
const double xn,
const double yn,
const double zn,
std::vector< Panel > & panels )
overridevirtual

Implements Garfield::Solid.

◆ GetAverage()

bool Garfield::SolidHole::GetAverage ( ) const
inline

Return the state of the "average-radius" flag.

Definition at line 68 of file SolidHole.hh.

68{ return m_average; }
bool m_average
Average chord over the sectors.
Definition SolidHole.hh:96

◆ GetBoundingBox()

bool Garfield::SolidHole::GetBoundingBox ( double & xmin,
double & ymin,
double & zmin,
double & xmax,
double & ymax,
double & zmax ) const
overridevirtual

Return the bounding box of the solid.

Implements Garfield::Solid.

◆ GetDiscretisationLevel()

double Garfield::SolidHole::GetDiscretisationLevel ( const Panel & panel)
overridevirtual

Retrieve the discretisation level of a panel.

Implements Garfield::Solid.

◆ GetHalfLengthX()

double Garfield::SolidHole::GetHalfLengthX ( ) const
inlineoverridevirtual

Return the half-length along x.

Reimplemented from Garfield::Solid.

Definition at line 44 of file SolidHole.hh.

44{ return m_lX; }
double m_lX
Half-length in x.
Definition SolidHole.hh:87

◆ GetHalfLengthY()

double Garfield::SolidHole::GetHalfLengthY ( ) const
inlineoverridevirtual

Return the half-length along y.

Reimplemented from Garfield::Solid.

Definition at line 45 of file SolidHole.hh.

45{ return m_lY; }
double m_lY
Half-length in y.
Definition SolidHole.hh:89

◆ GetHalfLengthZ()

double Garfield::SolidHole::GetHalfLengthZ ( ) const
inlineoverridevirtual

Return the half-length along z.

Reimplemented from Garfield::Solid.

Definition at line 46 of file SolidHole.hh.

46{ return m_lZ; }
double m_lZ
Half-length in z.
Definition SolidHole.hh:91

◆ GetLowerRadius()

double Garfield::SolidHole::GetLowerRadius ( ) const
inlineoverridevirtual

Return the lower radius (of a hole).

Reimplemented from Garfield::Solid.

Definition at line 48 of file SolidHole.hh.

48{ return m_rLow; }
double m_rLow
Lower radius.
Definition SolidHole.hh:85

◆ GetSectors()

unsigned int Garfield::SolidHole::GetSectors ( ) const
inline

Return the order of the approximating polygon.

Definition at line 66 of file SolidHole.hh.

66{ return m_n; }
unsigned int m_n
Number of sectors.
Definition SolidHole.hh:94

◆ GetUpperRadius()

double Garfield::SolidHole::GetUpperRadius ( ) const
inlineoverridevirtual

Return the upper radius (of a hole).

Reimplemented from Garfield::Solid.

Definition at line 47 of file SolidHole.hh.

47{ return m_rUp; }
double m_rUp
Upper radius.
Definition SolidHole.hh:83

◆ IsHole()

bool Garfield::SolidHole::IsHole ( ) const
inlineoverridevirtual

Return true if the solid is a hole.

Reimplemented from Garfield::Solid.

Definition at line 31 of file SolidHole.hh.

31{ return true; }

◆ IsInside()

bool Garfield::SolidHole::IsInside ( const double x,
const double y,
const double z,
const bool tesselated ) const
overridevirtual

Check whether a given point is inside the solid.

If requested, use the tesselated approximation of the solid (if applicable).

Implements Garfield::Solid.

◆ SetAverageRadius()

void Garfield::SolidHole::SetAverageRadius ( const bool average)
inline

By default, the polygon used for approximating the hole when calculating surface panels is inscribed in a circle of the specified radius.

If the "average-radius" flag is activated, then the radius will be interpreted as the mean radius of the polygon that approximates the cylinder.

Definition at line 60 of file SolidHole.hh.

60 {
61 m_average = average;
62 Update();
63 }

◆ SetDiscretisationLevel()

void Garfield::SolidHole::SetDiscretisationLevel ( const double dis)
inlineoverridevirtual

Set the discretisation level (for all panels).

Implements Garfield::Solid.

Definition at line 71 of file SolidHole.hh.

71{ m_dis.fill(dis); }
std::array< double, 7 > m_dis
Discretisation levels.
Definition SolidHole.hh:104

◆ SetHalfLengthX()

void Garfield::SolidHole::SetHalfLengthX ( const double lx)

Set the half-length of the box along x.

◆ SetHalfLengthY()

void Garfield::SolidHole::SetHalfLengthY ( const double ly)

Set the half-length of the box along y.

◆ SetHalfLengthZ()

void Garfield::SolidHole::SetHalfLengthZ ( const double lz)

Set the half-length of the box along z.

◆ SetLowerRadius()

void Garfield::SolidHole::SetLowerRadius ( const double r)

Set the radius at z = -lz.

◆ SetSectors()

void Garfield::SolidHole::SetSectors ( const unsigned int n)

When calculating the surface panels, the hole is approximated as a polygon with a finite number of panels.

The number of corners of the polygon equals $4(n - 1)$. Thus, $n = 2$ will produce a square, $n = 3$ an octagon etc.

◆ SetUpperRadius()

void Garfield::SolidHole::SetUpperRadius ( const double r)

Set the radius at z = +lz.

◆ SolidPanels()

bool Garfield::SolidHole::SolidPanels ( std::vector< Panel > & panels)
overridevirtual

Retrieve the surface panels of the solid.

Implements Garfield::Solid.

◆ Update()

void Garfield::SolidHole::Update ( )
private

Member Data Documentation

◆ m_average

bool Garfield::SolidHole::m_average = false
private

Average chord over the sectors.

Definition at line 96 of file SolidHole.hh.

◆ m_dis

std::array<double, 7> Garfield::SolidHole::m_dis {{-1., -1., -1., -1., -1., -1., -1.}}
private

Discretisation levels.

Definition at line 104 of file SolidHole.hh.

104{{-1., -1., -1., -1., -1., -1., -1.}};

◆ m_fi

double Garfield::SolidHole::m_fi = 1.
private

Ratio between inradius and exradius of the approximating polygon.

Definition at line 101 of file SolidHole.hh.

◆ m_fp

double Garfield::SolidHole::m_fp = 1.
private

Ratio between the approximating polygon's radius and the hole radius.

Definition at line 99 of file SolidHole.hh.

◆ m_lX

double Garfield::SolidHole::m_lX
private

Half-length in x.

Definition at line 87 of file SolidHole.hh.

◆ m_lY

double Garfield::SolidHole::m_lY
private

Half-length in y.

Definition at line 89 of file SolidHole.hh.

◆ m_lZ

double Garfield::SolidHole::m_lZ
private

Half-length in z.

Definition at line 91 of file SolidHole.hh.

◆ m_mutex

std::mutex Garfield::SolidHole::m_mutex
private

Mutex.

Definition at line 80 of file SolidHole.hh.

◆ m_n

unsigned int Garfield::SolidHole::m_n = 2
private

Number of sectors.

Definition at line 94 of file SolidHole.hh.

◆ m_rLow

double Garfield::SolidHole::m_rLow
private

Lower radius.

Definition at line 85 of file SolidHole.hh.

◆ m_rUp

double Garfield::SolidHole::m_rUp
private

Upper radius.

Definition at line 83 of file SolidHole.hh.


The documentation for this class was generated from the following file:
  • /builds/garfield/docs/source/Include/Garfield/SolidHole.hh