An open source method of characteristics neutron transport code.
Region.h
Go to the documentation of this file.
1 
7  #ifndef REGION_H_
8 #define REGION_H_
9  #ifdef __cplusplus
10 #ifdef SWIG
11 #include "Python.h"
12 #endif
13 #include "Surface.h"
14 #include "boundary_type.h"
15 #include <limits>
16 #endif
17 
18 /* Forward declarations to resolve circular dependencies */
19 class Intersection;
20 class Union;
21 class Complement;
22 class Halfspace;
23 
28 enum regionType {
37 };
38 
43 class Region {
44 
45 protected:
46 
49 
51  std::vector<Region*> _nodes;
52 
55 
56 public:
57  Region();
58  virtual ~Region();
59 
60  /* Functions for constructing the Region / other Regions */
61  virtual void addNode(Region* node, bool clone=true);
62  void removeHalfspace(Surface* surface, int halfspace);
64  void setParentRegion(Region* node);
66 
67  /* Getter functions */
68  virtual std::vector<Region*> getNodes();
69  virtual std::vector<Region*> getAllNodes();
70  virtual std::map<int, Halfspace*> getAllSurfaces();
71 
72  /* Worker functions */
73  virtual double getMinX();
74  virtual double getMaxX();
75  virtual double getMinY();
76  virtual double getMaxY();
77  virtual double getMinZ();
78  virtual double getMaxZ();
85  virtual bool containsPoint(Point* point) =0;
86  virtual double minSurfaceDist(LocalCoords* coords);
87  virtual double minSurfaceDist(Point* point, double azim, double polar=M_PI_2);
88  virtual Region* clone();
89 };
90 
95 class Intersection : public Region {
96 
97 public:
98  Intersection();
99  bool containsPoint(Point* point);
100 };
101 
106 class Union : public Region {
107 
108 public:
109  Union();
110  bool containsPoint(Point* point);
111 };
112 
117 class Complement : public Region {
118 
119 public:
120  Complement();
121  void addNode(Region* node, bool clone=true);
122  bool containsPoint(Point* point);
123 };
124 
129 class Halfspace : public Region {
130 
131 public:
132 
135 
138 
139  Halfspace(int halfspace, Surface* surface);
140  Halfspace* clone();
141  Surface* getSurface();
142  int getHalfspace();
143  void reverseHalfspace();
144  std::map<int, Halfspace*> getAllSurfaces();
145  double getMinX();
146  double getMaxX();
147  double getMinY();
148  double getMaxY();
149  double getMinZ();
150  double getMaxZ();
157  bool containsPoint(Point* point);
158  double minSurfaceDist(LocalCoords* coords);
159  double minSurfaceDist(Point* point, double azim, double polar=M_PI_2);
160 };
161 
167 
168 public:
169  RectangularPrism(double width_x, double width_y, double origin_x=0.,
170  double origin_y=0., double width_z=3E300,
171  double origin_z=0.);
172  void setBoundaryType(boundaryType boundary_type);
173 };
174 
175 #endif /* REGION_H_ */
A complement of a Region.
Definition: Region.h:117
virtual double getMaxY()
Return the maximum reachable y-coordinate in the Region.
Definition: Region.cpp:253
The LocalCoords represents a set of local coordinates on some level of nested Universes making up the...
Definition: LocalCoords.h:46
Complement()
Constructor sets the type of Region (COMPLEMENT).
Definition: Region.cpp:714
virtual boundaryType getMinZBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the minimum reachable z-coordinat...
Definition: Region.cpp:502
Represents a general Surface in 3D.
Definition: Surface.h:70
virtual double getMaxX()
Return the maximum reachable x-coordinate in the Region.
Definition: Region.cpp:191
Region * getParentRegion()
Get the parent of the current node/Region.
Definition: Region.cpp:150
std::map< int, Halfspace * > getAllSurfaces()
Extracts a map of this Halfspace indexed by its Surface ID.
Definition: Region.cpp:817
Union()
Constructor sets the type of Region (UNION).
Definition: Region.cpp:687
boundaryType
The types of boundary conditions supported by OpenMOC for Surfaces.
Definition: boundary_type.h:15
void removeHalfspace(Surface *surface, int halfspace)
Removes a Node from this Region.
Definition: Region.cpp:45
A union of two or more Regions.
Definition: Region.h:106
virtual boundaryType getMaxYBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the maximum reachable y-coordinat...
Definition: Region.cpp:463
virtual double getMaxZ()
Return the maximum reachable z-coordinate in the Region.
Definition: Region.cpp:315
Surface * _surface
Definition: Region.h:134
virtual double getMinX()
Return the minimum reachable x-coordinate in the Region.
Definition: Region.cpp:160
virtual std::map< int, Halfspace * > getAllSurfaces()
Extracts a map of all Halfspaces contained in the Region.
Definition: Region.cpp:113
double getMinY()
Return the minimum reachable y-coordinate in the Halfspace.
Definition: Region.cpp:846
virtual double minSurfaceDist(LocalCoords *coords)
Computes the minimum distance to a Surface in the Region from a point with a given trajectory at a ce...
Definition: Region.cpp:583
void addNode(Region *node, bool clone=true)
Add a node to the complement Region.
Definition: Region.cpp:729
Class to represent a 2D/3D point in space.
Definition: Point.h:24
virtual ~Region()
Destructor clears vector of the nodes within the Region.
Definition: Region.cpp:15
virtual Region * clone()
Create a duplicate of the Region.
Definition: Region.cpp:637
Halfspace * clone()
Create a duplicate of the Halfspace.
Definition: Region.cpp:777
boundaryType getMaxXBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) of the Halfspace&#39;s Surface...
Definition: Region.cpp:893
A region of space that can be assigned to a Cell.
Definition: Region.h:43
int getHalfspace()
Return the side of the Surface for this Halfspace.
Definition: Region.cpp:796
An intersection of two or more Regions.
Definition: Region.h:95
virtual boundaryType getMaxXBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the maximum reachable x-coordinat...
Definition: Region.cpp:385
double minSurfaceDist(LocalCoords *coords)
Computes the minimum distance to the Surface in the Halfspace from a point with a given trajectory at...
Definition: Region.cpp:971
void setBoundaryType(boundaryType boundary_type)
Sets the boundary condition type (ie., VACUUM, REFLECTIVE, etc) to assign to each of the planes bound...
Definition: Region.cpp:1027
virtual double getMinY()
Return the minimum reachable y-coordinate in the Region.
Definition: Region.cpp:222
bool containsPoint(Point *point)
Determines whether a Point is contained inside the Halfspace.
Definition: Region.cpp:944
Definition: Region.h:30
RectangularPrism(double width_x, double width_y, double origin_x=0., double origin_y=0., double width_z=3E300, double origin_z=0.)
Constructor creates an Intersection of the Intersection of two XPlane and two YPlane (and two ZPlane ...
Definition: Region.cpp:990
regionType getRegionType()
Return the type of Region (ie, UNION, INTERSECTION, etc).
Definition: Region.cpp:132
boundaryType getMaxYBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) of the Halfspace&#39;s Surface...
Definition: Region.cpp:913
double getMinX()
Return the minimum reachable x-coordinate in the Halfspace.
Definition: Region.cpp:828
virtual double getMinZ()
Return the minimum reachable z-coordinate in the Region.
Definition: Region.cpp:284
Surface * getSurface()
Return a pointer to the Halfspace&#39;s Surface.
Definition: Region.cpp:787
boundaryType getMinYBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) of the Halfspace&#39;s Surface...
Definition: Region.cpp:903
regionType
The types of regions supported by OpenMOC.
Definition: Region.h:28
bool containsPoint(Point *point)
Determines whether a Point is contained inside the Complement.
Definition: Region.cpp:750
Definition: Region.h:36
virtual std::vector< Region * > getAllNodes()
Return a vector of all of the Region&#39;s nodes.
Definition: Region.cpp:87
regionType _region_type
Definition: Region.h:48
virtual boundaryType getMaxZBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the maximum reachable z-coordinat...
Definition: Region.cpp:541
std::vector< Region * > _nodes
Definition: Region.h:51
An infinite rectangular prism aligned with the z-axis.
Definition: Region.h:166
void reverseHalfspace()
Changes the side of the surface for this Halfspace.
Definition: Region.cpp:804
virtual boundaryType getMinYBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the minimum reachable y-coordinat...
Definition: Region.cpp:424
Halfspace(int halfspace, Surface *surface)
Constructor sets the type of Region (HALFSPACE).
Definition: Region.cpp:763
bool containsPoint(Point *point)
Determines whether a Point is contained inside the Union.
Definition: Region.cpp:699
double getMinZ()
Return the minimum reachable z-coordinate in the Halfspace.
Definition: Region.cpp:864
Definition: Region.h:32
virtual boundaryType getMinXBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the minimum reachable x-coordinat...
Definition: Region.cpp:346
virtual void addNode(Region *node, bool clone=true)
Add a node to the Region.
Definition: Region.cpp:31
boundaryType getMinZBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) of the Halfspace&#39;s Surface...
Definition: Region.cpp:923
Definition: Region.h:34
double getMaxX()
Return the maximum reachable x-coordinate in the Halfspace.
Definition: Region.cpp:837
int _halfspace
Definition: Region.h:137
double getMaxZ()
Return the maximum reachable z-coordinate in the Halfspace.
Definition: Region.cpp:873
Region * _parent_region
Definition: Region.h:54
boundaryType getMinXBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) of the Halfspace&#39;s Surface...
Definition: Region.cpp:883
Intersection()
Constructor sets the type of Region (INTERSECTION).
Definition: Region.cpp:659
A positive or negative halfspace Region.
Definition: Region.h:129
Region()
Constructor sets a few pointers to NULL.
Definition: Region.cpp:7
double getMaxY()
Return the maximum reachable y-coordinate in the Halfspace.
Definition: Region.cpp:855
boundaryType getMaxZBoundaryType()
Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) of the Halfspace&#39;s Surface...
Definition: Region.cpp:933
bool containsPoint(Point *point)
Determines whether a Point is contained inside the Intersection.
Definition: Region.cpp:672
virtual std::vector< Region * > getNodes()
Return a vector of all of the Region&#39;s immediate nodes.
Definition: Region.cpp:76
void setParentRegion(Region *node)
Set the parent of the current node/Region.
Definition: Region.cpp:141