1#ifndef G_COMPONENT_USER_H 
    2#define G_COMPONENT_USER_H 
   23      std::function<
void(
const double, 
const double, 
const double, 
double&,
 
   30      std::function<
double(
const double, 
const double, 
const double)>);
 
   36      std::function<
void(
const double, 
const double, 
const double, 
double&,
 
   38      const std::string& label);
 
   41                         const std::string& label);
 
   45      std::function<
double(
const double, 
const double, 
const double)>,
 
   46      const std::string& label);
 
   49                             const std::string& label);
 
   53      std::function<
void(
const double, 
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);
 
   75      std::function<
void(
const double, 
const double, 
const double, 
double&,
 
   82  void SetArea(
const double xmin, 
const double ymin, 
const double zmin,
 
   83               const double xmax, 
const double ymax, 
const double zmax);
 
   94  void ElectricField(
const double x, 
const double y, 
const double z, 
double& ex,
 
   95                     double& ey, 
double& ez, 
Medium*& m, 
int& status) 
override;
 
   96  void ElectricField(
const double x, 
const double y, 
const double z, 
double& ex,
 
   97                     double& ey, 
double& ez, 
double& v, 
Medium*& m,
 
   98                     int& status) 
override;
 
  101  void MagneticField(
const double x, 
const double y, 
const double z, 
double& bx,
 
  102                     double& by, 
double& bz, 
int& status) 
override;
 
  104                      double& wx, 
double& wy, 
double& wz,
 
  105                      const std::string& label) 
override;
 
  107                            const std::string& label) 
override;
 
  109                             const double t, 
double& wx, 
double& wy, 
double& wz,
 
  110                             const std::string& label) 
override;
 
  112                                   const double z, 
const double t,
 
  113                                   const std::string& label) 
override;
 
  115                      double& ymax, 
double& zmax) 
override;
 
  121  std::function<void(
const double, 
const double, 
const double, 
double&, 
double&,
 
  125  std::function<double(
const double, 
const double, 
const double)> 
m_epot;
 
  128  std::map<std::string,
 
  129           std::function<void(
const double, 
const double, 
const double, 
double&,
 
  134  std::map<std::string,
 
  135           std::function<double(
const double, 
const double, 
const double)> >
 
  139  std::map<std::string,
 
  140           std::function<void(
const double, 
const double, 
const double,
 
  141                              const double, 
double&, 
double&, 
double&)> >
 
  145  std::map<std::string, std::function<double(
const double, 
const double,
 
  146                                             const double, 
const double)> >
 
  150  std::function<void(
const double, 
const double, 
const double, 
double&, 
double&,
 
  155  std::array<double, 3> 
m_xmin = {{0., 0., 0.}};
 
  156  std::array<double, 3> 
m_xmax = {{0., 0., 0.}};
 
  167  bool InArea(
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, double &v, Medium *&m, int &status) override
Calculate the drift field [V/cm] and potential [V] at (x, y, z).
std::array< double, 3 > m_xmax
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
Calculate the delayed weighting field at a given point and time and for a given electrode.
void SetMagneticField(const std::string &expression)
Set the expression to be used for calculating the magnetic field.
std::function< double(const double, const double, const double)> m_epot
Electric potential function.
std::array< double, 3 > m_xmin
void SetDelayedWeightingPotential(std::function< double(const double, const double, const double, const double)>, const std::string &label)
Set the function to be called for calculating the delayed weighting potential.
std::map< std::string, std::function< void(const double, const double, const double, double &, double &, double &)> > m_wfield
Weighting field functions.
void SetDelayedWeightingPotential(const std::string &expression, const std::string &label)
Set the expression to be used for calculating the delayed weighting potential.
void SetWeightingField(const std::string &expression, const std::string &label)
Set the expression to be used for calculating the weighting field.
std::function< void(const double, const double, const double, double &, double &, double &)> m_efield
Electric field function.
double WeightingPotential(const double x, const double y, const double z, const std::string &label) override
Calculate the weighting potential at a given point.
void UpdatePeriodicity() override
Verify periodicities.
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
Calculate the delayed weighting potential at a given point and time and for a given electrode.
void SetElectricField(const std::string &expression)
Set the expression to be used for calculating the electric field.
void UnsetArea()
Remove the explicit limits of the active area.
void SetDelayedWeightingField(const std::string &expression, const std::string &label)
Set the expression to be used for calculating the delayed weighting field.
std::map< std::string, std::function< void(const double, const double, const double, const double, double &, double &, double &)> > m_dwfield
Delayed weighting field functions.
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
Calculate the weighting field at a given point and for a given electrode.
std::map< std::string, std::function< double(const double, const double, const double, const double)> > m_dwpot
Delayed weighting potential functions.
std::function< void(const double, const double, const double, double &, double &, double &)> m_bfield
Magnetic field function.
void SetMedium(Medium *medium)
Set the medium in the active area.
bool InArea(const double x, const double y, const double z)
ComponentUser()
Constructor.
void SetWeightingPotential(const std::string &expression, const std::string &label)
Set the expression to be used for calculating the weighting potential.
void MagneticField(const double x, const double y, const double z, double &bx, double &by, double &bz, int &status) override
Calculate the magnetic field at a given point.
void SetDelayedSignalTimes(const std::vector< double > &ts)
Set the time steps at which to evaluate the delayed weighting potential/field.
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.
void SetPotential(const std::string &expression)
Set the expression to be used 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)
Set the limits of the active area explicitly (instead of using a Geometry object).
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.
std::map< std::string, std::function< double(const double, const double, const double)> > m_wpot
Weighting potential functions.
void Reset() override
Reset the component.
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override
Calculate the drift field at given point.
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
Calculate the drift field at given point.
Component()=delete
Default constructor.
virtual Medium * GetMedium(const double x, const double y, const double z)
Get the medium at a given location (x, y, z).
Abstract base class for components.