Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Geometry.hh
Go to the documentation of this file.
1#ifndef G_GEOMETRY_H
2#define G_GEOMETRY_H
3
4#include <string>
5
6#include "Medium.hh"
7#include "Solid.hh"
8
9namespace Garfield {
10
11/// Abstract base class for geometry classes.
12
13class Geometry {
14 public:
15 /// Default constructor.
16 Geometry() = delete;
17 /// Constructor
18 Geometry(const std::string& name) : m_className(name) {}
19 /// Destructor
20 virtual ~Geometry() {}
21
22 /// Retrieve the medium at a given point.
23 virtual Medium* GetMedium(const double x, const double y, const double z,
24 const bool tesselated = false) const = 0;
25
26 /// Return the number of solids in the geometry.
27 virtual size_t GetNumberOfSolids() const { return 0; }
28 /// Get a solid from the list.
29 virtual Solid* GetSolid(const size_t /*i*/) const { return nullptr; }
30 /// Get a solid from the list, together with the associated medium.
31 virtual Solid* GetSolid(const size_t /*i*/, Medium*& medium) const {
32 medium = nullptr;
33 return nullptr;
34 }
35 /// Check if a point is inside the geometry.
36 virtual bool IsInside(const double x, const double y, const double z,
37 const bool tesselated = false) const = 0;
38
39 /// Get the bounding box (envelope of the geometry).
40 virtual bool GetBoundingBox(double& xmin, double& ymin, double& zmin,
41 double& xmax, double& ymax, double& zmax) = 0;
42
43 protected:
44 std::string m_className = "Geometry";
45};
46}
47
48#endif
Abstract base class for geometry classes.
Definition: Geometry.hh:13
Geometry(const std::string &name)
Constructor.
Definition: Geometry.hh:18
virtual Solid * GetSolid(const size_t) const
Get a solid from the list.
Definition: Geometry.hh:29
virtual Solid * GetSolid(const size_t, Medium *&medium) const
Get a solid from the list, together with the associated medium.
Definition: Geometry.hh:31
virtual bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)=0
Get the bounding box (envelope of the geometry).
virtual size_t GetNumberOfSolids() const
Return the number of solids in the geometry.
Definition: Geometry.hh:27
std::string m_className
Definition: Geometry.hh:44
virtual Medium * GetMedium(const double x, const double y, const double z, const bool tesselated=false) const =0
Retrieve the medium at a given point.
virtual bool IsInside(const double x, const double y, const double z, const bool tesselated=false) const =0
Check if a point is inside the geometry.
Geometry()=delete
Default constructor.
virtual ~Geometry()
Destructor.
Definition: Geometry.hh:20
Abstract base class for media.
Definition: Medium.hh:13
Abstract base class for solids.
Definition: Solid.hh:28