1#ifndef G_COMPONENT_CST_H 
    2#define G_COMPONENT_CST_H 
   27                            unsigned int& nz) 
const;
 
   30                       std::vector<size_t>& nodes) 
const override;
 
   32                        bool& drift) 
const override;
 
   34  bool GetNode(
const size_t i, 
double& x, 
double& y, 
double& z) 
const override;
 
   37                            double& ymin, 
double& ymax, 
double& zmin,
 
   41  void ElectricField(
const double x, 
const double y, 
const double z, 
double& ex,
 
   42                     double& ey, 
double& ez, 
Medium*& m, 
int& status) 
override;
 
   43  void ElectricField(
const double x, 
const double y, 
const double z, 
double& ex,
 
   44                     double& ey, 
double& ez, 
double& v, 
Medium*& m,
 
   45                     int& status) 
override;
 
   47                      double& wx, 
double& wy, 
double& wz,
 
   48                      const std::string& label) 
override;
 
   51                            const std::string& label) 
override;
 
   98  bool Initialise(std::string elist, std::string nlist, std::string mplist,
 
   99                  std::string prnsol, std::string unit = 
"cm");
 
  110  bool Initialise(std::string dataFile, std::string unit = 
"cm");
 
  124                         bool isBinary = 
true);
 
  193                    const unsigned int k) 
const;
 
  202                        unsigned int& i, 
unsigned int& j,
 
  203                        unsigned int& k) 
const;
 
  210                      double& dmax) 
const override;
 
  230                        unsigned int& i, 
unsigned int& j, 
unsigned int& k,
 
  231                        double* position_mapped, 
bool* mirrored) 
const;
 
  254                           double& ex, 
double& ey, 
double& ez, 
double& v,
 
  256                           const bool calculatePotential = 
false) 
const;
 
  258                          const unsigned int k, 
const double rx,
 
  259                          const double ry, 
const double rz,
 
  260                          const char component,
 
  261                          const std::vector<float>& potentials) 
const;
 
  264                     const unsigned int k, 
const double rx, 
const double ry,
 
  266                     const std::vector<float>& potentials) 
const;
 
  268  void ShapeField(
float& ex, 
float& ey, 
float& ez, 
const double rx,
 
  269                  const double ry, 
const double rz, 
const unsigned int i,
 
  270                  const unsigned int j, 
const unsigned int k,
 
  271                  const std::vector<float>& potentials) 
const;
 
  278                     unsigned int& k) 
const;
 
  281                 const unsigned int k) 
const;
 
  283  void Node2Index(
const size_t node, 
unsigned int& i, 
unsigned int& j,
 
  284                  unsigned int& k) 
const;
 
 
float GetPotential(const unsigned int i, const unsigned int j, const unsigned int k, const double rx, const double ry, const double rz, const std::vector< float > &potentials) const
bool disableFieldComponent[3]
void EnableShaping()
If you calculate the electric field component in  direction along a line in x direction this field co...
std::vector< double > m_xlines
x positions used in the CST mesh
bool Coordinate2Index(const double x, const double y, const double z, unsigned int &i, unsigned int &j, unsigned int &k) const
Find the positions in the x/y/z position vectors (m_xlines, m_ylines, m_zlines) for a given point.
size_t m_nElements
Number of elements.
std::vector< double > m_zlines
z positions used in the CST mesh
~ComponentCST()
Destructor.
float GetFieldComponent(const unsigned int i, const unsigned int j, const unsigned int k, const double rx, const double ry, const double rz, const char component, const std::vector< float > &potentials) const
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.
unsigned int m_ny
Number of mesh lines in y direction.
void Element2Index(const size_t element, unsigned int &i, unsigned int &j, unsigned int &k) const
size_t GetNumberOfElements() const override
Return the number of mesh elements.
size_t GetNumberOfNodes() const override
Return the number of mesh nodes.
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.
void ElectricFieldBinary(const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, int &status, const bool calculatePotential=false) const
bool Initialise(std::string elist, std::string nlist, std::string mplist, std::string prnsol, std::string unit="cm")
void ShapeField(float &ex, float &ey, float &ez, const double rx, const double ry, const double rz, const unsigned int i, const unsigned int j, const unsigned int k, const std::vector< float > &potentials) const
std::vector< float > m_potential
Potentials resulting from the CST simulation.
bool GetNode(const size_t i, double &x, double &y, double &z) const override
Get the coordinates of a mesh node.
bool GetElementNodes(const size_t i, std::vector< size_t > &nodes) const override
Get the indices of the nodes constituting a given element.
bool GetElementRegion(const size_t i, size_t &mat, bool &drift) const override
Get the region/material of a mesh element and a flag whether it is associated to an active medium.
Medium * GetMedium(const double x, const double y, const double z) override
Get the medium at a given location (x, y, z).
unsigned int m_nx
Number of mesh lines in x direction.
void GetElementBoundaries(unsigned int element, double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax) const
std::vector< unsigned char > m_elementMaterial
Material id for each element (unsigned char since it uses only 1 byte)
std::vector< double > m_ylines
y positions used in the CST mesh
void GetNumberOfMeshLines(unsigned int &nx, unsigned int &ny, unsigned int &nz) const
double GetElementVolume(const size_t i) const override
bool Coordinate2Index(const double x, const double y, const double z, unsigned int &i, unsigned int &j, unsigned int &k, double *position_mapped, bool *mirrored) const
Calculate the index in the vectors m_xlines, m_ylines, m_zlines, which is before the given coordinate...
bool SetWeightingField(std::string prnsol, std::string label, bool isBinary=true)
Initialise a weighting field.
double WeightingPotential(const double x, const double y, const double z, const std::string &label) override
Calculate the weighting potential at a given point.
size_t m_nNodes
Number of nodes.
void ShiftComponent(const double xShift, const double yShift, const double zShift)
bool Initialise(std::string dataFile, std::string unit="cm")
Import of field data based on binary files.
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).
void GetAspectRatio(const size_t i, double &dmin, double &dmax) const override
std::map< std::string, std::vector< float > > m_weightingFields
Map of weighting field potentials.
int Index2Node(const unsigned int i, const unsigned int j, const unsigned int k) const
void SetRangeZ(const double zmin, const double zmax)
unsigned int m_nz
Number of mesh lines in z direction.
ComponentCST()
Constructor.
void DisableXField()
Use these functions to disable a certain field component.
void Node2Index(const size_t node, unsigned int &i, unsigned int &j, unsigned int &k) const
int Index2Element(const unsigned int i, const unsigned int j, const unsigned int k) const
Calculate the element index from the position in the x/y/z position vectors (m_xlines,...
ComponentFieldMap()=delete
Default constructor.
Abstract base class for components.