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 <map>
13#include <memory>
14#include <optional>
15#include <vector>
16
17namespace Mantid {
18
19//----------------------------------------------------------------------
20// Forward declarations
21//----------------------------------------------------------------------
22namespace Kernel {
23class PseudoRandomNumberGenerator;
24class Material;
25class V3D;
26} // namespace Kernel
27
28namespace Geometry {
29class BoundingBox;
30class GeometryHandler;
31class Surface;
32class Track;
33class vtkGeometryCacheReader;
34class vtkGeometryCacheWriter;
35
42class MANTID_GEOMETRY_DLL IObject {
43public:
44 virtual ~IObject() = default;
45 virtual bool isValid(const Kernel::V3D &) const = 0;
46 virtual bool isOnSide(const Kernel::V3D &) const = 0;
47 virtual bool isFiniteGeometry() const { return true; }
48 virtual void setFiniteGeometryFlag(bool) {}
49 virtual bool hasValidShape() const = 0;
50 virtual IObject *clone() const = 0;
51 virtual IObject *cloneWithMaterial(const Kernel::Material &material) const = 0;
52
53 virtual int getName() const = 0;
54
55 virtual int interceptSurface(Geometry::Track &) const = 0;
56 virtual double distance(const Geometry::Track &) const = 0;
57 // Solid angle
58 virtual double solidAngle(const SolidAngleParams &params) const = 0;
59 // Solid angle with a scaling of the object
60 virtual double solidAngle(const SolidAngleParams &params, const Kernel::V3D &scaleFactor) const = 0;
62 virtual const BoundingBox &getBoundingBox() const = 0;
65 virtual void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin,
66 double &zmin) const = 0;
67 virtual double volume() const = 0;
68
69 virtual int getPointInObject(Kernel::V3D &point) const = 0;
70
71 virtual std::optional<Kernel::V3D> generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng,
72 const size_t) const = 0;
73 virtual std::optional<Kernel::V3D> generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng,
74 const BoundingBox &activeRegion, const size_t) const = 0;
75
77 virtual const detail::ShapeInfo &shapeInfo() const = 0;
78 virtual void GetObjectGeom(detail::ShapeInfo::GeometryShape &type, std::vector<Kernel::V3D> &vectors,
79 double &innerRadius, double &radius, double &height) const = 0;
80 // Rendering
81 virtual void draw() const = 0;
82 virtual void initDraw() const = 0;
83
84 virtual const Kernel::Material &material() const = 0;
85 virtual void setMaterial(const Kernel::Material &material) = 0;
86 virtual const std::string &id() const = 0;
87 virtual void setID(const std::string &id) = 0;
88
89 virtual std::shared_ptr<GeometryHandler> getGeometryHandler() const = 0;
90};
91
93using IObject_sptr = std::shared_ptr<IObject>;
95using IObject_const_sptr = std::shared_ptr<const IObject>;
97using IObject_uptr = std::unique_ptr<IObject>;
99using IObject_const_uptr = std::unique_ptr<const IObject>;
100
101} // namespace Geometry
102} // 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:42
virtual bool isOnSide(const Kernel::V3D &) const =0
virtual int getPointInObject(Kernel::V3D &point) const =0
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:48
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:47
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
Defines a 1D pseudo-random number generator, i.e.
Class for 3D vectors.
Definition V3D.h:34
std::unique_ptr< const IObject > IObject_const_uptr
Typdef for a unique pointer to a const object.
Definition IObject.h:99
std::unique_ptr< IObject > IObject_uptr
Typdef for a unique pointer.
Definition IObject.h:97
std::shared_ptr< const IObject > IObject_const_sptr
Typdef for a shared pointer to a const object.
Definition IObject.h:95
std::shared_ptr< IObject > IObject_sptr
Typdef for a shared pointer.
Definition IObject.h:93
Helper class which provides the Collimation Length for SANS instruments.