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

Abstract base class for solids. More...

#include <Solid.hh>

Inheritance diagram for Garfield::Solid:
Garfield::SolidBox Garfield::SolidExtrusion Garfield::SolidHole Garfield::SolidRidge Garfield::SolidSphere Garfield::SolidTube Garfield::SolidWire

Public Types

enum  BoundaryCondition {
  Unknown = 0 , Voltage , Charge , Float ,
  Dielectric , DielectricCharge , ParallelField , PerpendicularField
}

Public Member Functions

 Solid ()=delete
 Default constructor.
 Solid (const double cx, const double cy, const double cz, const std::string &name)
 Constructor.
virtual ~Solid ()
 Destructor.
virtual bool IsInside (const double x, const double y, const double z, const bool tesselated=false) const =0
 Check whether a given point is inside the solid.
virtual bool GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const =0
 Return the bounding box of the solid.
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 IsHole () const
 Return true if the solid is a hole.
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 GetHalfLengthX () const
 Return the half-length along x.
virtual double GetHalfLengthY () const
 Return the half-length along y.
virtual double GetHalfLengthZ () const
 Return the half-length along z.
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 GetLowerRadius () const
 Return the lower radius (of a hole).
virtual double GetUpperRadius () const
 Return the upper radius (of a hole).
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.
virtual bool SolidPanels (std::vector< Panel > &panels)=0
 Retrieve the surface panels of the solid.
virtual void SetDiscretisationLevel (const double dis)=0
 Set the discretisation level (for all panels).
virtual double GetDiscretisationLevel (const Panel &panel)=0
 Retrieve the discretisation level of a panel.
virtual void Cut (const double x0, const double y0, const double z0, const double xn, const double yn, const double zn, std::vector< Panel > &panels)=0
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.

Static Public Member Functions

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

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

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.

Private Member Functions

double NotImplemented (const std::string &fcn) const

Private Attributes

unsigned int m_id
 ID of the solid.

Static Private Attributes

static unsigned int s_id
 ID counter.

Detailed Description

Abstract base class for solids.

Definition at line 28 of file Solid.hh.

Member Enumeration Documentation

◆ BoundaryCondition

Enumerator
Unknown 
Voltage 
Charge 
Float 
Dielectric 
DielectricCharge 
ParallelField 
PerpendicularField 

Definition at line 151 of file Solid.hh.

Constructor & Destructor Documentation

◆ Solid() [1/2]

Garfield::Solid::Solid ( )
delete

Default constructor.

◆ Solid() [2/2]

Garfield::Solid::Solid ( const double cx,
const double cy,
const double cz,
const std::string & name )
inline

Constructor.

Definition at line 33 of file Solid.hh.

35 : m_cX(cx), m_cY(cy), m_cZ(cz), m_className(name) {
36 m_id = s_id++;
37 }
static unsigned int s_id
ID counter.
Definition Solid.hh:265
double m_cZ
Definition Solid.hh:202
unsigned int m_id
ID of the solid.
Definition Solid.hh:267
double m_cY
Definition Solid.hh:202
double m_cX
Centre of the solid.
Definition Solid.hh:202
std::string m_className
Class name.
Definition Solid.hh:212

◆ ~Solid()

virtual Garfield::Solid::~Solid ( )
inlinevirtual

Destructor.

Definition at line 40 of file Solid.hh.

40{}

Member Function Documentation

◆ Cut()

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

◆ EnableDebugging()

void Garfield::Solid::EnableDebugging ( const bool on = true)
inline

Switch debugging messages on/off.

Definition at line 187 of file Solid.hh.

187{ m_debug = on; }
bool m_debug
Debug flag.
Definition Solid.hh:218

◆ GetBoundaryChargeDensity()

double Garfield::Solid::GetBoundaryChargeDensity ( ) const
inline

Retrieve the surface charge density.

Definition at line 184 of file Solid.hh.

184{ return m_charge; }
double m_charge
Surface charge density.
Definition Solid.hh:225

◆ GetBoundaryConditionType()

