MURE
Loading...
Searching...
No Matches
MathNode.hxx
Go to the documentation of this file.
1/*
2 This file is part of MURE,
3 Copyright (C) 2007-2021 MURE developers.
4
5 MURE is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 MURE is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with MURE. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef _MathNODE_HXX_
20#define _MathNODE_HXX_
21
27#include <vector>
28#include <iosfwd>
29
30#include "Shape.hxx"
31#include "MCSource.hxx"
32
33using namespace std;
34
36
49class MathNode : public Shape
50{
51 public :
56 MathNode(int Sign = + 1);
57 MathNode(const MathNode &n);
58 ~MathNode() override;
59 Shape_ptr Clone(int count = 0) override;
60
65 unsigned IsNode() override
66 {
67 return 1;
68 }
69 unsigned IsFullVoid() override
70 {
71 return (fShapeVector.size() == 0);
72 }
73 unsigned IsVoid() override
74 {
75 return (fShapeVector.size() == 0 && fSign == 1);
76 }
77 unsigned IsFull() override
78 {
79 return (fShapeVector.size() == 0 && fSign == - 1);
80 }
81 double GetVolume() override;
82
83 Shape_ptr GetLeaf(int i) override
84 {
85 return fShapeVector[i];
86 }
87 int GetNumberOfLeaves() override
88 {
89 return fShapeVector.size();
90 }
91
92 unsigned Add(Shape_ptr OtherShape) override;
93 void ReplaceLeaf(int i, Shape_ptr OtherShape) override;
94
96
101 void SetBoundingShape(Shape_ptr theShape);
103 {
104 if(fBoundingShape.Get()) return fBoundingShape;
105 else return Shape_ptr(nullptr);
106 }
107
109
114 void SetIncludedShape(Shape_ptr theShape);
116 {
117 if(fIncludedShape.Get())return fIncludedShape;
118 else return Shape_ptr(nullptr);
119 }
120 void SetMirrorBoundary(bool state = true) override;
121 void SetWhiteBoundary(bool state = true) override;
122 void SetTopBottomPlanesOpen() override;
123 void SetSidePlanesOpen() override;
125
127
132
138 void Translate(double dx, double dy, double dz, int count = 0) override;
140
147 void Rotate(double phi, double theta = 0, double psi = 0, double *center = nullptr, int count = 0) override;
149
154 unsigned IsIncluded(Shape_ptr OtherShape) override;
155 unsigned IsDisjoint(Shape_ptr OtherShape) override;
156 virtual unsigned Contain(Shape_ptr OtherShape);
158
159
164 //virtual string Print(); //!< Print the Node surface in MCNP cell
165
167
170 void SetUniverse(int u = 0) override;
171
172 double GetVirtualSphereRadius() override;
173 double *GetVirtualSphereCenter() override
174 {
175 return nullptr;
176 }
177
179
183 bool PointInShape(double *P, int border) override;
184
185 void PrintX(int count = 0) override;
186 void PrintY(int count = 0) override;
187#ifdef _PTODEBUG_
188 void PrintLatex(int count = 0);
189#endif
190 void ReplaceNode(Shape_ptr C) override;
191 int NumberOfShapes() override;
192
193 void CalculNot() override;
195
199 void Simplify(bool violent = false) override;
200 void ResetIsDefinedSurfaceCalled() override;
202
203
204 protected :
209
212 virtual void ElagueRoot();
213 void DevElague(int count = 0, bool violent = false) override; //developp tree and trim it
214
215 void UnSetMouvement() override;
216 virtual void ClearVectorShape(int UMVT = 0);
218
219 MathNode *CreateNewInstance(int sign = 1) override;
220
221 void RemoveSurface() override;
222 void Remove(vector < Shape_ptr > ::iterator Iterator);
223
224 vector < Shape_ptr > fShapeVector;
225 vector < Shape_ptr > fDestroyShape;
226
229 bool fTube;
230 bool fHexagon;
231 int fCount;
232
233};
234
235#endif
#define sign(a)
Definition GenericReactorAssembly.cxx:43
Reference_ptr< Shape > Shape_ptr
Definition MCNPSource.hxx:42
Header file for Monte-Carlo Source abstract class.
Header file for Shape class and Shape_ptr type.
MathNode allows to construct Union or Intersection of Shape.
Definition MathNode.hxx:50
unsigned IsNode() override
Definition MathNode.hxx:65
virtual void ElagueRoot()
Trims a tree with a Chain Saw.
Definition MathNode.cxx:577
virtual unsigned Contain(Shape_ptr OtherShape)
+1 this contains the OtherShape, 0 not included or don't know.
Definition MathNode.cxx:185
void CalculNot() override
Allocates and calculs the complement of Shape.
Definition MathNode.cxx:352
unsigned IsFull() override
Definition MathNode.hxx:77
bool fHexagon
true if the Node is an Hexagon
Definition MathNode.hxx:230
void ResetIsDefinedSurfaceCalled() override
Definition MathNode.cxx:1187
void Rotate(double phi, double theta=0, double psi=0, double *center=nullptr, int count=0) override
Rotate the Node clockwise.
Definition MathNode.cxx:287
void DevElague(int count=0, bool violent=false) override
Developps and Trims a tree of Node.
Definition MathNode.cxx:423
void ReplaceLeaf(int i, Shape_ptr OtherShape) override
replace the ith leaf of a Node.
Definition MathNode.cxx:94
void Translate(double dx, double dy, double dz, int count=0) override
Translate the Node of (dx, dy, dz).
Definition MathNode.cxx:255
void PrintY(int count=0) override
Debug method: Print the shape surfaces, InsideShape, ...
Definition MathNode.cxx:794
void SetBoundingShape(Shape_ptr theShape)
Declare a bounding shape.
Definition MathNode.cxx:107
unsigned Add(Shape_ptr OtherShape) override
Add a new Shape (in fact a Shape_ptr) to a Node.
Definition MathNode.cxx:75
void RemoveSurface() override
Removed unused surface from gMURE.
Definition MathNode.cxx:235
void SetMirrorBoundary(bool state=true) override
mirror a particle on the surface
Definition MathNode.cxx:973
~MathNode() override
Normal destrutor.
Definition MathNode.cxx:66
double GetVirtualSphereRadius() override
returns the radius of a Sphere containing the Shape
Definition MathNode.cxx:1094
Shape_ptr fBoundingShape
Shape containing the Node, 0 for none.
Definition MathNode.hxx:227
void SetTopBottomPlanesOpen() override
The top/bottom planes are NOT mirrors.
Definition MathNode.cxx:997
Shape_ptr GetIncludedShape()
Definition MathNode.hxx:115
unsigned IsDisjoint(Shape_ptr OtherShape) override
+1 this is disjoint in OtherShape, 0 not included or don't know.
Definition MathNode.cxx:209
void Simplify(bool violent=false) override
Simplify a tree of Node.
Definition MathNode.cxx:708
unsigned IsVoid() override
Definition MathNode.hxx:73
virtual void ClearVectorShape(int UMVT=0)
Clear VectorShape.
Definition MathNode.cxx:135
void Remove(vector< Shape_ptr > ::iterator Iterator)
remove a vector element
Definition MathNode.cxx:147
void UnSetMouvement() override
Set the fMouvement flag to false;.
Definition MathNode.cxx:311
void ReplaceNode(Shape_ptr C) override
Replace a Node by an other (C must be a Node)
Definition MathNode.cxx:1139
void SetIncludedShape(Shape_ptr theShape)
Declare an included shape.
Definition MathNode.cxx:121
int NumberOfShapes() override
return the number of Shapes contains in a Node
Definition MathNode.cxx:828
Shape_ptr GetBoundingShape()
Definition MathNode.hxx:102
bool PointInShape(double *P, int border) override
true if the point P is in the Shape.
Definition MathNode.cxx:1011
Shape_ptr fIncludedShape
Shape included in the Node, 0 for none.
Definition MathNode.hxx:228
int GetNumberOfLeaves() override
Definition MathNode.hxx:87
Shape_ptr GetLeaf(int i) override
Definition MathNode.hxx:83
MathNode * CreateNewInstance(int sign=1) override
a new MathNode instance.
Definition MathNode.cxx:1179
vector< Shape_ptr > fShapeVector
a vector of Shape_ptr of a Node
Definition MathNode.hxx:224
Shape_ptr Clone(int count=0) override
Clone a Shape.
Definition MathNode.cxx:903
bool fTube
true if the Node is a Tube
Definition MathNode.hxx:229
unsigned IsIncluded(Shape_ptr OtherShape) override
+1 this is included in OtherShape, 0 not included or don't know.
Definition MathNode.cxx:154
vector< Shape_ptr > fDestroyShape
a vector of destroyed Shape_ptr of a Node (for UnSetMouvement())
Definition MathNode.hxx:225
int fCount
count flag to unset mvt
Definition MathNode.hxx:231
void PrintX(int count=0) override
Debug method: Print the shape surface when fMouvement=true.
Definition MathNode.cxx:841
void SetSidePlanesOpen() override
The side planes are NOT mirrors.
Definition MathNode.cxx:1004
double GetVolume() override
return the Volume of a Node
Definition MathNode.cxx:1051
void SetUniverse(int u=0) override
Set the Universe number for a shape used in a lattice.
Definition MathNode.cxx:1035
double * GetVirtualSphereCenter() override
Definition MathNode.hxx:173
unsigned IsFullVoid() override
Definition MathNode.hxx:69
void SetWhiteBoundary(bool state=true) override
mirror a particle on the surface with a cosine distribution
Definition MathNode.cxx:962
T * Get() const
Definition TReference.hxx:102
Abstract class to define geometrical shapes.
Definition Shape.hxx:85
int fSign
Define whether the interior (-1) or the exterior (+1) of the Shape is considered.
Definition Shape.hxx:548
the namespace of the Standard C++

MURE Project, documentation generated by Doxygen 1.9.7 - Fri Jan 19 2024