MURE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Shape.hxx
Go to the documentation of this file.
1 #ifndef _SHAPE_HXX_
2 #define _SHAPE_HXX_
3 
9 #include <iostream>
10 #include <fstream>
11 
12 #define EPSILON 1e-10
13 
14 #include "MureHeaders.hxx"
15 #include <vector>
16 #include <string>
17 using namespace std;
18 
19 
20 class Shape;
32 
34 
54 class Shape : public TReference
55 {
56  public :
61  Shape();
62  Shape(const Shape &s);
63  virtual ~Shape();
64 
65 
69  double GetSigne(){return fSigne;}
70  void SetSigne(double s){fSigne=s;}
71 
77  void SetOutermostShape(bool flag=true){fOutermostShape = flag;}
78  bool IsInfinite() {return fInfinite;}
79 
81 
86  virtual unsigned IsBrick() {return 0;}
87  virtual unsigned IsCylinder() {return 0;}
88  virtual unsigned IsFullVoid() {return 0;}
89  virtual unsigned IsHexagon() {return 0;}
90  virtual unsigned IsNode() {return 0;}
91  virtual unsigned IsPlane() {return 0;}
92  virtual unsigned IsSphere() {return 0;}
93  virtual unsigned IsTube() {return 0;}
94  virtual unsigned IsFull() {return 0;}
95  virtual unsigned IsVoid() {return 0;}
96 
97 
102 
106  virtual double GetVolume(){return fVolume;}
108 
111  virtual double GetSurface(){return fSurface;}
112  void SetVolume(double V){fVolume=V;}
113  void SetSurface(double S){fSurface=S;}
114  virtual void SetMirrorBoundary(bool state=true);
115  virtual void SetTopBottomPlanesOpen() {fOpenZPlanes=true;}
116  virtual bool GetTopBottomPlanesOpen() {return fOpenZPlanes;}
117  virtual void SetSidePlanesOpen() {fOpenXYPlanes=true;}
118  virtual bool GetSidePlanesOpen() {return fOpenXYPlanes;}
119  virtual void SetWhiteBoundary(bool state=true);
120 
122 
130  virtual void SetPeriodicBoundary(bool state=true,string TopBottPlaneBC="mirror");
131  virtual bool IsMirrorBoundary(){return fMirrorBoundary;}
132  virtual bool IsWhiteBoundary(){return fWhiteBoundary;}
133  virtual bool IsPeriodicBoundary(){return fPeriodicBoundary;}
134 
135 
140  Shape_ptr Not();
141 
143 
150  virtual void Rotate(double phi,double theta=0,double psi=0,double *center=0,int count=0){}
152 
158  virtual void Translate(double dx,double dy,double dz,int count=0){}
160 
166  void RotateVector(double *V,double phi,double theta=0,double psi=0);
168 
175  void RotatePoint(double *P,double phi,double theta=0,double psi=0,double *center=0);
176 
178  virtual unsigned Add(Shape_ptr OtherShape){return 0;}
180 
185 
190  virtual unsigned Inclus(Shape_ptr OtherShape){return 0;}
191 
193 
197  virtual unsigned Disjoint(Shape_ptr OtherShape){return 0;}
199 
204  virtual void SetMouvement(bool state=true){fMouvement=state;}
205  virtual void UnSetMouvement();
206  bool GetMouvement(){return fMouvement;}
207 
209 
212  virtual void Simplify(bool violent=false){}
214 
217  virtual void DevElague(int count=0,bool violent=false){}
219 
224 
229  unsigned AddInsideShape(Shape_ptr OtherShape);
230 
232 
237  unsigned AddOriginalInsideShape(Shape_ptr OtherShape) {fOriginalInsideShape.push_back(OtherShape); return 1;}
238  void ClearOriginalInsideShape() {fOriginalInsideShape.clear();}
239  void ClearInsideShape() {fInsideShape.clear();}
240  unsigned GetInsideShapeSize() {return fInsideShape.size();}
241  unsigned GetOriginalInsideShapeSize() {return fOriginalInsideShape.size();}
242  void SetInsideShape(int i,Shape_ptr S) {fInsideShape[i]=S;}
243  void SetOriginalInsideShape(int i,Shape_ptr S) {fOriginalInsideShape[i]=S;}
244  Shape_ptr GetInsideShape(int i) {return fInsideShape[i];}
245  Shape_ptr GetOriginalInsideShape(int i) {return fOriginalInsideShape[i];}
246 
247 
252  virtual string Print();
253  virtual string PrintSurface(){return "";}
254 
255  virtual Shape_ptr Clone(int count=0);
256  void SetClone(Shape_ptr clone){fCloneShape=clone;}
257  void SetClone2Not();
258 
259  virtual void Copy(Shape_ptr S){}
260  virtual Shape_ptr GetLeaf(int i) {Shape_ptr t(0);return t;}
261  virtual int GetNumberOfLeaves(){return 0;}
262 
263  void AddSurfaceNumber(int i) {return fSurfaceNumber.push_back(i);}
264  vector<int> GetSurfaceNumber();
265 
267 
271  virtual void DefineSurface(){}
272  virtual void AlreadyDefine(bool state=true);
273 
275 
279  virtual void SetUniverse(int u=0);
280  virtual void SetFill(int f){fFill=f;}
281  int GetUniverse(){return fUniverse;}
282  int GetFill(){return fFill;}
283 
284  void IncrementSurface(double S){fSurface+=S;}
285 
286  virtual double GetVirtualSphereRadius(){return fVirtualSphereR;}
287  virtual double *GetVirtualSphereCenter(){return fVirtualSphereO;}
288 
289  virtual void RemoveSurface();
290 
291  virtual void PrintX(int count=0);
292  virtual void PrintY(int count=0);
293 
294 #ifdef _PTODEBUG_
295  virtual void PrintLatex(int count=0);
296  static void AddLatexLine(char *txt){BeginLatex();DEBUGFILE<<txt<<"\\\\ "<<endl;}
297  static void BeginLatex();
298  static void EndLatex();
299 #endif
300 
301  virtual void CalculNot() {}
302  void NewNot(){if(fNot) CalculNot();}
303 
305 
310  virtual bool PointInShape(double *P,int border){return false;}
311  virtual void SetLinkedPlane(Shape_ptr P){fLinkedPlane=P;}
312  virtual void ReplaceNode(Shape_ptr C){}
313  double PS(double *U,double *V);
314  string GetName();
315  virtual int NumberOfShapes(){return 1;}
316 
317  void SetZone(int z){fZone = z;}
318  int GetZone(){return fZone;}
319 
320 
321  protected :
322 
324 
327  void SetNot(Shape* Not)
328  {
329  if(fNot) fNot->fNot=0;
330  fNot=Not;
331  fNot->fNot=this;
332  }
333  void SetNotofNot(){fNot->SetNot(this);}
334 
336 
340  void UpdateSurface(Surface* &S);
341 
342 
343  vector<int> fSurfaceNumber;
344  vector<Shape_ptr> fInsideShape;
345  vector<Shape_ptr> fOriginalInsideShape;
346 
347  double fSigne;
348  bool fInfinite;
351  bool fMouvement;
352  int fUniverse;
353  int fFill;
354  double fVolume;
355  double fSurface;
356  string fName;
367 
369  int fZone;
370 
371 };
372 
374 
410 
412 
413 
414 #endif
Shape_ptr operator!(Shape_ptr A)
!A is an other way to obtain A-&gt;Not().
Definition: Shape.cxx:542
string fName
Name of a Shape.
Definition: Shape.hxx:356
int GetUniverse()
return the Univers number if exists.
Definition: Shape.hxx:281
int fZone
flag for identifying complex geometries (test fms)
Definition: Shape.hxx:369
bool fMouvement
Flag that indicate a Shape is in mouvement (translation,..) in a tree.
Definition: Shape.hxx:351
virtual unsigned IsHexagon()
1 if Shape is a Hexagon
Definition: Shape.hxx:89
virtual double GetSurface()
Get the Surface of a Shape.
Definition: Shape.hxx:111
Shape * fNot
pointer on complementary Shape if exists, else 0.
Definition: Shape.hxx:349
void SetOutermostShape(bool flag=true)
Say that this Shape is the most outer one.
Definition: Shape.hxx:77
int fFill
Universe number that fill the Shape.
Definition: Shape.hxx:353
virtual bool IsPeriodicBoundary()
Periodic boundary (only for Brick or Hexagon)
Definition: Shape.hxx:133
virtual void SetSidePlanesOpen()
The side planes are NOT mirrors.
Definition: Shape.hxx:117
virtual unsigned IsNode()
1 if Shape is a Node
Definition: Shape.hxx:90
Surface class is design to define MCNP surface format.
Definition: Surface.hxx:26
void NewNot()
Update the Not.
Definition: Shape.hxx:302
virtual void CalculNot()
Allocates and calculs the complement of a Shape.
Definition: Shape.hxx:301
double * fVirtualSphereO
the center of a Sphere containing the Shape
Definition: Shape.hxx:358
void SetVolume(double V)
Set the volume of a Shape to V.
Definition: Shape.hxx:112
virtual unsigned IsCylinder()
1 if Shape is a Cylinder
Definition: Shape.hxx:87
int GetZone()
get test flag for complex geometries
Definition: Shape.hxx:318
void AddSurfaceNumber(int i)
Give the vector of Surface of the Shape.
Definition: Shape.hxx:263
virtual unsigned IsPlane()
1 if Shape is a Plane
Definition: Shape.hxx:91
virtual bool IsWhiteBoundary()
mirror a particle on the surface with a cosine distribution
Definition: Shape.hxx:132
virtual double GetVirtualSphereRadius()
returns the radius of a Sphere containing the Shape
Definition: Shape.hxx:286
void SetClone(Shape_ptr clone)
Set the CloneShape to clone.
Definition: Shape.hxx:256
double GetSigne()
Return -1 if the Shape exterior is considered, +1 otherwise.
Definition: Shape.hxx:69
virtual Shape_ptr GetLeaf(int i)
returns the i-th leaf (Shape) of a Node
Definition: Shape.hxx:260
virtual double * GetVirtualSphereCenter()
returns the center of a Sphere containing the Shape
Definition: Shape.hxx:287
virtual double GetVolume()
Get the Volume of a Shape.
Definition: Shape.hxx:106
virtual void SetMouvement(bool state=true)
Set the fMouvement flag to state;.
Definition: Shape.hxx:204
vector< int > fSurfaceNumber
number(s) of Surface(s) defining the Shape
Definition: Shape.hxx:343
void SetInsideShape(int i, Shape_ptr S)
set the ith InsideShape put in to S
Definition: Shape.hxx:242
virtual unsigned IsFull()
1 if Shape is Full (whole space)
Definition: Shape.hxx:94
virtual unsigned IsSphere()
1 if Shape is a Sphere
Definition: Shape.hxx:92
double fVirtualSphereR
the radius of a Sphere containing the Shape
Definition: Shape.hxx:357
Shape_ptr & operator>>(Shape_ptr &B, Shape_ptr &A)
Definition: Shape.cxx:444
Shape_ptr fLinkedPlane
the Plane linked to an this for periodic boundary
Definition: Shape.hxx:366
void SetSurface(double S)
Set the surface of a Shape to S.
Definition: Shape.hxx:113
bool GetMouvement()
returns fMouvement flag;
Definition: Shape.hxx:206
void SetSigne(double s)
Definition: Shape.hxx:70
virtual unsigned Add(Shape_ptr OtherShape)
Add a new Shape (in fact a Shape_ptr) to a Node.
Definition: Shape.hxx:178
virtual void Simplify(bool violent=false)
Simplify a tree of Node.
Definition: Shape.hxx:212
unsigned GetOriginalInsideShapeSize()
return the number of Original Shape put in this
Definition: Shape.hxx:241
virtual void ReplaceNode(Shape_ptr C)
Replace a Node by an other (C must be a Node)
Definition: Shape.hxx:312
virtual bool PointInShape(double *P, int border)
true if the point P is in the Shape.
Definition: Shape.hxx:310
virtual unsigned IsTube()
1 if Shape is a Tube
Definition: Shape.hxx:93
unsigned GetInsideShapeSize()
return the number of Shape put in this
Definition: Shape.hxx:240
virtual void SetTopBottomPlanesOpen()
The top/bottom planes are NOT mirrors.
Definition: Shape.hxx:115
bool fAlreadyDefine
Flag to know whether a surface is already defined.
Definition: Shape.hxx:350
virtual void SetLinkedPlane(Shape_ptr P)
linked plane for periodic boundary
Definition: Shape.hxx:311
vector< Shape_ptr > fInsideShape
a vector to remember which Shapes are inside the current one.Clear at each &quot;&gt;&gt;&quot;
Definition: Shape.hxx:344
double fSurface
the Surface of a Shape;
Definition: Shape.hxx:355
void ClearOriginalInsideShape()
Clear all Inside Shapes.
Definition: Shape.hxx:238
Shape_ptr operator|(Shape_ptr A, Shape_ptr B)
Definition: Shape.cxx:429
virtual string PrintSurface()
Print the Shape surfaces in MCNP surface block.
Definition: Shape.hxx:253
virtual void DefineSurface()
Define MCNP surfaces for this Shape.
Definition: Shape.hxx:271
virtual void Copy(Shape_ptr S)
Copy all attributs of a Shape S (but not attributs of the father classes).
Definition: Shape.hxx:259
File including all headers.
int fUniverse
Universe number (for lattice filling)
Definition: Shape.hxx:352
bool fInfinite
Determines whether the shape is infinite or not.
Definition: Shape.hxx:348
virtual unsigned IsFullVoid()
1 if Shape is Full (whole space) or Void (empty set)
Definition: Shape.hxx:88
virtual void DevElague(int count=0, bool violent=false)
Developps and Trims a tree of Node.
Definition: Shape.hxx:217
void IncrementSurface(double S)
Increment the surface of a Shape of S.
Definition: Shape.hxx:284
virtual unsigned Inclus(Shape_ptr OtherShape)
return 1 if a shape is included in OtherShape.
Definition: Shape.hxx:190
void SetOriginalInsideShape(int i, Shape_ptr S)
set the ith Original InsideShape put in to S
Definition: Shape.hxx:243
bool fPeriodicBoundary
wether or not Periodic boundary are applied (only for plane)
Definition: Shape.hxx:364
virtual unsigned Disjoint(Shape_ptr OtherShape)
return 1 if a shape is disjointed in OtherShape.
Definition: Shape.hxx:197
double fSigne
Define whether the interior (-1) or the exterior (+1) of the Shape is considered. ...
Definition: Shape.hxx:347
Reference_ptr< Shape > Shape_ptr
Definition: MCNPSource.hxx:17
virtual bool GetSidePlanesOpen()
GetThe side planes are NOT mirrors.
Definition: Shape.hxx:118
void SetZone(int z)
set test flag for complex geometries
Definition: Shape.hxx:317
bool fWhiteBoundary
wether or not mirror a particle on the surface with a cosine distribution
Definition: Shape.hxx:363
bool IsInfinite()
Return 1 if the Shape is an axially infinite one (??? why not resolve thru inheritance as same as sha...
Definition: Shape.hxx:78
virtual void Rotate(double phi, double theta=0, double psi=0, double *center=0, int count=0)
Rotate the Shape clockwise.
Definition: Shape.hxx:150
Shape_ptr fCloneShape
the clone of a Shape
Definition: Shape.hxx:359
unsigned AddOriginalInsideShape(Shape_ptr OtherShape)
This method is called by Shape::AddInsideShape.
Definition: Shape.hxx:237
virtual void Translate(double dx, double dy, double dz, int count=0)
Translate the Shape of (dx,dy,dz).
Definition: Shape.hxx:158
double fVolume
the Volume of a Shape;
Definition: Shape.hxx:354
virtual bool GetTopBottomPlanesOpen()
GetThe top/bottom planes are NOT mirrors.
Definition: Shape.hxx:116
bool fOutermostShape
wether or not this Shape is the limit to the exterior world (for calculating particle losses)...
Definition: Shape.hxx:368
void SetNotofNot()
Give a Not to the Not.
Definition: Shape.hxx:333
int GetFill()
return the Univers number that fills the Shape.
Definition: Shape.hxx:282
virtual unsigned IsVoid()
1 if Shape is Void (empty set)
Definition: Shape.hxx:95
virtual unsigned IsBrick()
1 if Shape is a Brick
Definition: Shape.hxx:86
bool fOpenXYPlanes
whether the side planes are not mirrors (default=false)
Definition: Shape.hxx:362
void SetNot(Shape *Not)
Allocates and calculs the complement of Shape.
Definition: Shape.hxx:327
vector< Shape_ptr > fOriginalInsideShape
a vector to remember which Shapes are inside the current one.
Definition: Shape.hxx:345
Shape_ptr GetOriginalInsideShape(int i)
return the ith Original InsideShape put in this
Definition: Shape.hxx:245
virtual void SetFill(int f)
Set the Universe number filling a Shape.
Definition: Shape.hxx:280
Shape_ptr & operator&=(Shape_ptr &A, Shape_ptr B)
Definition: Shape.cxx:415
virtual int NumberOfShapes()
returns the number of Shape
Definition: Shape.hxx:315
Shape_ptr & operator|=(Shape_ptr &A, Shape_ptr B)
Definition: Shape.cxx:422
bool fOpenZPlanes
whether the top/bottom planes are not mirrors (default=false)
Definition: Shape.hxx:361
Shape_ptr operator&(Shape_ptr A, Shape_ptr B)
Intersection of A and B.
Definition: Shape.cxx:401
virtual bool IsMirrorBoundary()
mirror a particle on the surface
Definition: Shape.hxx:131
virtual int GetNumberOfLeaves()
returns the number of leaves (Shape) of a Node
Definition: Shape.hxx:261
void ClearInsideShape()
Clear all Inside Shapes.
Definition: Shape.hxx:239
string fTopBottPlaneBoundaryCondition
wether the top(bottom) plane of a periodic boundary Shape is white or mirror
Definition: Shape.hxx:365
bool fMirrorBoundary
wether or not mirror a particle on the surface
Definition: Shape.hxx:360
Base class to reference all Shape objects.
Definition: TReference.hxx:17
Shape_ptr GetInsideShape(int i)
return the ith InsideShape put in this
Definition: Shape.hxx:244
Base class to define shapes.
Definition: Shape.hxx:54

MURE Project, documentation generated by Doxygen 1.8.5 - Mon Nov 17 2014