BoundaryCondition Garfield::Solid::GetBoundaryConditionType ( ) const
inline

Retrieve the type of boundary condition.

Definition at line 180 of file Solid.hh.

180{ return m_bctype; }
BoundaryCondition m_bctype
Type of boundary condition.
Definition Solid.hh:221

◆ GetBoundaryPotential()

double Garfield::Solid::GetBoundaryPotential ( ) const
inline

Retrieve the potential.

Definition at line 182 of file Solid.hh.

182{ return m_volt; }
double m_volt
Potential at the surface.
Definition Solid.hh:223

◆ GetBoundingBox()

virtual bool Garfield::Solid::GetBoundingBox ( double & xmin,
double & ymin,
double & zmin,
double & xmax,
double & ymax,
double & zmax ) const
pure virtual

◆ GetCentre()

bool Garfield::Solid::GetCentre ( double & x,
double & y,
double & z ) const
inline

Retrieve the centre point of the solid.

Definition at line 71 of file Solid.hh.

71 {
72 x = m_cX;
73 y = m_cY;
74 z = m_cZ;
75 return true;
76 }

◆ GetColour()

int Garfield::Solid::GetColour ( ) const
inline

Get the colour of the solid.

Definition at line 192 of file Solid.hh.

192{ return m_colour; }
int m_colour
Colour.
Definition Solid.hh:230

◆ GetDirection()

bool Garfield::Solid::GetDirection ( double & dx,
double & dy,
double & dz ) const
inline

Retrieve the direction vector.

Definition at line 78 of file Solid.hh.

78 {
79 dx = m_dX;
80 dy = m_dY;
81 dz = m_dZ;
82 return true;
83 }
double m_dZ
Definition Solid.hh:205
double m_dX
Direction vector.
Definition Solid.hh:205
double m_dY
Definition Solid.hh:205

◆ GetDiscretisationLevel()

virtual double Garfield::Solid::GetDiscretisationLevel ( const Panel & panel)
pure virtual

◆ GetHalfLengthX()

virtual double Garfield::Solid::GetHalfLengthX ( ) const
inlinevirtual

Return the half-length along x.

Reimplemented in Garfield::SolidBox, Garfield::SolidHole, and Garfield::SolidRidge.

Definition at line 95 of file Solid.hh.

95 {
96 return NotImplemented("GetHalfLengthX");
97 }
double NotImplemented(const std::string &fcn) const

◆ GetHalfLengthY()

virtual double Garfield::Solid::GetHalfLengthY ( ) const
inlinevirtual

Return the half-length along y.

Reimplemented in Garfield::SolidBox, Garfield::SolidHole, and Garfield::SolidRidge.

Definition at line 99 of file Solid.hh.

99 {
100 return NotImplemented("GetHalfLengthY");
101 }

◆ GetHalfLengthZ()

virtual double Garfield::Solid::GetHalfLengthZ ( ) const
inlinevirtual

Return the half-length along z.

Reimplemented in Garfield::SolidBox, Garfield::SolidExtrusion, Garfield::SolidHole, Garfield::SolidTube, and Garfield::SolidWire.

Definition at line 103 of file Solid.hh.

103 {
104 return NotImplemented("GetHalfLengthZ");
105 }

◆ GetId()

unsigned int Garfield::Solid::GetId ( ) const
inline

Get the ID of the solid.

Definition at line 137 of file Solid.hh.

137{ return m_id; }

◆ GetInnerRadius()

virtual double Garfield::Solid::GetInnerRadius ( ) const
inlinevirtual

Return the inner radius.

Reimplemented in Garfield::SolidSphere, and Garfield::SolidTube.

Definition at line 107 of file Solid.hh.

107 {
108 return NotImplemented("GetInnerRadius");
109 }

◆ GetLabel()

std::string Garfield::Solid::GetLabel ( ) const
inline

Return the label.

Definition at line 68 of file Solid.hh.

68{ return m_label; }
std::string m_label
Label.
Definition Solid.hh:215

◆ GetLowerRadius()

