13 return InArea(x, y, z) ? m_medium :
nullptr;
17 const double z,
double& ex,
double& ey,
18 double& ez,
Medium*& m,
int& status) {
26 m_efield(x, y, z, ex, ey, ez);
30 std::cerr <<
m_className <<
"::ElectricField:\n (" << x <<
", " << y
31 <<
", " << z <<
") is not inside a medium.\n";
41 const double z,
double& ex,
double& ey,
42 double& ez,
double& v,
Medium*& m,
45 ex = ey = ez = v = 0.;
50 m_efield(x, y, z, ex, ey, ez);
53 m_potential(x, y, z, v);
61 std::cerr <<
m_className <<
"::ElectricField:\n (" << x <<
", " << y
62 <<
", " << z <<
") is not inside a medium.\n";
77 const double z,
double& bx,
double& by,
78 double& bz,
int& status) {
84 m_bfield(x, y, z, bx, by, bz);
89 const double z,
double& wx,
double& wy,
90 double& wz,
const std::string& label) {
92 if (!m_wfield)
return;
93 m_wfield(x, y, z, wx, wy, wz, label);
98 const std::string& label) {
100 if (m_wpot) m_wpot(x, y, z, v, label);
105 const double z,
const double t,
106 double& wx,
double& wy,
double& wz,
107 const std::string& label) {
109 if (m_dwfield) m_dwfield(x, y, z, t, wx, wy, wz, label);
113 double& xmin,
double& ymin,
double& zmin,
114 double& xmax,
double& ymax,
double& zmax) {
129 std::function<
void(
const double,
const double,
const double,
130 double&,
double&,
double&)> f) {
132 std::cerr <<
m_className <<
"::SetElectricField: Function is empty.\n";
140 std::function<
void(
const double,
const double,
const double,
143 std::cerr <<
m_className <<
"::SetPotential: Function is empty.\n";
150 std::function<
void(
const double,
const double,
const double,
151 double&,
double&,
double&,
const std::string&)> f) {
153 std::cerr <<
m_className <<
"::SetWeightingField: Function is empty.\n";
160 std::function<
void(
const double,
const double,
const double,
161 double&,
const std::string&)> f) {
163 std::cerr <<
m_className <<
"::SetWeightingPotential: Function is empty.\n";
170 std::function<
void(
const double,
const double,
const double,
const double,
171 double&,
double&,
double&,
const std::string&)> f) {
174 std::cerr <<
m_className <<
"::SetDelayedWeightingField: Function is empty.\n";
181 std::function<
void(
const double,
const double,
const double,
182 double&,
double&,
double&)> f) {
184 std::cerr <<
m_className <<
"::SetMagneticField: Function is empty.\n";
191 const double xmin,
const double ymin,
const double zmin,
192 const double xmax,
const double ymax,
const double zmax) {
194 m_xmin[0] = std::min(xmin, xmax);
195 m_xmin[1] = std::min(ymin, ymax);
196 m_xmin[2] = std::min(zmin, zmax);
197 m_xmax[0] = std::max(xmin, xmax);
198 m_xmax[1] = std::max(ymin, ymax);
199 m_xmax[2] = std::max(zmin, zmax);
209void ComponentUser::Reset() {
211 m_potential =
nullptr;
221void ComponentUser::UpdatePeriodicity() {
223 std::cerr <<
m_className <<
"::UpdatePeriodicity:\n"
224 <<
" Periodicities are not supported.\n";
void DelayedWeightingField(const double x, const double y, const double z, const double t, double &wx, double &wy, double &wz, const std::string &label) override
double WeightingPotential(const double x, const double y, const double z, const std::string &label) override
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
Get the bounding box coordinates.
void UnsetArea()
Remove the explicit limits of the active area.
void SetElectricField(std::function< void(const double, const double, const double, double &, double &, double &)>)
Set the function to be called for calculating the electric field.
void WeightingField(const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label) override
void SetWeightingPotential(std::function< void(const double, const double, const double, double &, const std::string &)>)
Set the function to be called for calculating the weighting potential.
ComponentUser()
Constructor.
void MagneticField(const double x, const double y, const double z, double &bx, double &by, double &bz, int &status) override
void SetPotential(std::function< void(const double, const double, const double, double &)>)
Set the function to be called for calculating the potential.
Medium * GetMedium(const double x, const double y, const double z) override
Get the medium at a given location (x, y, z).
void SetArea(const double xmin, const double ymin, const double zmin, const double xmax, const double ymax, const double zmax)
bool GetVoltageRange(double &vmin, double &vmax) override
Calculate the voltage range [V].
void SetWeightingField(std::function< void(const double, const double, const double, double &, double &, double &, const std::string &)>)
Set the function to be called for calculating the weighting field.
void SetDelayedWeightingField(std::function< void(const double, const double, const double, const double, double &, double &, double &, const std::string &)>)
Set the function to be called for calculating the delayed weighting field.
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override
void SetMagneticField(std::function< void(const double, const double, const double, double &, double &, double &)>)
Set the function to be called for calculating the magnetic field.
Abstract base class for components.
virtual bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
Get the bounding box coordinates.
virtual Medium * GetMedium(const double x, const double y, const double z)
Get the medium at a given location (x, y, z).
bool m_debug
Switch on/off debugging messages.
std::string m_className
Class name.
bool m_ready
Ready for use?
Abstract base class for media.
bool IsDriftable() const
Is charge carrier transport enabled in this medium?