Mantid
Loading...
Searching...
No Matches
IObject.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2017 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidGeometry/DllConfig.h"
12#include "MantidKernel/Matrix.h"
13#include <map>
14#include <memory>
15#include <optional>
16#include <vector>
17
18namespace Mantid {
19
20//----------------------------------------------------------------------
21// Forward declarations
22//----------------------------------------------------------------------
23namespace Kernel {
24class PseudoRandomNumberGenerator;
25class Material;
26class V3D;
27} // namespace Kernel
28
29namespace Geometry {
30class BoundingBox;
31class GeometryHandler;
32class Surface;
33class Track;
34class vtkGeometryCacheReader;
35class vtkGeometryCacheWriter;
36
43class MANTID_GEOMETRY_DLL IObject {
44public:
45 virtual ~IObject() = default;
46 virtual bool isValid(const Kernel::V3D &) const = 0;
47 virtual bool isOnSide(const Kernel::V3D &) const = 0;
48 virtual bool isFiniteGeometry() const { return true; }
49 virtual void setFiniteGeometryFlag(bool) {}
50 virtual bool hasValidShape() const = 0;
51
60 static const Kernel::Matrix<double> identity(3, 3, true);
61 return identity;
62 }
63 virtual IObject *clone() const = 0;
64 virtual IObject *cloneWithMaterial(const Kernel::Material &material) const = 0;
65
66 virtual int getName() const = 0;
67
68 virtual int interceptSurface(Geometry::Track &) const = 0;
69 virtual double distance(const Geometry::Track &) const = 0;
70 // Solid angle
71 virtual double solidAngle(const SolidAngleParams &params) const = 0;
72 // Solid angle with a scaling of the object
73 virtual double solidAngle(const SolidAngleParams &params, const Kernel::V3D &scaleFactor) const = 0;
75 virtual const BoundingBox &getBoundingBox() const = 0;
78 virtual void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin,
79 double &zmin) const = 0;
80 virtual double volume() const = 0;
81
82 virtual int getPointInObject(Kernel::V3D &point) const = 0;
83
84 virtual std::optional<Kernel::V3D> generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng,
85 const size_t) const = 0;
86 virtual std::optional<Kernel::V3D> generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng,
87 const BoundingBox &activeRegion, const size_t) const = 0;
88
90 virtual const detail::ShapeInfo &shapeInfo() const = 0;
91 virtual void GetObjectGeom(detail::ShapeInfo::GeometryShape &type, std::vector<Kernel::V3D> &vectors,
92 double &innerRadius, double &radius, double &height) const = 0;
93 // Rendering
94 virtual void draw() const = 0;
95 virtual void initDraw() const = 0;
96
97 virtual const Kernel::Material &material() const = 0;
98 virtual void setMaterial(const Kernel::Material &material) = 0;
99 virtual const std::string &id() const = 0;
100 virtual void setID(const std::string &id) = 0;
101
102 virtual std::shared_ptr<GeometryHandler> getGeometryHandler() const = 0;
103};
104
106using IObject_sptr = std::shared_ptr<IObject>;
108using IObject_const_sptr = std::shared_ptr<const IObject>;
110using IObject_uptr = std::unique_ptr<IObject>;
112using IObject_const_uptr = std::unique_ptr<const IObject>;
113
114} // namespace Geometry
115} // namespace Mantid
double height
Definition GetAllEi.cpp:155
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
Definition BoundingBox.h:33
IObject : Interface for geometry objects.
Definition IObject.h:43
virtual bool isOnSide(const Kernel::V3D &) const =0
virtual int getPointInObject(Kernel::V3D &point) const =0
virtual const Kernel::Matrix< double > & getAppliedRotation() const
The goniometer rotation baked into this shape, i.e.
Definition IObject.h:59
virtual void GetObjectGeom(detail::ShapeInfo::GeometryShape &type, std::vector< Kernel::V3D > &vectors, double &innerRadius, double &radius, double &height) const =0
virtual void initDraw() const =0
virtual int interceptSurface(Geometry::Track &) const =0
virtual std::shared_ptr< GeometryHandler > getGeometryHandler() const =0
virtual double distance(const Geometry::Track &) const =0
virtual const detail::ShapeInfo & shapeInfo() const =0
virtual double solidAngle(const SolidAngleParams &params) const =0
virtual IObject * cloneWithMaterial(const Kernel::Material &material) const =0
virtual std::optional< Kernel::V3D > generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng, const BoundingBox &activeRegion, const size_t) const =0
virtual void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const =0
Calculate (or return cached value of) Axis Aligned Bounding box (DEPRECATED)
virtual void setID(const std::string &id)=0
virtual void setMaterial(const Kernel::Material &material)=0
virtual detail::ShapeInfo::GeometryShape shape() const =0
virtual std::optional< Kernel::V3D > generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng, const size_t) const =0
virtual const std::string & id() const =0
virtual ~IObject()=default
virtual void setFiniteGeometryFlag(bool)
Definition IObject.h:49
virtual bool isValid(const Kernel::V3D &) const =0
virtual double volume() const =0
virtual double solidAngle(const SolidAngleParams &params, const Kernel::V3D &scaleFactor) const =0
virtual int getName() const =0
virtual const BoundingBox & getBoundingBox() const =0
Return cached value of axis-aligned bounding box.
virtual const Kernel::Material & material() const =0
virtual bool isFiniteGeometry() const
Definition IObject.h:48
virtual IObject * clone() const =0
virtual void draw() const =0
virtual bool hasValidShape() const =0
Defines a track as a start point and a direction.
Definition Track.h:165
A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAt...
Definition Material.h:50
Numerical Matrix class.
Definition Matrix.h:41
Defines a 1D pseudo-random number generator, i.e.
Class for 3D vectors.
Definition V3D.h:35
std::unique_ptr< const IObject > IObject_const_uptr
Typdef for a unique pointer to a const object.
Definition IObject.h:112
std::unique_ptr< IObject > IObject_uptr
Typdef for a unique pointer.
Definition IObject.h:110
std::shared_ptr< const IObject > IObject_const_sptr
Typdef for a shared pointer to a const object.
Definition IObject.h:108
std::shared_ptr< IObject > IObject_sptr
Typdef for a shared pointer.
Definition IObject.h:106
Helper class which provides the Collimation Length for SANS instruments.