virtual double Garfield::Solid::GetLowerRadius ( ) const
inlinevirtual

Return the lower radius (of a hole).

Reimplemented in Garfield::SolidHole.

Definition at line 117 of file Solid.hh.

117 {
118 return NotImplemented("GetLowerRadius");
119 }

◆ GetOrientation()

bool Garfield::Solid::GetOrientation ( double & ctheta,
double & stheta,
double & cphi,
double & sphi ) const
inline

Retrieve the orientation (azimuthal and polar angles) of the solid.

Definition at line 85 of file Solid.hh.

86 {
87 ctheta = m_cTheta;
88 stheta = m_sTheta;
89 cphi = m_cPhi;
90 sphi = m_sPhi;
91 return true;
92 }
double m_cTheta
Polar angle.
Definition Solid.hh:209
double m_sPhi
Definition Solid.hh:207
double m_sTheta
Definition Solid.hh:209
double m_cPhi
Azimuthal angle.
Definition Solid.hh:207

◆ GetOuterRadius()

virtual double Garfield::Solid::GetOuterRadius ( ) const
inlinevirtual

Return the outer radius.

Reimplemented in Garfield::SolidSphere, and Garfield::SolidTube.

Definition at line 111 of file Solid.hh.

111 {
112 return NotImplemented("GetOuterRadius");
113 }

◆ GetProfile()

virtual bool Garfield::Solid::GetProfile ( std::vector< double > & xv,
std::vector< double > & yv ) const
virtual

Get the vertices defining an extrusion.

Reimplemented in Garfield::SolidExtrusion.

◆ GetRadius()

virtual double Garfield::Solid::GetRadius ( ) const
inlinevirtual

Return the radius.

Reimplemented in Garfield::SolidSphere, Garfield::SolidTube, and Garfield::SolidWire.

Definition at line 115 of file Solid.hh.

115{ return NotImplemented("GetRadius"); }

◆ GetRidgeHeight()

virtual double Garfield::Solid::GetRidgeHeight ( ) const
inlinevirtual

Return the height of a ridge.

Reimplemented in Garfield::SolidRidge.

Definition at line 129 of file Solid.hh.

129 {
130 return NotImplemented("GetRidgeHeight");
131 }

◆ GetRidgeOffset()

virtual double Garfield::Solid::GetRidgeOffset ( ) const
inlinevirtual

Return the x-offset of a ridge.

Reimplemented in Garfield::SolidRidge.

Definition at line 125 of file Solid.hh.

125 {
126 return NotImplemented("GetRidgeOffset");
127 }

◆ GetUpperRadius()

virtual double Garfield::Solid::GetUpperRadius ( ) const
inlinevirtual

Return the upper radius (of a hole).

Reimplemented in Garfield::SolidHole.

Definition at line 121 of file Solid.hh.

121 {
122 return NotImplemented("GetUpperRadius");
123 }

◆ Intersect()

bool Garfield::Solid::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 )
static

◆ IsBox()

virtual bool Garfield::Solid::IsBox ( ) const
inlinevirtual

Return true if the solid is a box.

Reimplemented in Garfield::SolidBox.

Definition at line 51 of file Solid.hh.

51{ return false; }

◆ IsExtrusion()

virtual bool Garfield::Solid::IsExtrusion ( ) const
inlinevirtual

Return true if the solid is an extrusion.

Reimplemented in Garfield::SolidExtrusion.

Definition at line 61 of file Solid.hh.

61{ return false; }

◆ IsHole()

virtual bool Garfield::Solid::IsHole ( ) const
inlinevirtual

Return true if the solid is a hole.

Reimplemented in Garfield::SolidHole.

Definition at line 57 of file Solid.hh.

57{ return false; }

◆ IsInside()

virtual bool Garfield::Solid::IsInside ( const double x,
const double y,
const double z,
const bool tesselated = false ) const
pure virtual

Check whether a given point is inside the solid.

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

Implemented in Garfield::SolidBox, Garfield::SolidExtrusion, Garfield::SolidHole, Garfield::SolidRidge, Garfield::SolidSphere, Garfield::SolidTube, and Garfield::SolidWire.

