18 hasWeightingField(false),
23 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 = v0 - (x - x0) * fx - (y - y0) * fy - (z - z0) * fz;
71 std::cerr <<
" Potential is not defined.\n";
79 std::cerr <<
" (" << x <<
", " << y <<
", " << z <<
")"
80 <<
" is not inside a medium.\n";
95 if (!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 = v0 - (xmin - x0) * fx;
111 const double pxmax = v0 - (xmax - x0) * fx;
112 const double pymin = -(ymin - y0) * fy;
113 const double pymax = -(ymax - y0) * fy;
114 const double pzmin = -(zmin - z0) * fz;
115 const double pzmax = -(zmax - z0) * 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 (!hasWeightingField || label != wfield)
return;
145 std::cout <<
" No medium at (" << x <<
", " << y <<
", " << z <<
")\n";
156 const std::string label) {
158 if (!hasWeightingPotential || label != wfield)
return 0.;
161 if (m == NULL)
return 0.;
163 return w0 - (x - wx0) * fwx - (y - wy0) * fwy - (z - wz0) * fwz;
172 if (fx * fx + fy * fy + fz * fz > Small)
return;
175 std::cerr <<
" Electric field is set to zero.\n";
180 const double z,
const double v) {
191 const std::string label) {
197 hasWeightingField =
true;
201 const double z,
const double v) {
203 if (!hasWeightingField) {
204 std::cerr <<
m_className <<
"::SetWeightingPotential:\n";
205 std::cerr <<
" Set the weighting field first!\n";
212 hasWeightingPotential =
true;
215void ComponentConstant::Reset() {
218 hasPotential =
false;
222void ComponentConstant::UpdatePeriodicity() {
225 std::cerr <<
m_className <<
"::UpdatePeriodicity:\n";
226 std::cerr <<
" Periodicities are not supported.\n";
GeometryBase * theGeometry
virtual bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
virtual Medium * GetMedium(const double &x, const double &y, const double &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)
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)