15 std::vector<double>
xv;
17 std::vector<double>
yv;
19 std::vector<double>
zv;
33 Solid(
const double cx,
const double cy,
const double cz,
34 const std::string& name)
44 virtual bool IsInside(
const double x,
const double y,
const double z,
45 const bool tesselated =
false)
const = 0;
48 double& xmax,
double& ymax,
49 double& zmax)
const = 0;
51 virtual bool IsBox()
const {
return false; }
53 virtual bool IsTube()
const {
return false; }
55 virtual bool IsSphere()
const {
return false; }
57 virtual bool IsHole()
const {
return false; }
59 virtual bool IsRidge()
const {
return false; }
63 virtual bool IsWire()
const {
return false; }
71 bool GetCentre(
double& x,
double& y,
double& z)
const {
96 return NotImplemented(
"GetHalfLengthX");
100 return NotImplemented(
"GetHalfLengthY");
104 return NotImplemented(
"GetHalfLengthZ");
108 return NotImplemented(
"GetInnerRadius");
112 return NotImplemented(
"GetOuterRadius");
115 virtual double GetRadius()
const {
return NotImplemented(
"GetRadius"); }
118 return NotImplemented(
"GetLowerRadius");
122 return NotImplemented(
"GetUpperRadius");
126 return NotImplemented(
"GetRidgeOffset");
130 return NotImplemented(
"GetRidgeHeight");
133 virtual bool GetProfile(std::vector<double>& xv,
134 std::vector<double>& yv)
const;
137 unsigned int GetId()
const {
return m_id; }
147 virtual void Cut(
const double x0,
const double y0,
const double z0,
148 const double xn,
const double yn,
const double zn,
149 std::vector<Panel>& panels) = 0;
194 static bool Intersect(
const double x1,
const double y1,
const double z1,
195 const double x2,
const double y2,
const double z2,
196 const double x0,
const double y0,
const double z0,
197 const double a,
const double b,
const double c,
198 double& xc,
double& yc,
double& zc);
234 void ToLocal(
const double x,
const double y,
const double z,
double& u,
235 double& v,
double& w)
const {
236 const double dx = x -
m_cX;
237 const double dy = y -
m_cY;
238 const double dz = z -
m_cZ;
246 void ToGlobal(
const double u,
const double v,
const double w,
double& x,
247 double& y,
double& z)
const {
254 double& u,
double& v,
double& w) {
260 void SetDirection(
const double dx,
const double dy,
const double dz);
263 double NotImplemented(
const std::string& fcn)
const;
265 static unsigned int s_id;
Abstract base class for solids.
void SetBoundaryChargeDensity(const double q)
Apply fixed-charge boundary conditions.
void EnableDebugging(const bool on=true)
Switch debugging messages on/off.
virtual double GetUpperRadius() const
Return the upper radius (of a hole).
double m_charge
Surface charge density.
virtual bool IsTube() const
Return true if the solid is a tube.
virtual bool IsRidge() const
Return true if the solid is a ridge.
virtual double GetHalfLengthX() const
Return the half-length along x.
virtual bool IsHole() const
Return true if the solid is a hole.
std::string GetLabel() const
Return the label.
void VectorToLocal(const double x, const double y, const double z, double &u, double &v, double &w)
Transform a vector from global to local coordinates.
void SetBoundaryPotential(const double v)
Apply Dirichlet boundary conditions (fixed voltage).
double m_eps
Dielectric constant.
double m_cTheta
Polar angle.
virtual double GetHalfLengthZ() const
Return the half-length along z.
virtual ~Solid()
Destructor.
virtual bool IsBox() const
Return true if the solid is a box.
virtual double GetHalfLengthY() const
Return the half-length along y.
static bool Intersect(const double x1, const double y1, const double z1, const double x2, const double y2, const double z2, const double x0, const double y0, const double z0, const double a, const double b, const double c, double &xc, double &yc, double &zc)
double m_dX
Direction vector.
std::string m_label
Label.
virtual bool IsExtrusion() const
Return true if the solid is an extrusion.
bool GetCentre(double &x, double &y, double &z) const
Retrieve the centre point of the solid.
virtual double GetDiscretisationLevel(const Panel &panel)=0
Retrieve the discretisation level of a panel.
unsigned int GetId() const
Get the ID of the solid.
double GetBoundaryChargeDensity() const
Retrieve the surface charge density.
bool GetDirection(double &dx, double &dy, double &dz) const
Retrieve the direction vector.
void ToLocal(const double x, const double y, const double z, double &u, double &v, double &w) const
void SetDirection(const double dx, const double dy, const double dz)
virtual bool GetProfile(std::vector< double > &xv, std::vector< double > &yv) const
Get the vertices defining an extrusion.
BoundaryCondition GetBoundaryConditionType() const
Retrieve the type of boundary condition.
Solid(const double cx, const double cy, const double cz, const std::string &name)
Constructor.
virtual double GetRidgeOffset() const
Return the x-offset of a ridge.
double m_volt
Potential at the surface.
BoundaryCondition m_bctype
Type of boundary condition.
virtual double GetLowerRadius() const
Return the lower radius (of a hole).
virtual void Cut(const double x0, const double y0, const double z0, const double xn, const double yn, const double zn, std::vector< Panel > &panels)=0
virtual double GetOuterRadius() const
Return the outer radius.
double GetBoundaryPotential() const
Retrieve the potential.
void SetBoundaryParallelField()
bool GetOrientation(double &ctheta, double &stheta, double &cphi, double &sphi) const
Retrieve the orientation (azimuthal and polar angles) of the solid.
virtual bool IsWire() const
Return true if the solid is a wire.
void SetBoundaryPerpendicularField()
void ToGlobal(const double u, const double v, const double w, double &x, double &y, double &z) const
int GetColour() const
Get the colour of the solid.
virtual bool IsInside(const double x, const double y, const double z, const bool tesselated=false) const =0
virtual void SetDiscretisationLevel(const double dis)=0
Set the discretisation level (for all panels).
virtual double GetRadius() const
Return the radius.
virtual bool IsSphere() const
Return true if the solid is a sphere.
void SetColour(const int col)
Set the colour of the solid.
virtual bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const =0
Return the bounding box of the solid.
void SetLabel(const std::string &label)
Set a label.
double m_cX
Centre of the solid.
virtual double GetInnerRadius() const
Return the inner radius.
virtual double GetRidgeHeight() const
Return the height of a ridge.
double m_cPhi
Azimuthal angle.
void SetBoundaryFloat()
Make the potential at the surface of the solid floating.
virtual bool SolidPanels(std::vector< Panel > &panels)=0
Retrieve the surface panels of the solid.
std::string m_className
Class name.
Solid()=delete
Default constructor.
void SetBoundaryDielectric()
Make the surfaces of the solid dielectric-dielectric interfaces.
std::vector< double > zv
Z-coordinates of vertices.
int volume
Reference to solid to which the panel belongs.
double a
Perpendicular vector.
std::vector< double > xv
X-coordinates of vertices.
std::vector< double > yv
Y-coordinates of vertices.