Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
SolidExtrusion.hh
Go to the documentation of this file.
1#ifndef G_SOLID_EXTRUSION_H
2#define G_SOLID_EXTRUSION_H
3
4#include <array>
5
6#include "Garfield/Solid.hh"
7
8namespace Garfield {
9
11
12class SolidExtrusion : public Solid {
13 public:
15 SolidExtrusion(const double lz, const std::vector<double>& xp,
16 const std::vector<double>& yp);
18 SolidExtrusion(const double lz, const std::vector<double>& xp,
19 const std::vector<double>& yp, const double cx,
20 const double cy, const double cz, const double dx,
21 const double dy, const double dz);
24
25 bool IsInside(const double x, const double y, const double z,
26 const bool tesselated) const override;
27 bool GetBoundingBox(double& xmin, double& ymin, double& zmin, double& xmax,
28 double& ymax, double& zmax) const override;
29 bool IsExtrusion() const override { return true; }
30
31 double GetHalfLengthZ() const override { return m_lZ; }
32 bool GetProfile(std::vector<double>& xp,
33 std::vector<double>& yp) const override {
34 xp = m_xp;
35 yp = m_yp;
36 return !m_xp.empty();
37 }
38
39 void SetHalfLengthZ(const double lz);
41 void SetProfile(const std::vector<double>& xp, const std::vector<double>& yp);
43 void SetTopLid(const bool closed) { m_toplid = closed; }
45 void SetBottomLid(const bool closed) { m_botlid = closed; }
46
47 bool SolidPanels(std::vector<Panel>& panels) override;
48 void SetDiscretisationLevel(const double dis) override { m_dis.fill(dis); }
49 double GetDiscretisationLevel(const Panel& panel) override;
50
51 void Cut(const double x0, const double y0, const double z0, const double xn,
52 const double yn, const double zn,
53 std::vector<Panel>& panels) override;
54
55 private:
57 double m_lZ = 0.;
59 std::vector<double> m_xp;
61 std::vector<double> m_yp;
62
64 bool m_toplid = true;
66 bool m_botlid = true;
67
69 bool m_clockwise = true;
70
72 std::array<double, 3> m_dis{{-1, -1, -1}};
73};
74} // namespace Garfield
75
76#endif
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.
double m_lZ
Half length.
bool GetProfile(std::vector< double > &xp, std::vector< double > &yp) const override
Get the vertices defining an extrusion.
double GetDiscretisationLevel(const Panel &panel) override
Retrieve the discretisation level of a panel.
std::array< double, 3 > m_dis
Discretisation levels.
bool SolidPanels(std::vector< Panel > &panels) override
Retrieve the surface panels of the solid.
bool m_toplid
Have a top lid?
void SetBottomLid(const bool closed)
Request the extrusion to be closed with a lid at -z.
void SetHalfLengthZ(const double lz)
Set the half-length of the extrusion.
SolidExtrusion(const double lz, const std::vector< double > &xp, const std::vector< double > &yp, const double cx, const double cy, const double cz, const double dx, const double dy, const double dz)
Constructor from half-length, profile, offset and orientation.
void SetTopLid(const bool closed)
Request the extrusion to be closed with a lid at +z.
bool m_clockwise
Orientation of the polygon.
double GetHalfLengthZ() const override
Return the half-length along z.
void SetProfile(const std::vector< double > &xp, const std::vector< double > &yp)
Set the coordinates of the extrusion profile.
void SetDiscretisationLevel(const double dis) override
Set the discretisation level (for all panels).
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
bool m_botlid
Have a bottom lid?
SolidExtrusion(const double lz, const std::vector< double > &xp, const std::vector< double > &yp)
Constructor from half-length and profile.
bool IsExtrusion() const override
Return true if the solid is an extrusion.
std::vector< double > m_yp
Y coordinates of the profile.
std::vector< double > m_xp
X coordinates of the profile.
Solid()=delete
Default constructor.
Surface panel.
Definition Solid.hh:11