1#ifndef G_COMPONENT_TCAD_3D_H
2#define G_COMPONENT_TCAD_3D_H
19 void ElectricField(
const double x,
const double y,
const double z,
double& ex,
20 double& ey,
double& ez,
double& v,
Medium*& m,
21 int& status)
override;
22 void ElectricField(
const double x,
const double y,
const double z,
double& ex,
23 double& ey,
double& ez,
Medium*& m,
int& status)
override;
25 void WeightingField(
const double x,
const double y,
const double z,
26 double& wx,
double& wy,
double& wz,
27 const std::string& label)
override;
29 const std::string& label)
override;
31 Medium*
GetMedium(
const double x,
const double y,
const double z)
override;
34 bool GetBoundingBox(
double& xmin,
double& ymin,
double& zmin,
double& xmax,
35 double& ymax,
double& zmax)
override;
41 bool Initialise(
const std::string& gridfilename,
42 const std::string& datafilename);
54 const std::string& datfile2,
const double dv);
60 void GetRegion(
const unsigned int ireg, std::string& name,
70 bool GetElement(
const unsigned int i,
double& vol,
double& dmin,
double& dmax,
72 bool GetElement(
const unsigned int i,
double& vol,
double& dmin,
double& dmax,
73 int& type,
int& node1,
int& node2,
int& node3,
int& node4,
74 int& node5,
int& node6,
int& node7,
int& reg)
const;
76 bool GetNode(
const unsigned int i,
double& x,
double& y,
double& z,
double& v,
77 double& ex,
double& ey,
double& ez)
const;
81 static constexpr int nMaxVertices = 7;
91 std::vector<Region> m_regions;
100 std::vector<Vertex> m_vertices;
103 std::vector<std::array<double, 3> > m_wf;
104 std::vector<double> m_wp;
109 int vertex[nMaxVertices];
125 std::vector<int> neighbours;
131 std::vector<Element> m_elements;
145 double m_xMinBB, m_yMinBB, m_zMinBB;
146 double m_xMaxBB, m_yMaxBB, m_zMaxBB;
149 int m_lastElement = 0;
151 void Reset()
override;
152 void UpdatePeriodicity()
override;
154 unsigned int FindElement(
const double x,
const double y,
const double z,
155 std::array<double, nMaxVertices>& w)
const;
156 bool CheckElement(
const double x,
const double y,
const double z,
157 const Element& element,
158 std::array<double, nMaxVertices>& w)
const {
160 switch (element.type) {
162 if (CheckTriangle(x, y, z, element, w)) inside =
true;
165 if (CheckTetrahedron(x, y, z, element, w)) inside =
true;
169 <<
" Invalid element type (" << element.type <<
").\n";
174 bool CheckTetrahedron(
const double x,
const double y,
const double z,
175 const Element& element,
176 std::array<double, nMaxVertices>& w)
const;
177 bool CheckTriangle(
const double x,
const double y,
const double z,
178 const Element& element,
179 std::array<double, nMaxVertices>& w)
const;
181 void FindNeighbours();
182 bool LoadGrid(
const std::string& gridfilename);
183 bool LoadData(
const std::string& datafilename);
184 bool ReadDataset(std::ifstream& datafile,
const std::string& dataset);
185 bool LoadWeightingField(
const std::string& datafilename,
186 std::vector<std::array<double, 3> >& wf,
187 std::vector<double>& wp);
190 void MapCoordinates(
double& x,
double& y,
double& z,
bool& xmirr,
bool& ymirr,
192 int FindRegion(
const std::string& name)
const;
Abstract base class for components.
std::string m_className
Class name.
Interpolation in a three-dimensional field map created by Sentaurus Device.
unsigned int GetNumberOfNodes() const
bool Initialise(const std::string &gridfilename, const std::string &datafilename)
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).
void UnsetDriftRegion(const unsigned int ireg)
void GetRegion(const unsigned int ireg, std::string &name, bool &active) const
double WeightingPotential(const double x, const double y, const double z, const std::string &label) override
bool GetNode(const unsigned int i, double &x, double &y, double &z, double &v, double &ex, double &ey, double &ez) const
int GetNumberOfElements() const
~ComponentTcad3d()
Destructor.
void SetDriftRegion(const unsigned int ireg)
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
Get the bounding box coordinates.
void PrintRegions()
List all currently defined regions.
Medium * GetMedium(const double x, const double y, const double z) override
Get the medium at a given location (x, y, z).
bool GetVoltageRange(double &vmin, double &vmax) override
Calculate the voltage range [V].
void WeightingField(const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label) override
bool SetWeightingField(const std::string &datfile1, const std::string &datfile2, const double dv)
unsigned int GetNumberOfRegions() const
Get the number of regions in the device.
bool GetElement(const unsigned int i, double &vol, double &dmin, double &dmax, int &type) const
void SetMedium(const unsigned int ireg, Medium *m)
Set the medium for a given region.
ComponentTcad3d()
Constructor.
Abstract base class for media.