1#ifndef G_COMPONENT_USER_H
2#define G_COMPONENT_USER_H
19 Medium*
GetMedium(
const double x,
const double y,
const double z)
override;
20 void ElectricField(
const double x,
const double y,
const double z,
double& ex,
21 double& ey,
double& ez,
Medium*& m,
int& status)
override;
22 void ElectricField(
const double x,
const double y,
const double z,
double& ex,
23 double& ey,
double& ez,
double& v,
Medium*& m,
24 int& status)
override;
26 void MagneticField(
const double x,
const double y,
const double z,
double& bx,
27 double& by,
double& bz,
int& status)
override;
28 void WeightingField(
const double x,
const double y,
const double z,
29 double& wx,
double& wy,
double& wz,
30 const std::string& label)
override;
32 const std::string& label)
override;
34 const double t,
double& wx,
double& wy,
double& wz,
35 const std::string& label)
override;
37 double& xmax,
double& ymax,
double& zmax)
override;
41 std::function<
void(
const double,
const double,
const double,
42 double&,
double&,
double&)>);
45 std::function<
void(
const double,
const double,
const double,
double&)>);
48 std::function<
void(
const double,
const double,
const double,
49 double&,
double&,
double&,
const std::string&)>);
52 std::function<
void(
const double,
const double,
const double,
53 double&,
const std::string&)>);
56 std::function<
void(
const double,
const double,
const double,
const double,
57 double&,
double&,
double&,
const std::string&)>);
60 std::function<
void(
const double,
const double,
const double,
61 double&,
double&,
double&)>);
65 void SetArea(
const double xmin,
const double ymin,
const double zmin,
66 const double xmax,
const double ymax,
const double zmax);
73 std::function<void(
const double,
const double,
const double,
74 double&,
double&,
double&)> m_efield;
76 std::function<void(
const double,
const double,
const double,
77 double&)> m_potential;
80 std::function<void(
const double,
const double,
const double,
81 double&,
double&,
double&,
const std::string&)> m_wfield;
84 std::function<void(
const double,
const double,
const double,
85 double&,
const std::string&)> m_wpot;
88 std::function<void(
const double,
const double,
const double,
const double,
89 double&,
double&,
double&,
const std::string&)> m_dwfield;
92 std::function<void(
const double,
const double,
const double,
93 double&,
double&,
double&)> m_bfield;
96 std::array<double, 3> m_xmin = {{0., 0., 0.}};
97 std::array<double, 3> m_xmax = {{0., 0., 0.}};
99 bool m_hasArea =
false;
101 Medium* m_medium =
nullptr;
104 void Reset()
override;
106 void UpdatePeriodicity()
override;
108 bool InArea(
const double x,
const double y,
const double z) {
109 if (x < m_xmin[0] || x > m_xmax[0] ||
110 y < m_xmin[1] || y > m_xmax[1] ||
111 z < m_xmin[2] || z > m_xmax[2]) {
Simple component with electric field given by a user function.
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 SetMedium(Medium *medium)
Set the medium in the active area.
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.
~ComponentUser()
Destructor.
Abstract base class for components.
Abstract base class for media.