Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
Mantid::Geometry::Quadratic Class Referenceabstract

Holds a basic quadratic surface. More...

#include <Quadratic.h>

Inheritance diagram for Mantid::Geometry::Quadratic:
Mantid::Geometry::Surface Mantid::Geometry::Cone Mantid::Geometry::Cylinder Mantid::Geometry::General Mantid::Geometry::Plane Mantid::Geometry::Sphere

Public Member Functions

void acceptVisitor (BaseVisit &A) const override
 Accept visitor for line calculation. More...
 
std::string className () const override
 Effective typeid. More...
 
std::unique_ptr< Quadraticclone () const
 
const std::vector< double > & copyBaseEqn () const
 access BaseEquation vector More...
 
void displace (const Kernel::V3D &) override
 Apply a general displacement to the surface. More...
 
double distance (const Kernel::V3D &) const override
 distance between point and surface (approx) More...
 
double eqnValue (const Kernel::V3D &) const
 Helper function to calcuate the value of the equation at a fixed point. More...
 
bool onSurface (const Kernel::V3D &) const override
 is point valid on surface More...
 
void print () const override
 Print out the genreal equation for debugging. More...
 
 Quadratic ()
 Constructor. More...
 
void rotate (const Kernel::Matrix< double > &) override
 Rotate the surface by matrix MX. More...
 
virtual void setBaseEqn ()=0
 Abstract set baseEqn. More...
 
int side (const Kernel::V3D &) const override
 Determine if the the Point is true to the surface or on the other side. More...
 
Kernel::V3D surfaceNormal (const Kernel::V3D &) const override
 Normal at surface. More...
 
void write (std::ostream &) const override
 Writes out an MCNPX surface description Note : Swap since base equation is swapped in gq output (mcnp 4c manual pg. More...
 
- Public Member Functions inherited from Mantid::Geometry::Surface
virtual void acceptVisitor (BaseVisit &A) const
 Accept visitor for line calculation. More...
 
virtual std::string className () const
 Effective typeid. More...
 
std::unique_ptr< Surfaceclone () const
 
virtual void displace (const Kernel::V3D &)=0
 translates the surface More...
 
virtual double distance (const Kernel::V3D &) const =0
 returns the minimum distance to the surface More...
 
virtual void getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin)=0
 bounding box for the surface More...
 
int getName () const
 Get Name. More...
 
virtual bool onSurface (const Kernel::V3D &R) const =0
 is point valid on surface More...
 
Surfaceoperator= (const Surface &)=delete
 
virtual void print () const
 Simple print out function for surface header. More...
 
virtual void rotate (const Kernel::Matrix< double > &)=0
 rotates the surface More...
 
void setName (int const N)
 Set Name. More...
 
virtual int setSurface (const std::string &R)=0
 Sets the surface based on a string input in MCNPX format. More...
 
virtual int side (const Kernel::V3D &) const
 Surface side : throw AbsObjMethod. More...
 
 Surface ()
 Constructor. More...
 
virtual Kernel::V3D surfaceNormal (const Kernel::V3D &) const =0
 returns the normal to the closest point on the surface More...
 
virtual void write (std::ostream &) const
 The writes the data to the output stream. More...
 
void writeHeader (std::ostream &) const
 Writes out the start of an MCNPX surface description . More...
 
virtual ~Surface ()=default
 

Static Public Attributes

static const int Nprecision = 10
 Precision of the output. More...
 
- Static Public Attributes inherited from Mantid::Geometry::Surface
static const int Nprecision = 10
 Precision of the output. More...
 

Protected Member Functions

Quadraticoperator= (const Quadratic &)=delete
 
 Quadratic (const Quadratic &)=default
 
- Protected Member Functions inherited from Mantid::Geometry::Surface
 Surface (const Surface &)=default
 

Protected Attributes

std::vector< double > BaseEqn
 Base equation (as a 10 point vector) More...
 

Private Member Functions

QuadraticdoClone () const override=0
 Abstract clone function. More...
 
