Garfield++ v2r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
ComponentComsol.hh
Go to the documentation of this file.
1#pragma once
2
4
5namespace Garfield {
6
7/// Component for importing and interpolating Comsol field maps.
8
10
11 public:
12 // Constructors
14 ComponentComsol(std::string mesh, std::string mplist, std::string field);
15 // Destructor
17
18 void ElectricField(const double x, const double y, const double z, double& ex,
19 double& ey, double& ez, Medium*& m, int& status);
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);
23
24 void WeightingField(const double x, const double y, const double z,
25 double& wx, double& wy, double& wz,
26 const std::string& label);
27
28 double WeightingPotential(const double x, const double y, const double z,
29 const std::string& label);
30
31 Medium* GetMedium(const double x, const double y, const double z);
32
33 virtual bool IsInBoundingBox(const double x, const double y,
34 const double z) const {
35 return x >= xMinBoundingBox && x <= xMaxBoundingBox &&
36 y >= yMinBoundingBox && y <= yMaxBoundingBox &&
38 }
39
40 bool Initialise(std::string header = "mesh.mphtxt",
41 std::string mplist = "dielectrics.dat",
42 std::string field = "field.txt");
43
44 bool SetWeightingField(std::string file, std::string label);
45
46 protected:
47 // Verify periodicities
49
50 double GetElementVolume(const unsigned int i);
51 void GetAspectRatio(const unsigned int i, double& dmin, double& dmax);
52
53 struct nodeCmp {
55 const ComponentFieldMap::Node& rhs) const {
56 double dx = round(lhs.x * 1e6) - round(rhs.x * 1e6);
57 double dy = round(lhs.y * 1e6) - round(rhs.y * 1e6);
58 double dz = round(lhs.z * 1e6) - round(rhs.z * 1e6);
59 return dx < 0 || (dx == 0 && (dy < 0 || (dy == 0 && dz < 0)));
60 }
61 };
62};
63}
Component for importing and interpolating Comsol field maps.
Medium * GetMedium(const double x, const double y, const double z)
Get the medium at a given location (x, y, z).
void UpdatePeriodicity()
Verify periodicities.
void GetAspectRatio(const unsigned int i, double &dmin, double &dmax)
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status)
double GetElementVolume(const unsigned int i)
void WeightingField(const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label)
bool SetWeightingField(std::string file, std::string label)
double WeightingPotential(const double x, const double y, const double z, const std::string &label)
bool Initialise(std::string header="mesh.mphtxt", std::string mplist="dielectrics.dat", std::string field="field.txt")
virtual bool IsInBoundingBox(const double x, const double y, const double z) const
Base class for components based on finite-element field maps.
Abstract base class for media.
Definition: Medium.hh:11
bool operator()(const ComponentFieldMap::Node &lhs, const ComponentFieldMap::Node &rhs) const