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

Holds a cylinder as a vector form. More...

#include <Cylinder.h>

Inheritance diagram for Mantid::Geometry::Cylinder:
Mantid::Geometry::Quadratic Mantid::Geometry::Surface

Public Member Functions

void acceptVisitor (BaseVisit &A) const override
 Accept visitor for line calculation. More...
 
std::string className () const override
 Public identifer. More...
 
std::unique_ptr< Cylinderclone () const
 Makes a clone (implicit virtual copy constructor) More...
 
 Cylinder ()
 Standard Constructor creats a cylinder (radius 0) along the x axis. More...
 
double distance (const Kernel::V3D &) const override
 Calculates the distance of point A from the surface of the cylinder. More...
 
void getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) override
 bounding box for the surface More...
 
Kernel::V3D getCentre () const
 Return centre point. More...
 
Kernel::V3D getNormal () const
 Return Central line. More...
 
double getRadius () const
 Get Radius. More...
 
virtual double lineIntersect (const Kernel::V3D &, const Kernel::V3D &) const
 Given a track starting from Pt and traveling along uVec determine the intersection point (distance) More...
 
bool onSurface (const Kernel::V3D &) const override
 Calculate if the point PT on the cylinder. More...
 
void print () const override
 Debug routine to print out basic information. More...
 
void setBaseEqn () override
 Sets an equation of type (cylinder) More...
 
void setCentre (const Kernel::V3D &)
 Sets the centre Kernel::V3D. More...
 
void setNorm (const Kernel::V3D &)
 Sets the centre line unit vector A does not need to be a unit vector. More...
 
void setRadius (const double &r)
 Set Radius. More...
 
int setSurface (const std::string &) override
 Processes a standard MCNPX cone string Recall that cones can only be specified on an axis Valid input is: More...
 
int side (const Kernel::V3D &) const override
 Calculate if the point PT within the middle of the cylinder. More...
 
void write (std::ostream &) const override
 Write out the cylinder for MCNPX. More...
 
- Public Member Functions inherited from Mantid::Geometry::Quadratic
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 constexpr int g_NSLICES = 10
 The number of slices to approximate a cylinder. More...
 
static constexpr int g_NSTACKS = 1
 The number of stacks to approximate a cylinder. More...
 
- Static Public Attributes inherited from Mantid::Geometry::Quadratic
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

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

Private Member Functions

void displace (const Kernel::V3D &) override
 Apply a displacement Pt. More...
 
CylinderdoClone () const override
 Makes a clone (implicit virtual copy constructor) More...
 
void rotate (const Kernel::Matrix< double > &) override
 Apply a rotation to the cylinder and re-check the status of the main axis. More...
 
void setNormVec ()
 check to obtain orientation More...
 
void setRadiusInternal (const double &r)
 

Private Attributes

Kernel::V3D m_centre
 Kernel::V3D for centre. More...
 
Kernel::V3D m_normal
 Direction of centre line. More...
 
std::size_t m_normVec
 Normal vector is x,y or z :: (1-3) (0 if general) More...
 
double m_oneoverradius
 
double m_radius
 Radius of cylinder. More...
 

Static Private Attributes

static Kernel::LoggerPLog
 The official logger. More...
 

Additional Inherited Members

- Protected Attributes inherited from Mantid::Geometry::Quadratic
std::vector< double > BaseEqn
 Base equation (as a 10 point vector) More...
 

Detailed Description

Holds a cylinder as a vector form.

Author
S. Ansell
Date
April 2004
Version
1.0

Defines a cylinder as a centre point (on main axis) a vector from that point (unit) and a radius.

Definition at line 32 of file Cylinder.h.

Constructor & Destructor Documentation

◆ Cylinder() [1/2]

Mantid::Geometry::Cylinder::Cylinder ( const Cylinder )
protecteddefault

◆ Cylinder() [2/2]

Mantid::Geometry::Cylinder::Cylinder ( )

Standard Constructor creats a cylinder (radius 0) along the x axis.

Definition at line 40 of file Cylinder.cpp.

References setBaseEqn().

Referenced by doClone().

Member Function Documentation

◆ acceptVisitor()

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

Accept visitor for line calculation.

Reimplemented from Mantid::Geometry::Surface.

Definition at line 63 of file Cylinder.h.

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

◆ className()

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

Public identifer.

Reimplemented from Mantid::Geometry::Surface.

Definition at line 57 of file Cylinder.h.

◆ clone()

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

Makes a clone (implicit virtual copy constructor)

Returns
Copy(*this)

Definition at line 60 of file Cylinder.cpp.

References doClone().

◆ displace()

