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

Computes Boolean algebra for simplification. More...

#include <Algebra.h>

Public Member Functions

std::pair< Algebra, AlgebraalgDiv (const Algebra &) const
 Divide by D algebrically. More...
 
 Algebra ()
 Constructor. More...
 
void Complement ()
 Takes the complement of the algebric function. More...
 
int countLiterals () const
 Count the number of different literals in the algebraic function Does this by generating the map of literals. More...
 
std::string display () const
 Displays the algebra string. More...
 
const AcompgetComp () const
 Accessor. More...
 
int logicalEqual (const Algebra &) const
 Calculate if two functions are logically equivilent (exhaustive search) More...
 
void makeCNF ()
 assessor to makeCNFobj More...
 
void makeDNF ()
 assessor to makeDNFobj More...
 
bool operator!= (const Algebra &) const
 Inequality operator. More...
 
Algebra operator* (const Algebra &) const
 Addition operator (and construction) More...
 
Algebraoperator*= (const Algebra &)
 Multiplies this by M algebrically. More...
 
Algebra operator+ (const Algebra &) const
 Addition operator (or construction) More...
 
Algebraoperator+= (const Algebra &)
 Adds this by M algebrically. More...
 
bool operator== (const Algebra &) const
 Equality operator. More...
 
int setFunction (const Acomp &)
 Set the function using a toplevel Acomp. More...
 
int setFunction (const std::string &)
 Set the function using a basic string (abc etc) More...
 
int setFunctionObjStr (const std::string &)
 Fill the algebra (AComp) with an object given an MCNPX String. More...
 
std::ostream & write (std::ostream &) const
 Output function. More...
 
std::string writeMCNPX () const
 Writes out the string in terms of surface numbers for MCNPX. More...
 

Private Attributes

Acomp F
 Factor. More...
 
std::map< int, std::string > SurfMap
 Internal surface map. More...
 

Detailed Description

Computes Boolean algebra for simplification.

Author
S. Ansell
Date
August 2005
Version
1.0

A leveled algebra class for each level of factorisation.

Definition at line 30 of file Algebra.h.

Constructor & Destructor Documentation

◆ Algebra()

Mantid::Geometry::Algebra::Algebra ( )

Constructor.

Definition at line 41 of file Algebra.cpp.

Member Function Documentation

◆ algDiv()

std::pair< Algebra, Algebra > Mantid::Geometry::Algebra::algDiv ( const Algebra D) const

Divide by D algebrically.

Parameters
D:: Divisor
Returns
Quotian + Remainder

Definition at line 125 of file Algebra.cpp.

References Mantid::Geometry::Acomp::algDiv(), and setFunction().

◆ Complement()

void Mantid::Geometry::Algebra::Complement ( )

Takes the complement of the algebric function.

Definition at line 116 of file Algebra.cpp.

References Mantid::Geometry::Acomp::complement(), and F.

◆ countLiterals()

int Mantid::Geometry::Algebra::countLiterals ( ) const

Count the number of different literals in the algebraic function Does this by generating the map of literals.

Returns
number of literals found

Definition at line 300 of file Algebra.cpp.

References F, and Mantid::Geometry::Acomp::getLiterals().

◆ display()

std::string Mantid::Geometry::Algebra::display ( ) const

Displays the algebra string.

Definition at line 194 of file Algebra.cpp.

References Mantid::Geometry::Acomp::display(), and F.

Referenced by Mantid::Geometry::operator<<().

◆ getComp()

const Acomp & Mantid::Geometry::Algebra::getComp ( ) const
inline

Accessor.

Definition at line 39 of file Algebra.h.

◆ logicalEqual()

int Mantid::Geometry::Algebra::logicalEqual ( const Algebra A) const

Calculate if two functions are logically equivilent (exhaustive search)

Parameters
A:: Algrebra to testg
Returns
True/False

Definition at line 313 of file Algebra.cpp.

◆ makeCNF()

void Mantid::Geometry::Algebra::makeCNF ( )
inline

assessor to makeCNFobj

Definition at line 51 of file Algebra.h.

References Mantid::Geometry::Acomp::makeCNFobject().

