Mantid
|
Object generation rule tree. More...
#include <Rules.h>
Public Member Functions | |
int | checkParents () const |
Debug test for parents. More... | |
virtual std::string | className () const |
Returns class name as string. More... | |
std::unique_ptr< Rule > | clone () const |
int | commonType () const |
Gets a common type. More... | |
virtual std::string | display () const =0 |
Abstract Display. More... | |
virtual std::string | displayAddress () const =0 |
Abstract Display Address. More... | |
int | Eliminate () |
elimination not written More... | |
virtual Rule * | findKey (const int)=0 |
Abstract key find. More... | |
virtual int | findLeaf (const Rule *) const =0 |
Abstract find. More... | |
virtual void | getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin)=0 |
Abstract getBoundingBox. More... | |
int | getKeyList (std::vector< int > &) const |
Generate the key list given an insertion type object. More... | |
Rule * | getParent () const |
Returns the parent object. More... | |
virtual int | isComplementary () const |
Always returns false (0) More... | |
virtual bool | isValid (const Kernel::V3D &) const =0 |
Abstract: The point is within the object. More... | |
virtual bool | isValid (const std::map< int, int > &) const =0 |
Abstract Validity based on surface true/false map. More... | |
virtual Rule * | leaf (const int=0) const |
No leaf for a base rule. More... | |
void | makeParents () |
This is initialisation code that populates all the parents in the rule tree. More... | |
Rule () | |
Standard Constructor. More... | |
Rule (Rule *) | |
Constructor copies. More... | |
virtual void | setLeaf (std::unique_ptr< Rule >, const int=0)=0 |
Abstract set. More... | |
virtual void | setLeaves (std::unique_ptr< Rule >, std::unique_ptr< Rule >)=0 |
abstract set leaves More... | |
void | setParent (Rule *) |
Sets the parent object (not check for A==this) More... | |
virtual int | simplify ()=0 |
Abstract: Can the rule be simplified. More... | |
int | substituteSurf (const int SurfN, const int newSurfN, const std::shared_ptr< Surface > &SPtr) |
Substitues a surface item if within a rule. More... | |
virtual int | type () const |
Null rule. More... | |
virtual | ~Rule ()=default |
Static Public Member Functions | |
static int | makeCNF (std::unique_ptr< Rule > &) |
Make Rule into a CNF format. More... | |
static int | makeCNFcopy (std::unique_ptr< Rule > &) |
Make Rule into a CNF format (slow) More... | |
static int | makeFullDNF (std::unique_ptr< Rule > &) |
Make Rule into a full DNF format. More... | |
static int | removeComplementary (std::unique_ptr< Rule > &) |
NOT WORKING. More... | |
static int | removeItem (std::unique_ptr< Rule > &TRule, const int SurfN) |
Given an item as a surface name, remove the surface from the Rule tree. More... | |
Protected Member Functions | |
Rule & | operator= (const Rule &) |
Assignment operator= does not set parent as Rules are cloned. More... | |
Rule (const Rule &) | |
Constructor copies. More... | |
Private Member Functions | |
virtual Rule * | doClone () const =0 |
abstract clone object More... | |
int | getBaseKeys (std::vector< int > &) const |
Fills the vector with the surfaces. More... | |
Static Private Member Functions | |
static int | addToKey (std::vector< int > &AV, const int passN=-1) |
Static function :: Given a vector AV increase the number from lowest to highest in an iterative counting chain. More... | |
Private Attributes | |
Rule * | Parent |
Parent object (for tree) More... | |
Object generation rule tree.
Base class for a rule item in the tree.
|
protected |
Mantid::Geometry::Rule::Rule | ( | Rule * | A | ) |
|
virtualdefault |
|
staticprivate |
Static function :: Given a vector AV increase the number from lowest to highest in an iterative counting chain.
(effectively an N-bit binary number++)
AV | :: vector of the N-bit array |
passN | :: number that is to be skipped |
bit | number that was set from 0 to 1 |
-1 | if the a carry flag is set |
Definition at line 35 of file Rules.cpp.
Referenced by Eliminate().
int Mantid::Geometry::Rule::checkParents | ( | ) | const |
Debug test for parents.
This code checks if a parent tree is valid.
0 | on failure |
1 | on success |
Definition at line 499 of file Rules.cpp.
References getParent(), and leaf().
|
inlinevirtual |
Returns class name as string.
Reimplemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, and Mantid::Geometry::BoolValue.
|
inline |
Definition at line 54 of file Rules.h.
Referenced by makeCNF(), makeCNFcopy(), and removeItem().
int Mantid::Geometry::Rule::commonType | ( | ) | const |
Gets a common type.
Function to return the common type of an rule.
1 | :: every rule is an intersection or component |
-1 | :: every rule is an union or component |
0 | :: mixed rule group or only component |
Definition at line 526 of file Rules.cpp.
References leaf(), and type().
Referenced by removeComplementary().
|
pure virtual |
Abstract Display.
Implemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, and Mantid::Geometry::BoolValue.
Referenced by Mantid::Geometry::CSGObject::cellStr().
|
pure virtual |
Abstract Display Address.
Implemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, and Mantid::Geometry::BoolValue.
|
privatepure virtual |
abstract clone object
Implemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, and Mantid::Geometry::BoolValue.
int Mantid::Geometry::Rule::Eliminate | ( | ) |
elimination not written
This rule eliminates any unnecessary rules.
Definition at line 618 of file Rules.cpp.
References addToKey(), getKeyList(), and isValid().
|
pure virtual |
Abstract key find.
Implemented in Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, and Mantid::Geometry::BoolValue.
Referenced by removeItem(), and substituteSurf().
|
pure virtual |
Abstract find.
Implemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, and Mantid::Geometry::BoolValue.
Referenced by makeCNF(), Mantid::Geometry::CSGObject::procComp(), and removeComplementary().
|
private |
Fills the vector with the surfaces.
|
pure virtual |
Abstract getBoundingBox.
Implemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, and Mantid::Geometry::BoolValue.
int Mantid::Geometry::Rule::getKeyList | ( | std::vector< int > & | IList | ) | const |
Generate the key list given an insertion type object.
The list is a unique list.
IList | :: place to put keyList |
Definition at line 581 of file Rules.cpp.
References leaf().
Referenced by Eliminate().
Rule * Mantid::Geometry::Rule::getParent | ( | ) | const |
Returns the parent object.
Definition at line 466 of file Rules.cpp.
References Parent.
Referenced by checkParents(), makeCNF(), Mantid::Geometry::CSGObject::procComp(), removeComplementary(), and removeItem().
|
inlinevirtual |
Always returns false (0)
Reimplemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::CompObj, and Mantid::Geometry::CompGrp.
|
pure virtual |
Abstract: The point is within the object.
Implemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, and Mantid::Geometry::BoolValue.
Referenced by Eliminate().
|
pure virtual |
Abstract Validity based on surface true/false map.
Implemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, and Mantid::Geometry::BoolValue.
|
inlinevirtual |
No leaf for a base rule.
Reimplemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::CompGrp, Mantid::Geometry::SurfPoint, and Mantid::Geometry::BoolValue.
Definition at line 59 of file Rules.h.
Referenced by checkParents(), commonType(), Mantid::Geometry::CSGObject::createSurfaceList(), getKeyList(), makeCNF(), makeCNFcopy(), makeParents(), Mantid::Geometry::CSGObject::populate(), Mantid::Geometry::CSGObject::print(), removeComplementary(), and removeItem().
|
static |
Make Rule into a CNF format.
Static Function::
Function to make the tree into CNF (conditional normal form)
TopRule | :: Rule to simplify. |
We do not use *this :: The reason is that we need to change the toprule type e.g. from an intersection to a union. Since the type of a class can't be changed it is necessary to have a static function, so that the place that TopRule points is changable
0 | on failure |
1 | on success |
Definition at line 264 of file Rules.cpp.
References clone(), count, findLeaf(), getParent(), leaf(), setLeaf(), and type().
|
static |
Make Rule into a CNF format (slow)
Static Function::
Function to make the tree into CNF (conditional normal form)
TopRule | :: Rule to simplify. |
We do not use *this :: The reason is that we need to change the toprule type eg from an intersection to a union. Since the type of a class can't be changed it is necessary to have a static function, so that the place that TopRule points is changable
Definition at line 135 of file Rules.cpp.
References clone(), count, Mantid::DTriple< F, S, T >::first, leaf(), Mantid::DTriple< F, S, T >::second, Mantid::DTriple< F, S, T >::third, and type().
|
static |
Make Rule into a full DNF format.
void Mantid::Geometry::Rule::makeParents | ( | ) |
This is initialisation code that populates all the parents in the rule tree.
Definition at line 475 of file Rules.cpp.
References leaf(), and setParent().
Assignment operator= does not set parent as Rules are cloned.
Definition at line 446 of file Rules.cpp.
Referenced by Mantid::Geometry::BoolValue::operator=(), Mantid::Geometry::CompGrp::operator=(), Mantid::Geometry::Intersection::operator=(), and Mantid::Geometry::Union::operator=().
|
static |
NOT WORKING.
Given a rule tree remove any parts that are (-A B C D A) -> (B C D) and (A B C D A ) -> (A B C D) Code is borrowed from makeCNF.
See comments within that for a better howto. Currently it passes the line down
1 | :: some simplification |
0 | :: no simplification |
Definition at line 58 of file Rules.cpp.
References commonType(), findLeaf(), Mantid::DTriple< F, S, T >::first, getParent(), leaf(), setLeaf(), simplify(), and Mantid::DTriple< F, S, T >::third.
|
static |
Given an item as a surface name, remove the surface from the Rule tree.
TRule | :: Top rule to down search |
SurfN | :: Surface key number to remove |
Not the top level
New Top rule
Definition at line 376 of file Rules.cpp.
References clone(), findKey(), getParent(), leaf(), setLeaf(), and setParent().
Referenced by Mantid::Geometry::CSGObject::removeSurface().
|
pure virtual |
Abstract set.
Implemented in Mantid::Geometry::Intersection, Mantid::Geometry::CompGrp, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, and Mantid::Geometry::BoolValue.
Referenced by makeCNF(), Mantid::Geometry::CSGObject::procComp(), removeComplementary(), and removeItem().
|
pure virtual |
abstract set leaves
Implemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, and Mantid::Geometry::BoolValue.
void Mantid::Geometry::Rule::setParent | ( | Rule * | A | ) |
Sets the parent object (not check for A==this)
A | :: Partent Object Ptr |
Definition at line 457 of file Rules.cpp.
References Parent.
Referenced by makeParents(), and removeItem().
|
pure virtual |
Abstract: Can the rule be simplified.
Implemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, and Mantid::Geometry::BoolValue.
Referenced by removeComplementary().
int Mantid::Geometry::Rule::substituteSurf | ( | const int | SurfN, |
const int | newSurfN, | ||
const std::shared_ptr< Surface > & | SPtr | ||
) |
Substitues a surface item if within a rule.
SurfN | :: Number number to change |
newSurfN | :: New surface number (if -ve then the key is reversed) |
SPtr | :: New surface Pointer |
Definition at line 560 of file Rules.cpp.
References findKey(), and Mantid::Geometry::SurfPoint::setKeyN().
|
inlinevirtual |
Null rule.
Reimplemented in Mantid::Geometry::Intersection, Mantid::Geometry::Union, Mantid::Geometry::SurfPoint, Mantid::Geometry::CompObj, Mantid::Geometry::CompGrp, and Mantid::Geometry::BoolValue.
Definition at line 73 of file Rules.h.
Referenced by commonType(), makeCNF(), and makeCNFcopy().
|
private |
Parent object (for tree)
Definition at line 35 of file Rules.h.
Referenced by getParent(), and setParent().