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

Cylindrical tube. More...

#include <SolidTube.hh>

Inheritance diagram for Garfield::SolidTube:
Garfield::Solid

Public Member Functions

 SolidTube (const double cx, const double cy, const double cz, const double r, const double lz)
 Constructor from centre, outer radius, and half-length.
 SolidTube (const double cx, const double cy, const double cz, const double r, const double lz, const double dx, const double dy, const double dz)
 Constructor from centre, outer radius, half-length and orientation.
 SolidTube (const double cx, const double cy, const double cz, const double ri, const double ro, const double lz)
 Constructor from centre, inner radius, outer radius, and half-length.
 SolidTube (const double cx, const double cy, const double cz, const double ri, const double ro, const double lz, const double dx, const double dy, const double dz)
 Constructor from centre, inner radius, outer radius, half-length and orientation.
 ~SolidTube ()
 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 IsTube () const override
 Return true if the solid is a tube.
void SetHalfLength (const double lz)
 Set the half-length of the tube.
void SetRadius (const double r)
 Set the outer radius.
double GetHalfLengthZ () const override
 Retrieve the half-length of the tube.
double GetRadius () const override
 Retrieve the outer radius.
double GetOuterRadius () const override
 Retrieve the outer radius.
double GetInnerRadius () const override
 Retrieve the inner radius.
void SetSectors (const unsigned int n)
 When calculating the surface panels, the cylinder is approximated as a polygon with a finite number of panels.
void SetRotation (const double angle)
 Specify a rotation angle (radian) of the cylinder.
void SetAverageRadius (const bool average)
 By default, the polygon used for approximating the cylinder when calculating surface panels is inscribed in a circle of the specified radius.
void SetTopLid (const bool closed)
 Request the cylinder to be closed with a (polygonal) lid at +z.
void SetBottomLid (const bool closed)
 Request the cylinder to be closed with a (polygonal) lid at -z.
unsigned int GetSectors () const
 Return the number of sectors.
double GetRotation () const
 Return the current rotation angle.
bool GetAverage () const
 Return the status 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 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 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.
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 UpdatePolygon ()

Private Attributes

std::mutex m_mutex
 Mutex.
double m_rO
 Outer radius.
double m_rI = 0.
 Inner radius.
double m_lZ
 Half-length.
double m_rot = 0.
 Rotation angle.
unsigned int m_n = 2
 Number of sectors.
bool m_average = false
 Average chord over the sectors.
double m_rpO
 Radius of the outer approximating polygon.
double m_rpI = 0.
 Radius of the inner approximating polygon.
double m_riO
 Inradius of the outer approximating polygon.
double m_riI = 0.
 Inradius of the inner approximating polygon.
std::vector< double > m_xpO
 X-coordinates of the outer approximating polygon.
std::vector< double > m_ypO
 Y-coordinates of the outer approximating polygon.
std::vector< double > m_xpI
 X-coordinates of the inner approximating polygon.
std::vector< double > m_ypI
 Y-coordinates of the inner approximating polygon.
bool m_toplid = true
 Have a top lid?
bool m_botlid = true
 Have a bottom lid?
