Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
ComponentTcad2d.hh
Go to the documentation of this file.
1#ifndef G_COMPONENT_TCAD_2D_H
2#define G_COMPONENT_TCAD_2D_H
3
4#include <memory>
5
7#include "QuadTree.hh"
8
9namespace Garfield {
10
11/// Interpolation in a two-dimensional field map created by Sentaurus Device.
12
14 public:
15 /// Constructor
17 /// Destructor
19
20 void ElectricField(const double x, const double y, const double z, double& ex,
21 double& ey, double& ez, double& v, Medium*& m,
22 int& status) override;
23
24 void ElectricField(const double x, const double y, const double z, double& ex,
25 double& ey, double& ez, Medium*& m, int& status) override {
26 double v = 0.;
27 ElectricField(x, y, z, ex, ey, ez, v, m, status);
28 }
29
30 Medium* GetMedium(const double x, const double y, const double z) override;
31
32 bool GetBoundingBox(double& xmin, double& ymin, double& zmin,
33 double& xmax, double& ymax, double& zmax) override;
34 bool GetElementaryCell(double& xmin, double& ymin, double& zmin,
35 double& xmax, double& ymax, double& zmax) override;
36 /// Set the z-extent of the bounding box (default: unlimited).
37 void SetRangeZ(const double zmin, const double zmax);
38
39 /** Retrieve the properties of an element.
40 * \param i index of the element
41 * \param vol volume
42 * \param dmin smallest length in the element
43 * \param dmax largest length in the element
44 * \param type element type
45 * \param nodes indices of the constituent vertices
46 * \param reg region
47 */
48 bool GetElement(const size_t i, double& vol, double& dmin, double& dmax,
49 int& type, std::vector<size_t>& nodes, int& reg) const;
50 /// Get the coordinates of a mesh node and the potential
51 /// and electric field at this node.
52 bool GetNode(const size_t i, double& x, double& y, double& v,
53 double& ex, double& ey) const;
54
55 private:
56 // Bounding box
57 bool m_hasRangeZ = false;
58
59 // Tetrahedral tree.
60 std::unique_ptr<QuadTree> m_tree;
61
62 void Reset() override {
63 Cleanup();
64 m_hasRangeZ = false;
65 m_ready = false;
66 }
67
68 size_t FindElement(const double x, const double y,
69 std::array<double, nMaxVertices>& w) const;
70 // Check whether a point is inside a given element and calculate the
71 // shape functions if it is.
72 bool InElement(const double x, const double y, const Element& element,
73 std::array<double, nMaxVertices>& w) const;
74 bool InRectangle(const double x, const double y, const Element& element,
75 std::array<double, nMaxVertices>& w) const;
76 bool InTriangle(const double x, const double y, const Element& element,
77 std::array<double, nMaxVertices>& w) const;
78 bool OnLine(const double x, const double y, const Element& element,
79 std::array<double, nMaxVertices>& w) const;
80 bool AtPoint(const double x, const double y, const Element& element,
81 std::array<double, nMaxVertices>& w) const;
82
83 bool Interpolate(const double x, const double y, const double z,
84 const std::vector<double>& field, double& f) override;
85 bool Interpolate(const double x, const double y, const double z,
86 const std::vector<std::array<double, 2> >& field,
87 double& fx, double& fy, double& fz) override;
88 void FillTree() override;
89};
90}
91#endif
Interpolation in a two-dimensional field map created by Sentaurus Device.
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
Get the bounding box coordinates.
void SetRangeZ(const double zmin, const double zmax)
Set the z-extent of the bounding box (default: unlimited).
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override
bool GetElement(const size_t i, double &vol, double &dmin, double &dmax, int &type, std::vector< size_t > &nodes, int &reg) const
bool GetNode(const size_t i, double &x, double &y, double &v, double &ex, double &ey) const
Medium * GetMedium(const double x, const double y, const double z) override
Get the medium at a given location (x, y, z).
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, int &status) override
Calculate the drift field [V/cm] and potential [V] at (x, y, z).
bool GetElementaryCell(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
Get the coordinates of the elementary cell.
Interpolation in a field map created by Sentaurus Device.
bool m_ready
Ready for use?
Definition: Component.hh:338
Abstract base class for media.
Definition: Medium.hh:13
Definition: neBEM.h:155