◆ IsRidge()

virtual bool Garfield::Solid::IsRidge ( ) const
inlinevirtual

Return true if the solid is a ridge.

Reimplemented in Garfield::SolidRidge.

Definition at line 59 of file Solid.hh.

59{ return false; }

◆ IsSphere()

virtual bool Garfield::Solid::IsSphere ( ) const
inlinevirtual

Return true if the solid is a sphere.

Reimplemented in Garfield::SolidSphere.

Definition at line 55 of file Solid.hh.

55{ return false; }

◆ IsTube()

virtual bool Garfield::Solid::IsTube ( ) const
inlinevirtual

Return true if the solid is a tube.

Reimplemented in Garfield::SolidTube.

Definition at line 53 of file Solid.hh.

53{ return false; }

◆ IsWire()

virtual bool Garfield::Solid::IsWire ( ) const
inlinevirtual

Return true if the solid is a wire.

Reimplemented in Garfield::SolidWire.

Definition at line 63 of file Solid.hh.

63{ return false; }

◆ NotImplemented()

double Garfield::Solid::NotImplemented ( const std::string & fcn) const
private

◆ SetBoundaryChargeDensity()

void Garfield::Solid::SetBoundaryChargeDensity ( const double q)
inline

Apply fixed-charge boundary conditions.

Definition at line 168 of file Solid.hh.

168 {
169 m_charge = q;
171 }

◆ SetBoundaryDielectric()

void Garfield::Solid::SetBoundaryDielectric ( )
inline

Make the surfaces of the solid dielectric-dielectric interfaces.

Definition at line 175 of file Solid.hh.

175{ m_bctype = Dielectric; }

◆ SetBoundaryFloat()

void Garfield::Solid::SetBoundaryFloat ( )
inline

Make the potential at the surface of the solid floating.

Definition at line 173 of file Solid.hh.

173{ m_bctype = Float; }

◆ SetBoundaryParallelField()

void Garfield::Solid::SetBoundaryParallelField ( )
inline

Definition at line 176 of file Solid.hh.

◆ SetBoundaryPerpendicularField()

void Garfield::Solid::SetBoundaryPerpendicularField ( )
inline

Definition at line 177 of file Solid.hh.

◆ SetBoundaryPotential()

void Garfield::Solid::SetBoundaryPotential ( const double v)
inline

Apply Dirichlet boundary conditions (fixed voltage).

Definition at line 163 of file Solid.hh.

163 {
164 m_volt = v;
166 }

◆ SetColour()

void Garfield::Solid::SetColour ( const int col)
inline

Set the colour of the solid.

Definition at line 190 of file Solid.hh.

190{ m_colour = col; }

◆ SetDirection()

void Garfield::Solid::SetDirection ( const double dx,
const double dy,
const double dz )
protected

◆ SetDiscretisationLevel()

virtual void Garfield::Solid::SetDiscretisationLevel ( const double dis)
pure virtual

◆ SetLabel()

void Garfield::Solid::SetLabel ( const std::string & label)
inline

Set a label.

Definition at line 66 of file Solid.hh.

66{ m_label = label; }

◆ SolidPanels()

virtual bool Garfield::Solid::SolidPanels ( std::vector< Panel > & panels)
pure virtual

◆ ToGlobal()

void Garfield::Solid::ToGlobal ( const double u,
const double v,
const double w,
double & x,
double & y,
double & z ) const
inlineprotected

Transform a point from local coordinates (u, v, w) to global coordinates (x, y, z).

Definition at line 246 of file Solid.hh.

247 {
248 x = m_cX + m_cPhi * m_cTheta * u - m_sPhi * v + m_cPhi * m_sTheta * w;
249 y = m_cY + m_sPhi * m_cTheta * u + m_cPhi * v + m_sPhi * m_sTheta * w;
250 z = m_cZ - m_sTheta * u + m_cTheta * w;
251 }

◆ ToLocal()