std::array< double, 3 > m_dis {{-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

Cylindrical tube.

Definition at line 13 of file SolidTube.hh.

Constructor & Destructor Documentation

◆ SolidTube() [1/4]

Garfield::SolidTube::SolidTube ( const double cx,
const double cy,
const double cz,
const double r,
const double lz )

Constructor from centre, outer radius, and half-length.

◆ SolidTube() [2/4]

Garfield::SolidTube::SolidTube ( const double cx,
const double cy,
const double cz,
const double r,
const double lz,
const double dx,
const double dy,
const double dz )

Constructor from centre, outer radius, half-length and orientation.

◆ SolidTube() [3/4]

Garfield::SolidTube::SolidTube ( const double cx,
const double cy,
const double cz,
const double ri,
const double ro,
const double lz )

Constructor from centre, inner radius, outer radius, and half-length.

◆ SolidTube() [4/4]

Garfield::SolidTube::SolidTube ( const double cx,
const double cy,
const double cz,
const double ri,
const double ro,
const double lz,
const double dx,
const double dy,
const double dz )

Constructor from centre, inner radius, outer radius, half-length and orientation.

◆ ~SolidTube()

Garfield::SolidTube::~SolidTube ( )
inline

Destructor.

Definition at line 30 of file SolidTube.hh.

30{}

Member Function Documentation

◆ Cut()

void Garfield::SolidTube::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::SolidTube::GetAverage ( ) const
inline

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

Definition at line 76 of file SolidTube.hh.

76{ return m_average; }
bool m_average
Average chord over the sectors.
Definition SolidTube.hh:102

◆ GetBoundingBox()

bool Garfield::SolidTube::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::SolidTube::GetDiscretisationLevel ( const Panel & panel)
overridevirtual

Retrieve the discretisation level of a panel.

Implements Garfield::Solid.

◆ GetHalfLengthZ()

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

Retrieve the half-length of the tube.

Reimplemented from Garfield::Solid.

Definition at line 43 of file SolidTube.hh.

43{ return m_lZ; }
double m_lZ
Half-length.
Definition SolidTube.hh:95

◆ GetInnerRadius()

double Garfield::SolidTube::GetInnerRadius ( ) const
inlineoverridevirtual

Retrieve the inner radius.

Reimplemented from Garfield::Solid.

Definition at line 49 of file SolidTube.hh.

49{ return m_rI; }
double m_rI
Inner radius.
Definition SolidTube.hh:93

◆ GetOuterRadius()

double Garfield::SolidTube::GetOuterRadius ( ) const
inlineoverridevirtual

Retrieve the outer radius.

Reimplemented from Garfield::Solid.

Definition at line 47 of file SolidTube.hh.

47{ return m_rO; }
double m_rO
Outer radius.
Definition SolidTube.hh:91

◆ GetRadius()

double Garfield::SolidTube::GetRadius ( ) const
inlineoverridevirtual

Retrieve the outer radius.

Reimplemented from Garfield::Solid.

Definition at line 45 of file SolidTube.hh.

45{ return m_rO; }

◆ GetRotation()

double Garfield::SolidTube::GetRotation ( ) const
inline

Return the current rotation angle.

Definition at line 74 of file SolidTube.hh.

74{ return m_rot; }
double m_rot
Rotation angle.
Definition SolidTube.hh:98

◆ GetSectors()

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

Return the number of sectors.

Definition at line 72 of file SolidTube.hh.

72{ return m_n; }
unsigned int m_n
Number of sectors.
Definition SolidTube.hh:100

◆ IsInside()

bool Garfield::SolidTube::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.

◆ IsTube()

bool Garfield::SolidTube::IsTube ( ) const
inlineoverridevirtual

Return true if the solid is a tube.

Reimplemented from Garfield::Solid.

Definition at line 36 of file SolidTube.hh.

36{ return true; }

◆ SetAverageRadius()

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

By default, the polygon used for approximating the cylinder 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 65 of file SolidTube.hh.

65{ m_average = average; }

◆ SetBottomLid()

void Garfield::SolidTube::SetBottomLid ( const bool closed)
inline

Request the cylinder to be closed with a (polygonal) lid at -z.

Definition at line 69 of file SolidTube.hh.

69{ m_botlid = closed; }
bool m_botlid
Have a bottom lid?
Definition SolidTube.hh:123

◆ SetDiscretisationLevel()

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

Set the discretisation level (for all panels).

Implements Garfield::Solid.

Definition at line 79 of file SolidTube.hh.

79{ m_dis.fill(dis); }
std::array< double, 3 > m_dis
Discretisation levels.
Definition SolidTube.hh:126

◆ SetHalfLength()

void Garfield::SolidTube::SetHalfLength ( const double lz)

Set the half-length of the tube.

◆ SetRadius()

void Garfield::SolidTube::SetRadius ( const double r)

Set the outer radius.

◆ SetRotation()

void Garfield::SolidTube::SetRotation ( const double angle)
inline

Specify a rotation angle (radian) of the cylinder.

Such a rotation is meaningful only if the number of sectors (when approximating the circle with a polygon) has been chosen small.

Definition at line 59 of file SolidTube.hh.

59{ m_rot = angle; }

◆ SetSectors()

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

When calculating the surface panels, the cylinder 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.

◆ SetTopLid()

void Garfield::SolidTube::SetTopLid ( const bool closed)
inline

Request the cylinder to be closed with a (polygonal) lid at +z.

Definition at line 67 of file SolidTube.hh.

67{ m_toplid = closed; }
bool m_toplid
Have a top lid?
Definition SolidTube.hh:121

◆ SolidPanels()

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

Retrieve the surface panels of the solid.

Implements Garfield::Solid.

◆ UpdatePolygon()

void Garfield::SolidTube::UpdatePolygon ( )
private

Member Data Documentation

◆ m_average

bool Garfield::SolidTube::m_average = false
private

Average chord over the sectors.

Definition at line 102 of file SolidTube.hh.

◆ m_botlid

bool Garfield::SolidTube::m_botlid = true
private

Have a bottom lid?

Definition at line 123 of file SolidTube.hh.

◆ m_dis

std::array<double, 3> Garfield::SolidTube::m_dis {{-1., -1., -1.}}
private

Discretisation levels.

Definition at line 126 of file SolidTube.hh.

126{{-1., -1., -1.}};

◆ m_lZ

double Garfield::SolidTube::m_lZ
private

Half-length.

Definition at line 95 of file SolidTube.hh.

◆ m_mutex

std::mutex Garfield::SolidTube::m_mutex
private

Mutex.

Definition at line 88 of file SolidTube.hh.

◆ m_n

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

Number of sectors.

Definition at line 100 of file SolidTube.hh.

◆ m_rI

double Garfield::SolidTube::m_rI = 0.
private

Inner radius.

Definition at line 93 of file SolidTube.hh.

◆ m_riI

double Garfield::SolidTube::m_riI = 0.
private

Inradius of the inner approximating polygon.

Definition at line 110 of file SolidTube.hh.

◆ m_riO

double Garfield::SolidTube::m_riO
private

Inradius of the outer approximating polygon.

Definition at line 108 of file SolidTube.hh.

◆ m_rO

double Garfield::SolidTube::m_rO
private

Outer radius.

Definition at line 91 of file SolidTube.hh.

◆ m_rot

double Garfield::SolidTube::m_rot = 0.
private

Rotation angle.

Definition at line 98 of file SolidTube.hh.

◆ m_rpI

double Garfield::SolidTube::m_rpI = 0.
private

Radius of the inner approximating polygon.

Definition at line 106 of file SolidTube.hh.

◆ m_rpO

double Garfield::SolidTube::m_rpO
private

Radius of the outer approximating polygon.

Definition at line 104 of file SolidTube.hh.

◆ m_toplid

bool Garfield::SolidTube::m_toplid = true
private

Have a top lid?

Definition at line 121 of file SolidTube.hh.

◆ m_xpI

std::vector<double> Garfield::SolidTube::m_xpI
private

X-coordinates of the inner approximating polygon.

Definition at line 116 of file SolidTube.hh.

◆ m_xpO

std::vector<double> Garfield::SolidTube::m_xpO
private

X-coordinates of the outer approximating polygon.

Definition at line 112 of file SolidTube.hh.

◆ m_ypI

std::vector<double> Garfield::SolidTube::m_ypI
private

Y-coordinates of the inner approximating polygon.

Definition at line 118 of file SolidTube.hh.

◆ m_ypO

std::vector<double> Garfield::SolidTube::m_ypO
private

Y-coordinates of the outer approximating polygon.

Definition at line 114 of file SolidTube.hh.


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