void matrixForm (Kernel::Matrix< double > &, Kernel::V3D &, double &) const
 Converts the baseEqn into the matrix form such that. More...
 

Detailed Description

Holds a basic quadratic surface.

Author
S. Ansell
Date
April 2004
Version
1.0

Holds a basic surface with equation form

\[ Ax^2+By^2+Cz^2+Dxy+Exz+Fyz+Gx+Hy+Jz+K=0 \]

Definition at line 29 of file Quadratic.h.

Constructor & Destructor Documentation

◆ Quadratic() [1/2]

Mantid::Geometry::Quadratic::Quadratic ( const Quadratic )
protecteddefault

◆ Quadratic() [2/2]

Mantid::Geometry::Quadratic::Quadratic ( )

Constructor.

Definition at line 38 of file Quadratic.cpp.

Member Function Documentation

◆ acceptVisitor()

void Mantid::Geometry::Quadratic::acceptVisitor ( BaseVisit A) const
inlineoverridevirtual

Accept visitor for line calculation.

Reimplemented from Mantid::Geometry::Surface.

Reimplemented in Mantid::Geometry::Sphere.

Definition at line 46 of file Quadratic.h.

References Mantid::Geometry::BaseVisit::Accept().

◆ className()

std::string Mantid::Geometry::Quadratic::className ( ) const
inlineoverridevirtual

Effective typeid.

Reimplemented from Mantid::Geometry::Surface.

Reimplemented in Mantid::Geometry::Sphere.

Definition at line 49 of file Quadratic.h.

◆ clone()

std::unique_ptr< Quadratic > Mantid::Geometry::Quadratic::clone ( ) const

Definition at line 331 of file Quadratic.cpp.

References doClone().

◆ copyBaseEqn()

const std::vector< double > & Mantid::Geometry::Quadratic::copyBaseEqn ( ) const
inline

access BaseEquation vector

Definition at line 51 of file Quadratic.h.

◆ displace()

void Mantid::Geometry::Quadratic::displace ( const Kernel::V3D Pt)
overridevirtual

Apply a general displacement to the surface.

Parameters
Pt:: Point to add to surface coordinate

Implements Mantid::Geometry::Surface.

Reimplemented in Mantid::Geometry::Sphere.

Definition at line 244 of file Quadratic.cpp.

References BaseEqn.

Referenced by Mantid::Geometry::Cylinder::displace(), Mantid::Geometry::Plane::displace(), and Mantid::Geometry::Sphere::displace().

◆ distance()

double Mantid::Geometry::Quadratic::distance ( const Kernel::V3D Pt) const
overridevirtual

distance between point and surface (approx)

Proper calcuation of a point to a general surface.

Parameters
Pt:: Point to calculate distance from surace
Returns
distance from point to surface (signed)

Implements Mantid::Geometry::Surface.

Reimplemented in Mantid::Geometry::Sphere.

Definition at line 123 of file Quadratic.cpp.

References Mantid::Kernel::Matrix< T >::Diagonalise(), Mantid::Kernel::V3D::distance(), Mantid::mathLevel::PolyBase::realRoots(), Mantid::Kernel::Tolerance, and Mantid::Kernel::Matrix< T >::Tprime().

◆ doClone()

Quadratic * Mantid::Geometry::Quadratic::doClone ( ) const
overrideprivatepure virtual

◆ eqnValue()

double Mantid::Geometry::Quadratic::eqnValue ( const Kernel::V3D Pt) const

Helper function to calcuate the value of the equation at a fixed point.

Parameters
Pt:: Point to determine the equation surface value at
Returns
value Eqn(Pt) : -ve inside +ve outside

Definition at line 45 of file Quadratic.cpp.

◆ matrixForm()

void Mantid::Geometry::Quadratic::matrixForm ( Kernel::Matrix< double > &  A,
Kernel::V3D B,
double &  C 
) const
private

Converts the baseEqn into the matrix form such that.

\[ x^T A x + B^T x + C =0 \]

Parameters
A:: Matrix to place equation into
B:: Vector point
C:: Constant value

Definition at line 101 of file Quadratic.cpp.