◆ makeDNF()

void Mantid::Geometry::Algebra::makeDNF ( )
inline

assessor to makeDNFobj

Definition at line 50 of file Algebra.h.

References Mantid::Geometry::Acomp::makeDNFobject().

◆ operator!=()

bool Mantid::Geometry::Algebra::operator!= ( const Algebra A) const

Inequality operator.

Parameters
A:: object to compary
Returns
this!=A (via ==)

Definition at line 60 of file Algebra.cpp.

◆ operator*()

Algebra Mantid::Geometry::Algebra::operator* ( const Algebra M) const

Addition operator (and construction)

Parameters
M:: Algebra to multiply (and)
Returns
this+M

Definition at line 104 of file Algebra.cpp.

◆ operator*=()

Algebra & Mantid::Geometry::Algebra::operator*= ( const Algebra M)

Multiplies this by M algebrically.

Parameters
M:: Algebric object to multiply by
Returns
*this

Definition at line 81 of file Algebra.cpp.

References F.

◆ operator+()

Algebra Mantid::Geometry::Algebra::operator+ ( const Algebra M) const

Addition operator (or construction)

Parameters
M:: Algebra to add
Returns
this+M

Definition at line 92 of file Algebra.cpp.

◆ operator+=()

Algebra & Mantid::Geometry::Algebra::operator+= ( const Algebra M)

Adds this by M algebrically.

Parameters
M:: Algebric object to add
Returns
*this

Definition at line 70 of file Algebra.cpp.

References F.

◆ operator==()

bool Mantid::Geometry::Algebra::operator== ( const Algebra A) const

Equality operator.

Parameters
A:: object to compary
Returns
this==A

Definition at line 48 of file Algebra.cpp.

◆ setFunction() [1/2]

int Mantid::Geometry::Algebra::setFunction ( const Acomp A)

Set the function using a toplevel Acomp.

Parameters
A:: Acomp to be copied to F.
Returns
0 on success

Definition at line 288 of file Algebra.cpp.

References F.

◆ setFunction() [2/2]

int Mantid::Geometry::Algebra::setFunction ( const std::string &  A)

Set the function using a basic string (abc etc)

Parameters
A:: String to use for the function
Return values
1Error
0on success

Definition at line 265 of file Algebra.cpp.

References F, and Mantid::Geometry::Acomp::setString().

Referenced by algDiv(), and setFunctionObjStr().

◆ setFunctionObjStr()

int Mantid::Geometry::Algebra::setFunctionObjStr ( const std::string &  A)

Fill the algebra (AComp) with an object given an MCNPX String.

The string type is of 3 : 5 : 6 -4 #( xx )

  • where #( ) surroud the string
    Parameters
    A:: string to process (stripped of id,density etc)
    Return values
    -1:: Failure
    0:: Success

Definition at line 196 of file Algebra.cpp.

References Mantid::Kernel::Strings::convPartNum(), setFunction(), and SurfMap.

◆ write()

std::ostream & Mantid::Geometry::Algebra::write ( std::ostream &  Out) const

Output function.

Parameters
Out:: Ostream to write out
Returns
Out

Definition at line 182 of file Algebra.cpp.

◆ writeMCNPX()

std::string Mantid::Geometry::Algebra::writeMCNPX ( ) const

Writes out the string in terms of surface numbers for MCNPX.

Note the ugly use of valEqual to find the cell since the SrufMap is the wrong way round. This also has the problem that Algebra uses intersection as master but MCNPX uses union

Returns
string representation of MCNPX

Definition at line 144 of file Algebra.cpp.

References Mantid::Geometry::Acomp::display(), F, and SurfMap.

Member Data Documentation

◆ F

Acomp Mantid::Geometry::Algebra::F
private

Factor.

Definition at line 33 of file Algebra.h.

Referenced by Complement(), countLiterals(), display(), operator*=(), operator+=(), setFunction(), and writeMCNPX().

◆ SurfMap

std::map<int, std::string> Mantid::Geometry::Algebra::SurfMap
private

Internal surface map.

Definition at line 32 of file Algebra.h.

Referenced by setFunctionObjStr(), and writeMCNPX().


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