void Garfield::Solid::ToLocal ( const double x,
const double y,
const double z,
double & u,
double & v,
double & w ) const
inlineprotected

Transform a point from global coordinates (x, y, z) to local coordinates (u, v, w).

Definition at line 234 of file Solid.hh.

235 {
236 const double dx = x - m_cX;
237 const double dy = y - m_cY;
238 const double dz = z - m_cZ;
239
240 u = m_cPhi * m_cTheta * dx + m_sPhi * m_cTheta * dy - m_sTheta * dz;
241 v = -m_sPhi * dx + m_cPhi * dy;
242 w = m_cPhi * m_sTheta * dx + m_sPhi * m_sTheta * dy + m_cTheta * dz;
243 }

◆ VectorToLocal()

void Garfield::Solid::VectorToLocal ( const double x,
const double y,
const double z,
double & u,
double & v,
double & w )
inlineprotected

Transform a vector from global to local coordinates.

Definition at line 253 of file Solid.hh.

254 {
255 u = m_cPhi * m_cTheta * x + m_sPhi * m_cTheta * y - m_sTheta * z;
256 v = -m_sPhi * x + m_cPhi * y;
257 w = m_cPhi * m_sTheta * x + m_sPhi * m_sTheta * y + m_cTheta * z;
258 }

Member Data Documentation

◆ m_bctype

BoundaryCondition Garfield::Solid::m_bctype = Unknown
protected

Type of boundary condition.

Definition at line 221 of file Solid.hh.

◆ m_charge

double Garfield::Solid::m_charge = 0.
protected

Surface charge density.

Definition at line 225 of file Solid.hh.

◆ m_className

std::string Garfield::Solid::m_className = "Solid"
protected

Class name.

Definition at line 212 of file Solid.hh.

◆ m_colour

int Garfield::Solid::m_colour = -1
protected

Colour.

Definition at line 230 of file Solid.hh.

◆ m_cPhi

double Garfield::Solid::m_cPhi = 1.
protected

Azimuthal angle.

Definition at line 207 of file Solid.hh.

◆ m_cTheta

double Garfield::Solid::m_cTheta = 1.
protected

Polar angle.

Definition at line 209 of file Solid.hh.

◆ m_cX

double Garfield::Solid::m_cX = 0.
protected

Centre of the solid.

Definition at line 202 of file Solid.hh.

◆ m_cY

double Garfield::Solid::m_cY = 0.
protected

Definition at line 202 of file Solid.hh.

◆ m_cZ

double Garfield::Solid::m_cZ = 0.
protected

Definition at line 202 of file Solid.hh.

◆ m_debug

bool Garfield::Solid::m_debug = false
protected

Debug flag.

Definition at line 218 of file Solid.hh.

◆ m_dX

double Garfield::Solid::m_dX = 0.
protected

Direction vector.

Definition at line 205 of file Solid.hh.

◆ m_dY

double Garfield::Solid::m_dY = 0.
protected

Definition at line 205 of file Solid.hh.

◆ m_dZ

double Garfield::Solid::m_dZ = 1.
protected

Definition at line 205 of file Solid.hh.

◆ m_eps

double Garfield::Solid::m_eps = 0.
protected

Dielectric constant.

Definition at line 227 of file Solid.hh.

◆ m_id

unsigned int Garfield::Solid::m_id
private

ID of the solid.

Definition at line 267 of file Solid.hh.

◆ m_label

std::string Garfield::Solid::m_label = ""
protected

Label.

Definition at line 215 of file Solid.hh.

◆ m_sPhi

double Garfield::Solid::m_sPhi = 0.
protected

Definition at line 207 of file Solid.hh.

◆ m_sTheta

double Garfield::Solid::m_sTheta = 0.
protected

Definition at line 209 of file Solid.hh.

◆ m_volt

double Garfield::Solid::m_volt = 0.
protected

Potential at the surface.

Definition at line 223 of file Solid.hh.

◆ s_id

unsigned int Garfield::Solid::s_id
staticprivate

ID counter.

Definition at line 265 of file Solid.hh.


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