◆ onSurface()

bool Mantid::Geometry::Quadratic::onSurface ( const Kernel::V3D Pt) const
overridevirtual

is point valid on surface

Test to see if a point is on the surface.

Parameters
Pt:: Point to test
Returns
0 : if not on surface; 1 if on surace

Implements Mantid::Geometry::Surface.

Reimplemented in Mantid::Geometry::Sphere.

Definition at line 233 of file Quadratic.cpp.

References Mantid::Kernel::Tolerance.

Referenced by Mantid::Geometry::Cylinder::onSurface().

◆ operator=()

Quadratic & Mantid::Geometry::Quadratic::operator= ( const Quadratic )
protecteddelete

◆ print()

void Mantid::Geometry::Quadratic::print ( ) const
overridevirtual

Print out the genreal equation for debugging.

Reimplemented from Mantid::Geometry::Surface.

Definition at line 298 of file Quadratic.cpp.

References BaseEqn, and Mantid::Geometry::Surface::print().

Referenced by Mantid::Geometry::Cylinder::print(), and Mantid::Geometry::Plane::print().

◆ rotate()

void Mantid::Geometry::Quadratic::rotate ( const Kernel::Matrix< double > &  MX)
overridevirtual

Rotate the surface by matrix MX.

Parameters
MX:: Matrix for rotation (not inverted like MCNPX)

Implements Mantid::Geometry::Surface.

Reimplemented in Mantid::Geometry::Sphere.

Definition at line 258 of file Quadratic.cpp.

References BaseEqn, Mantid::Geometry::d, and Mantid::Kernel::Matrix< T >::Invert().

Referenced by Mantid::Geometry::Cylinder::rotate(), Mantid::Geometry::Plane::rotate(), and Mantid::Geometry::Sphere::rotate().

◆ setBaseEqn()

virtual void Mantid::Geometry::Quadratic::setBaseEqn ( )
pure virtual

◆ side()

int Mantid::Geometry::Quadratic::side ( const Kernel::V3D Pt) const
overridevirtual

Determine if the the Point is true to the surface or on the other side.

Parameters
Pt:: Point to check
Return values
1: if the point is "true" to the surface
-1: if the point is "false" to the surface
0:: The point is on the surface

Reimplemented from Mantid::Geometry::Surface.

Reimplemented in Mantid::Geometry::Sphere.

Definition at line 68 of file Quadratic.cpp.

References fabs, and Mantid::Kernel::Tolerance.

Referenced by Mantid::Geometry::Cylinder::side().

◆ surfaceNormal()

Kernel::V3D Mantid::Geometry::Quadratic::surfaceNormal ( const Kernel::V3D Pt) const
overridevirtual

Normal at surface.

Given a point on the surface Calculate the normal at the point Some rather disturbing behaviour happens if the point is a significant distance from the surface.

Parameters
Pt:: Point to calcution
Returns
normal unit vector

Implements Mantid::Geometry::Surface.

Definition at line 84 of file Quadratic.cpp.

References Mantid::Kernel::V3D::normalize().

◆ write()

void Mantid::Geometry::Quadratic::write ( std::ostream &  OX) const
overridevirtual

Writes out an MCNPX surface description Note : Swap since base equation is swapped in gq output (mcnp 4c manual pg.

3-14)

Parameters
OX:: Output stream (required for multiple std::endl)

Reimplemented from Mantid::Geometry::Surface.

Reimplemented in Mantid::Geometry::Sphere.

Definition at line 310 of file Quadratic.cpp.

References Mantid::Geometry::Surface::Nprecision, and Mantid::Kernel::Strings::writeMCNPX().

Referenced by Mantid::Geometry::Cone::write(), and Mantid::Geometry::Cylinder::write().

Member Data Documentation

◆ BaseEqn

std::vector<double> Mantid::Geometry::Quadratic::BaseEqn
protected

◆ Nprecision

const int Mantid::Geometry::Quadratic::Nprecision = 10
static

Precision of the output.

Definition at line 40 of file Quadratic.h.


The documentation for this class was generated from the following files: