Mantid
Loading...
Searching...
No Matches
Surface.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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 "BaseVisit.h"
10#include "MantidGeometry/DllConfig.h"
11#include <memory>
12#include <string>
13
14class TopoDS_Shape;
15
16namespace Mantid {
17namespace Kernel {
18class V3D;
19template <class T> class Matrix;
20} // namespace Kernel
21namespace Geometry {
22
33class MANTID_GEOMETRY_DLL Surface {
34private:
35 int Name;
36 virtual Surface *doClone() const = 0;
37protected:
38 Surface(const Surface &) = default;
39
40public:
41 static const int Nprecision = 10;
42
43 Surface();
44 std::unique_ptr<Surface> clone() const { return std::unique_ptr<Surface>(doClone()); };
45
46 Surface &operator=(const Surface &) = delete;
47 virtual ~Surface() = default;
48
50 virtual std::string className() const { return "Surface"; }
51
53 virtual void acceptVisitor(BaseVisit &A) const { A.Accept(*this); }
54
55 void setName(int const N) { Name = N; }
56 int getName() const { return Name; }
57
59 virtual int setSurface(const std::string &R) = 0;
60 virtual int side(const Kernel::V3D &) const;
61
63 virtual bool onSurface(const Kernel::V3D &R) const = 0;
64
66 virtual double distance(const Kernel::V3D &) const = 0;
68 virtual Kernel::V3D surfaceNormal(const Kernel::V3D &) const = 0;
69
71 virtual void displace(const Kernel::V3D &) = 0;
73 virtual void rotate(const Kernel::Matrix<double> &) = 0;
74
75 void writeHeader(std::ostream &) const;
76 virtual void write(std::ostream &) const;
77 virtual void print() const;
79 virtual void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) = 0;
80#ifdef ENABLE_OPENCASCADE
81 virtual TopoDS_Shape createShape();
82#endif
83};
84
85} // NAMESPACE Geometry
86
87} // NAMESPACE Mantid
virtual void Accept(const Surface &)=0
Accept a surface.
Holds a basic quadratic surface.
Definition: Surface.h:33
virtual int setSurface(const std::string &R)=0
Sets the surface based on a string input in MCNPX format.
virtual double distance(const Kernel::V3D &) const =0
returns the minimum distance to the surface
virtual bool onSurface(const Kernel::V3D &R) const =0
is point valid on surface
Surface & operator=(const Surface &)=delete
virtual Surface * doClone() const =0
Abstract clone function.
virtual void rotate(const Kernel::Matrix< double > &)=0
rotates the surface
virtual std::string className() const
Effective typeid.
Definition: Surface.h:50
virtual void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin)=0
bounding box for the surface
int Name
Surface number (MCNPX identifier)
Definition: Surface.h:35
virtual void acceptVisitor(BaseVisit &A) const
Accept visitor for line calculation.
Definition: Surface.h:53
virtual void displace(const Kernel::V3D &)=0
translates the surface
Surface(const Surface &)=default
virtual ~Surface()=default
int getName() const
Get Name.
Definition: Surface.h:56
void setName(int const N)
Set Name.
Definition: Surface.h:55
std::unique_ptr< Surface > clone() const
Definition: Surface.h:44
virtual Kernel::V3D surfaceNormal(const Kernel::V3D &) const =0
returns the normal to the closest point on the surface
Numerical Matrix class.
Definition: Matrix.h:42
Class for 3D vectors.
Definition: V3D.h:34
Helper class which provides the Collimation Length for SANS instruments.