13 m_hasPotential(false),
18 m_hasWeightingField(false),
23 m_hasWeightingPotential(false),
33 const double z,
double& ex,
double& ey,
34 double& ez,
Medium*& m,
int& status) {
43 std::cerr <<
" (" << x <<
", " << y <<
", " << z <<
")"
44 <<
" is not inside a medium.\n";
58 const double z,
double& ex,
double& ey,
59 double& ez,
double& v,
Medium*& m,
66 v = m_v0 - (x - m_x0) * m_fx - (y - m_y0) * m_fy - (z - m_z0) * m_fz;
71 std::cerr <<
" Potential is not defined.\n";
79 std::cerr <<
" (" << x <<
", " << y <<
", " << z <<
")"
80 <<
" is not inside a medium.\n";
95 if (!m_hasPotential)
return false;
99 std::cerr <<
" Geometry pointer is null.\n";
102 double xmin, ymin, zmin;
103 double xmax, ymax, zmax;
105 std::cerr <<
m_className <<
"::GetVoltageRange:\n";
106 std::cerr <<
" Could not determine bounding box.\n";
110 const double pxmin = m_v0 - (xmin - m_x0) * m_fx;
111 const double pxmax = m_v0 - (xmax - m_x0) * m_fx;
112 const double pymin = m_v0 - (ymin - m_y0) * m_fy;
113 const double pymax = m_v0 - (ymax - m_y0) * m_fy;
114 const double pzmin = m_v0 - (zmin - m_z0) * m_fz;
115 const double pzmax = m_v0 - (zmax - m_z0) * m_fz;
117 p[0] = pxmin + pymin + pzmin;
118 p[1] = pxmin + pymin + pzmax;
119 p[2] = pxmin + pymax + pzmin;
120 p[3] = pxmin + pymax + pzmax;
121 p[4] = pxmax + pymin + pzmin;
122 p[5] = pxmax + pymin + pzmax;
123 p[6] = pxmax + pymax + pzmin;
124 p[7] = pxmax + pymax + pzmax;
126 for (
int i = 7; i--;) {
127 if (p[i] > vmax) vmax = p[i];
128 if (p[i] < vmin) vmin = p[i];
135 const double z,
double& wx,
double& wy,
136 double& wz,
const std::string& label) {
138 if (!m_hasWeightingField || label != m_wfield)
return;
145 std::cout <<
" No medium at (" << x <<
", " << y <<
", " << z <<
")\n";
156 const std::string& label) {
158 if (!m_hasWeightingPotential || label != m_wfield)
return 0.;
163 return m_w0 - (x - m_wx0) * m_fwx - (y - m_wy0) * m_fwy - (z - m_wz0) * m_fwz;
172 if (m_fx * m_fx + m_fy * m_fy + m_fz * m_fz > Small)
return;
175 std::cerr <<
" Electric field is set to zero.\n";
180 const double z,
const double v) {
186 m_hasPotential =
true;
191 const std::string label) {
197 m_hasWeightingField =
true;
201 const double z,
const double v) {
203 if (!m_hasWeightingField) {
204 std::cerr <<
m_className <<
"::SetWeightingPotential:\n";
205 std::cerr <<
" Set the weighting field first!\n";
212 m_hasWeightingPotential =
true;
215void ComponentConstant::Reset() {
217 m_fx = m_fy = m_fz = 0.;
218 m_hasPotential =
false;
219 m_hasWeightingField =
false;
220 m_hasWeightingPotential =
false;
225void ComponentConstant::UpdatePeriodicity() {
228 std::cerr <<
m_className <<
"::UpdatePeriodicity:\n";
229 std::cerr <<
" Periodicities are not supported.\n";
Abstract base class for components.
GeometryBase * m_geometry
Pointer to the geometry.
bool m_ready
Ready for use?
virtual bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
Get the bounding box coordinates.
std::string m_className
Class name.
bool m_debug
Switch on/off debugging messages.
virtual Medium * GetMedium(const double x, const double y, const double z)
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, Medium *&m, int &status)
void SetElectricField(const double ex, const double ey, const double ez)
double WeightingPotential(const double x, const double y, const double z, const std::string &label)
bool GetVoltageRange(double &vmin, double &vmax)
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)
void SetPotential(const double x, const double y, const double z, const double v=0.)
void SetWeightingPotential(const double x, const double y, const double z, const double v=0.)
void SetWeightingField(const double wx, const double wy, const double wz, const std::string label)
Abstract base class for media.