void Mantid::Geometry::Cylinder::displace ( const Kernel::V3D Pt)
overrideprivatevirtual

Apply a displacement Pt.

Parameters
Pt:: Displacement to add to the centre

Implements Mantid::Geometry::Surface.

Definition at line 196 of file Cylinder.cpp.

References Mantid::Geometry::Quadratic::displace(), m_centre, and m_normVec.

◆ distance()

double Mantid::Geometry::Cylinder::distance ( const Kernel::V3D A) const
overridevirtual

Calculates the distance of point A from the surface of the cylinder.

Parameters
A:: Point to calculate distance from
Returns
:: +ve distance to the surface.
Todo:
INCOMPLETE AS Does not deal with the case of non axis centre line (has been updated?? )

Implements Mantid::Geometry::Surface.

Definition at line 251 of file Cylinder.cpp.

References Mantid::Kernel::V3D::distance(), fabs, lambda, and Mantid::Kernel::V3D::scalar_prod().

◆ doClone()

Cylinder * Mantid::Geometry::Cylinder::doClone ( ) const
overrideprivatevirtual

Makes a clone (implicit virtual copy constructor)

Returns
Copy(*this)

Implements Mantid::Geometry::Quadratic.

Definition at line 51 of file Cylinder.cpp.

References Cylinder().

Referenced by clone().

◆ getBoundingBox()

void Mantid::Geometry::Cylinder::getBoundingBox ( double &  xmax,
double &  ymax,
double &  zmax,
double &  xmin,
double &  ymin,
double &  zmin 
)
overridevirtual

bounding box for the surface

Cylinder bounding box find the intersection points of the axis of cylinder with the input bounding box. Using the end points calculate improved limits on the bounding box, if possible.

Parameters
xmax:: On input, existing Xmax bound, on exit possibly improved Xmax bound
xmin:: On input, existing Xmin bound, on exit possibly improved Xmin bound
ymax:: as for xmax
ymin:: as for xmin
zmax:: as for xmax
zmin:: as for xmin

Implements Mantid::Geometry::Surface.

Definition at line 339 of file Cylinder.cpp.

References m_centre, m_normal, and m_radius.

◆ getCentre()

Kernel::V3D Mantid::Geometry::Cylinder::getCentre ( ) const
inline

Return centre point.

Definition at line 74 of file Cylinder.h.

◆ getNormal()

Kernel::V3D Mantid::Geometry::Cylinder::getNormal ( ) const
inline

Return Central line.

Definition at line 75 of file Cylinder.h.

◆ getRadius()

double Mantid::Geometry::Cylinder::getRadius ( ) const
inline

Get Radius.

Definition at line 76 of file Cylinder.h.

◆ lineIntersect()

double Mantid::Geometry::Cylinder::lineIntersect ( const Kernel::V3D Pt,
const Kernel::V3D uVec 
) const
virtual

Given a track starting from Pt and traveling along uVec determine the intersection point (distance)

Parameters
Pt:: Point of track start
uVec:: Unit vector of length
Return values
Distanceto intersect
-1Failed to intersect

Definition at line 313 of file Cylinder.cpp.

◆ onSurface()

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

Calculate if the point PT on the cylinder.

Parameters
Pt:: Kernel::V3D to test

Implements Mantid::Geometry::Surface.

Definition at line 149 of file Cylinder.cpp.

References Mantid::Geometry::Quadratic::onSurface(), Mantid::Kernel::Tolerance, Mantid::Geometry::x, and Mantid::Geometry::y.

◆ operator=()

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

◆ print()

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

Debug routine to print out basic information.

Reimplemented from Mantid::Geometry::Surface.

Definition at line 328 of file Cylinder.cpp.

References m_centre, m_normal, m_radius, and Mantid::Geometry::Quadratic::print().

◆ rotate()

void Mantid::Geometry::Cylinder::rotate ( const Kernel::Matrix< double > &  MA)
overrideprivatevirtual

Apply a rotation to the cylinder and re-check the status of the main axis.

Parameters
MA:: Rotation Matrix (not inverted)

Implements Mantid::Geometry::Surface.

Definition at line 182 of file Cylinder.cpp.

References m_centre, m_normal, Mantid::Kernel::V3D::normalize(), Mantid::Geometry::Quadratic::rotate(), Mantid::Kernel::V3D::rotate(), and setNormVec().

◆ setBaseEqn()

void Mantid::Geometry::Cylinder::setBaseEqn ( )
overridevirtual

Sets an equation of type (cylinder)

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

Implements Mantid::Geometry::Quadratic.

Definition at line 232 of file Cylinder.cpp.

References Mantid::Geometry::Quadratic::BaseEqn, m_centre, m_normal, m_radius, and Mantid::Kernel::V3D::scalar_prod().

