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

Sphere. More...

#include <SolidSphere.hh>

Inheritance diagram for Garfield::SolidSphere:
Garfield::Solid

Public Member Functions

 SolidSphere (const double cx, const double cy, const double cz, const double r)
 Constructor from centre and outer radius.
 SolidSphere (const double cx, const double cy, const double cz, const double rmin, const double rmax)
 Constructor from centre and inner/outer radii.
 ~SolidSphere ()
 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 IsSphere () const override
 Return true if the solid is a sphere.
void SetRadius (const double r)
 Set the radius of the sphere.
void SetRadii (const double rmin, const double rmax)
 Set the inner and outer radius of the sphere.
double GetRadius () const override
 Return the radius.
double GetInnerRadius () const override
 Return the inner radius.
double GetOuterRadius () const override
 Return the outer radius.
void SetMeridians (const unsigned int n)
 When calculating surface panels, the sphere is approximated by a set of parallelograms, much the same way maps are drawn ("UV sphere").
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 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 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 UpdatePanels ()
void MakePanels (const int vol, const double r, const bool out, std::vector< Panel > &panels) const

Private Attributes

std::mutex m_mutex
 Mutex.
double m_rMin = 0.
 Inner and outer radii.
double m_rMax = 1.
unsigned int m_n = 10
 Number of meridians.
double m_dis = -1.
 Discretisation level.
std::vector< Panelm_panelsO
 Surface panels.
std::vector< Panelm_panelsI

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

Sphere.

Definition at line 12 of file SolidSphere.hh.

Constructor & Destructor Documentation

◆ SolidSphere() [1/2]

Garfield::SolidSphere::SolidSphere ( const double cx,
const double cy,
const double cz,
const double r )

Constructor from centre and outer radius.

◆ SolidSphere() [2/2]

Garfield::SolidSphere::SolidSphere ( const double cx,
const double cy,
const double cz,
const double rmin,
const double rmax )

Constructor from centre and inner/outer radii.

◆ ~SolidSphere()

Garfield::SolidSphere::~SolidSphere ( )
inline

Destructor.

Definition at line 21 of file SolidSphere.hh.

21{}

Member Function Documentation

◆ Cut()

void Garfield::SolidSphere::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.

◆ GetBoundingBox()

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

Retrieve the discretisation level of a panel.

Implements Garfield::Solid.

◆ GetInnerRadius()

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

Return the inner radius.

Reimplemented from Garfield::Solid.

Definition at line 35 of file SolidSphere.hh.

35{ return m_rMin; }
double m_rMin
Inner and outer radii.

◆ GetOuterRadius()

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

Return the outer radius.

Reimplemented from Garfield::Solid.

Definition at line 36 of file SolidSphere.hh.

36{ return m_rMax; }

◆ GetRadius()

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

Return the radius.

Reimplemented from Garfield::Solid.

Definition at line 34 of file SolidSphere.hh.

34{ return m_rMax; }

◆ IsInside()

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

◆ IsSphere()

bool Garfield::SolidSphere::IsSphere ( ) const
inlineoverridevirtual

Return true if the solid is a sphere.

Reimplemented from Garfield::Solid.

Definition at line 27 of file SolidSphere.hh.

27{ return true; }

◆ MakePanels()

void Garfield::SolidSphere::MakePanels ( const int vol,
const double r,
const bool out,
std::vector< Panel > & panels ) const
private

◆ SetDiscretisationLevel()

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

Set the discretisation level (for all panels).

Implements Garfield::Solid.

Definition at line 44 of file SolidSphere.hh.

44{ m_dis = dis; }
double m_dis
Discretisation level.

◆ SetMeridians()

void Garfield::SolidSphere::SetMeridians ( const unsigned int n)

When calculating surface panels, the sphere is approximated by a set of parallelograms, much the same way maps are drawn ("UV sphere").

N specifies the number of meridians and also the number of parallels.

◆ SetRadii()

void Garfield::SolidSphere::SetRadii ( const double rmin,
const double rmax )

Set the inner and outer radius of the sphere.

◆ SetRadius()

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

Set the radius of the sphere.

◆ SolidPanels()

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

Retrieve the surface panels of the solid.

Implements Garfield::Solid.

◆ UpdatePanels()

void Garfield::SolidSphere::UpdatePanels ( )
private

Member Data Documentation

◆ m_dis

double Garfield::SolidSphere::m_dis = -1.
private

Discretisation level.

Definition at line 62 of file SolidSphere.hh.

◆ m_mutex

std::mutex Garfield::SolidSphere::m_mutex
private

Mutex.

Definition at line 53 of file SolidSphere.hh.

◆ m_n

unsigned int Garfield::SolidSphere::m_n = 10
private

Number of meridians.

Definition at line 59 of file SolidSphere.hh.

◆ m_panelsI

std::vector<Panel> Garfield::SolidSphere::m_panelsI
private

Definition at line 66 of file SolidSphere.hh.

◆ m_panelsO

std::vector<Panel> Garfield::SolidSphere::m_panelsO
private

Surface panels.

Definition at line 65 of file SolidSphere.hh.

◆ m_rMax

double Garfield::SolidSphere::m_rMax = 1.
private

Definition at line 56 of file SolidSphere.hh.

◆ m_rMin

double Garfield::SolidSphere::m_rMin = 0.
private

Inner and outer radii.

Definition at line 56 of file SolidSphere.hh.


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