1#ifndef G_COMPONENT_USER_H
2#define G_COMPONENT_USER_H
22 std::function<
void(
const double,
const double,
const double,
23 double&,
double&,
double&)>);
29 std::function<
double(
const double,
const double,
const double)>);
35 std::function<
void(
const double,
const double,
const double,
36 double&,
double&,
double&)>,
37 const std::string& label);
40 const std::string& label);
44 std::function<
double(
const double,
const double,
const double)>,
45 const std::string& label);
48 const std::string& label);
52 std::function<
void(
const double,
const double,
const double,
54 double&,
double&,
double&)>,
55 const std::string& label);
58 const std::string& label);
63 std::function<
double(
const double,
const double,
const double,
65 const std::string& label);
69 const std::string& label);
73 std::function<
void(
const double,
const double,
const double,
74 double&,
double&,
double&)>);
80 void SetArea(
const double xmin,
const double ymin,
const double zmin,
81 const double xmax,
const double ymax,
const double zmax);
89 InArea(x, y, z) ? m_medium :
nullptr;
91 void ElectricField(
const double x,
const double y,
const double z,
double& ex,
92 double& ey,
double& ez,
Medium*& m,
int& status)
override;
93 void ElectricField(
const double x,
const double y,
const double z,
double& ex,
94 double& ey,
double& ez,
double& v,
Medium*& m,
95 int& status)
override;
98 void MagneticField(
const double x,
const double y,
const double z,
double& bx,
99 double& by,
double& bz,
int& status)
override;
100 void WeightingField(
const double x,
const double y,
const double z,
101 double& wx,
double& wy,
double& wz,
102 const std::string& label)
override;
104 const std::string& label)
override;
106 const double t,
double& wx,
double& wy,
double& wz,
107 const std::string& label)
override;
109 const double z,
const double t,
110 const std::string& label)
override;
112 double& xmax,
double& ymax,
double& zmax)
override;
118 std::function<void(
const double,
const double,
const double,
119 double&,
double&,
double&)> m_efield;
121 std::function<double(
const double,
const double,
const double)> m_epot;
124 std::map<std::string,
125 std::function<void(
const double,
const double,
const double,
126 double&,
double&,
double&)> > m_wfield;
129 std::map<std::string,
130 std::function<double(
const double,
const double,
const double)>
134 std::map<std::string,
135 std::function<void(
const double,
const double,
const double,
137 double&,
double&,
double&)> > m_dwfield;
140 std::map<std::string,
141 std::function<double(
const double,
const double,
const double,
142 const double)> > m_dwpot;
145 std::function<void(
const double,
const double,
const double,
146 double&,
double&,
double&)> m_bfield;
149 std::array<double, 3> m_xmin = {{0., 0., 0.}};
150 std::array<double, 3> m_xmax = {{0., 0., 0.}};
152 bool m_hasArea =
false;
154 Medium* m_medium =
nullptr;
157 void Reset()
override;
159 void UpdatePeriodicity()
override;
161 bool InArea(
const double x,
const double y,
const double z) {
162 return (x >= m_xmin[0] && x <= m_xmax[0] &&
163 y >= m_xmin[1] && y <= m_xmax[1] &&
164 z >= m_xmin[2] && z <= m_xmax[2]);
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
void SetDelayedWeightingPotential(std::function< double(const double, const double, const double, const double)>, const std::string &label)
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 SetDelayedWeightingField(std::function< void(const double, const double, const double, const double, double &, double &, double &)>, const std::string &label)
Set the function to be called for calculating the delayed weighting field.
double DelayedWeightingPotential(const double x, const double y, const double z, const double t, const std::string &label) override
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.
ComponentUser()
Constructor.
void MagneticField(const double x, const double y, const double z, double &bx, double &by, double &bz, int &status) override
void SetWeightingPotential(std::function< double(const double, const double, const double)>, const std::string &label)
Set the function to be called for calculating the weighting potential.
void SetPotential(std::function< double(const double, const double, const double)>)
Set the function to be called for calculating the electric 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].
bool HasMagneticField() const override
Does the component have a non-zero magnetic field?
void SetWeightingField(std::function< void(const double, const double, const double, double &, double &, double &)>, const std::string &label)
Set the function to be called for calculating the 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.
virtual void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status)=0
virtual Medium * GetMedium(const double x, const double y, const double z)
Get the medium at a given location (x, y, z).
Component()=delete
Default constructor.
Abstract base class for media.