Referenced by Cylinder(), setCentre(), setNorm(), and setSurface().

◆ setCentre()

void Mantid::Geometry::Cylinder::setCentre ( const Kernel::V3D A)

Sets the centre Kernel::V3D.

Parameters
A:: centre point

Definition at line 210 of file Cylinder.cpp.

References m_centre, and setBaseEqn().

◆ setNorm()

void Mantid::Geometry::Cylinder::setNorm ( const Kernel::V3D A)

Sets the centre line unit vector A does not need to be a unit vector.

Parameters
A:: Vector along the centre line

Definition at line 220 of file Cylinder.cpp.

References m_normal, Mantid::Kernel::normalize(), setBaseEqn(), and setNormVec().

◆ setNormVec()

void Mantid::Geometry::Cylinder::setNormVec ( )
private

check to obtain orientation

Find if the normal vector allows it to be a special type of cylinder on the x,y or z axis.

Returns
1,2,3 :: corresponding to a x,y,z alignment

Definition at line 166 of file Cylinder.cpp.

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

Referenced by rotate(), and setNorm().

◆ setRadius()

void Mantid::Geometry::Cylinder::setRadius ( const double &  r)
inline

Set Radius.

Definition at line 78 of file Cylinder.h.

◆ setRadiusInternal()

void Mantid::Geometry::Cylinder::setRadiusInternal ( const double &  r)
inlineprivate

Definition at line 46 of file Cylinder.h.

Referenced by setSurface().

◆ setSurface()

int Mantid::Geometry::Cylinder::setSurface ( const std::string &  Pstr)
overridevirtual

Processes a standard MCNPX cone string Recall that cones can only be specified on an axis Valid input is:

  • c/x cen_y cen_z radius
  • cx radius
    Parameters
    Pstr:: Input string
    Returns
    : 0 on success, neg of failure

Implements Mantid::Geometry::Surface.

Definition at line 69 of file Cylinder.cpp.

References index, m_centre, m_normal, m_normVec, Mantid::Kernel::Strings::section(), setBaseEqn(), and setRadiusInternal().

◆ side()

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

Calculate if the point PT within the middle of the cylinder.

Parameters
Pt:: Point to check
Return values
-1:: within cylinder
1:: outside the cylinder
0:: on the surface

Reimplemented from Mantid::Geometry::Surface.

Definition at line 121 of file Cylinder.cpp.

References fabs, Mantid::Geometry::Quadratic::side(), Mantid::Kernel::Tolerance, Mantid::Geometry::x, and Mantid::Geometry::y.

◆ write()

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

Write out the cylinder for MCNPX.

Parameters
OX:: output stream

Reimplemented from Mantid::Geometry::Surface.

Definition at line 270 of file Cylinder.cpp.

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

Member Data Documentation

◆ g_NSLICES

constexpr int Mantid::Geometry::Cylinder::g_NSLICES = 10
staticconstexpr

The number of slices to approximate a cylinder.

Definition at line 89 of file Cylinder.h.

◆ g_NSTACKS

constexpr int Mantid::Geometry::Cylinder::g_NSTACKS = 1
staticconstexpr

The number of stacks to approximate a cylinder.

Definition at line 91 of file Cylinder.h.

◆ m_centre

Kernel::V3D Mantid::Geometry::Cylinder::m_centre
private

Kernel::V3D for centre.

Definition at line 36 of file Cylinder.h.

Referenced by displace(), getBoundingBox(), print(), rotate(), setBaseEqn(), setCentre(), and setSurface().

◆ m_normal

Kernel::V3D Mantid::Geometry::Cylinder::m_normal
private

Direction of centre line.

Definition at line 37 of file Cylinder.h.

Referenced by getBoundingBox(), print(), rotate(), setBaseEqn(), setNorm(), setNormVec(), and setSurface().

◆ m_normVec

std::size_t Mantid::Geometry::Cylinder::m_normVec
private

Normal vector is x,y or z :: (1-3) (0 if general)

Definition at line 38 of file Cylinder.h.

Referenced by displace(), setNormVec(), and setSurface().

◆ m_oneoverradius

double Mantid::Geometry::Cylinder::m_oneoverradius
private

Definition at line 39 of file Cylinder.h.

◆ m_radius

double Mantid::Geometry::Cylinder::m_radius
private

Radius of cylinder.

Definition at line 40 of file Cylinder.h.

Referenced by getBoundingBox(), print(), and setBaseEqn().

◆ PLog

Kernel::Logger& Mantid::Geometry::Cylinder::PLog
staticprivate

The official logger.

Definition at line 34 of file Cylinder.h.


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