An open source method of characteristics neutron transport code.
LocalCoords.h
Go to the documentation of this file.
1 
8 #ifndef LOCALCOORDS_H_
9 #define LOCALCOORDS_H_
10 
11 #ifdef __cplusplus
12 #ifdef SWIG
13 #include "Python.h"
14 #endif
15 #include "Point.h"
16 #include "Universe.h"
17 #include "Cell.h"
18 #include "constants.h"
19 #endif
20 
21 /* Forward declarations to resolve circular dependencies */
22 class Universe;
23 class Lattice;
24 class Cell;
25 
30 enum coordType {
33 
36 };
37 
38 
46 class LocalCoords {
47 
48 private:
50  coordType _type;
51 
53  Universe* _universe;
54 
56  Cell* _cell;
57 
59  Lattice* _lattice;
60 
63  int _lattice_x;
64 
67  int _lattice_y;
68 
71  int _lattice_z;
72 
74  Point _coords;
75 
77  double _phi;
78 
80  double _polar;
81 
83  LocalCoords* _next;
84 
86  LocalCoords* _prev;
87 
89  LocalCoords* _next_array;
90 
92  int _position;
93 
95  int _array_size;
96 
98  int _version_num;
99 
100  void setArrayPosition(LocalCoords* array, int position, int array_size);
101 
102 public:
103  LocalCoords(double x=0.0, double y=0.0, double z=0.0, bool first=false);
104  virtual ~LocalCoords();
105  coordType getType();
106  Universe* getUniverse() const;
107  Cell* getCell() const;
108  Lattice* getLattice() const;
109  int getLatticeX() const;
110  int getLatticeY() const;
111  int getLatticeZ() const;
112  double getX() const;
113  double getY() const;
114  double getZ() const;
115  double getPhi() const;
116  double getPolar() const;
117  Point* getPoint();
118  LocalCoords* getNext() const;
119  LocalCoords* getNextCreate(double x, double y, double z);
120  LocalCoords* getPrev() const;
121  int getVersionNum();
122  int getPosition();
123 
124  void setType(coordType type);
125  void setUniverse(Universe* universe);
126  void setCell(Cell* cell);
127  void setLattice(Lattice* lattice);
128  void setLatticeX(int lattice_x);
129  void setLatticeY(int lattice_y);
130  void setLatticeZ(int lattice_z);
131  void setX(double x);
132  void setY(double y);
133  void setZ(double z);
134  void setPhi(double phi);
135  void setPolar(double polar);
136  void setNext(LocalCoords *next);
137  void setPrev(LocalCoords* coords);
138  void setVersionNum(int version_num);
139 
142  void adjustCoords(double delta_x, double delta_y, double delta_z=0.0);
143  void updateMostLocal(Point* point);
144  void prune();
145  void deleteArray();
146  void copyCoords(LocalCoords* coords);
147  std::string toString();
148  void detectLoop();
149 };
150 
151 
152 #endif /* LOCALCOORDS_H_ */
void deleteArray()
Deletes the underlying array for next coordinates.
Definition: LocalCoords.cpp:531
void setPrev(LocalCoords *coords)
Sets the pointer to the LocalCoords on the next higher nested Universe level.
Definition: LocalCoords.cpp:383
LocalCoords(double x=0.0, double y=0.0, double z=0.0, bool first=false)
Constructor sets the x, y and z coordinates and position as a coord.
Definition: LocalCoords.cpp:11
Represents a Cell inside of a Universe.
Definition: Cell.h:56
The LocalCoords represents a set of local coordinates on some level of nested Universes making up the...
Definition: LocalCoords.h:46
LocalCoords * getNextCreate(double x, double y, double z)
Creates and returns a pointer to the next LocalCoords (nested deeper).
Definition: LocalCoords.cpp:181
void adjustCoords(double delta_x, double delta_y, double delta_z=0.0)
Translate all of the x,y,z coordinates for each LocalCoords object in the linked list.
Definition: LocalCoords.cpp:462
virtual ~LocalCoords()
Destructor.
Definition: LocalCoords.cpp:36
LocalCoords * getPrev() const
Return a pointer to the LocalCoord at the next higher nested Universe level if one exists...
Definition: LocalCoords.cpp:242
void setPolar(double polar)
Set the polar angle for this LocalCoords.
Definition: LocalCoords.cpp:363
void setY(double y)
Set the y-coordinate for this Localcoords.
Definition: LocalCoords.cpp:336
void setVersionNum(int version_num)
Sets the version of the LocalCoords object.
Definition: LocalCoords.cpp:409
void setZ(double z)
Set the z-coordinate for this LocalCoords.
Definition: LocalCoords.cpp:345
Math constants and comparision tolerances.
LocalCoords * getLowestLevel()
Find and return the last LocalCoords in the linked list which represents the local coordinates on the...
Definition: LocalCoords.cpp:423
The Point class.
double getX() const
Returns the x-coordinate for this LocalCoords location.
Definition: LocalCoords.cpp:112
A Universe represents an unbounded space in 3D.
Definition: Universe.h:58
void setLatticeZ(int lattice_z)
Sets the z index for the Lattice cell within which this LocalCoords resides.
Definition: LocalCoords.cpp:318
int getLatticeZ() const
Return the third index of the Lattice cell within which this LocalCoords resides. ...
Definition: LocalCoords.cpp:103
Lattice * getLattice() const
Return the Lattice within which this LocalCoords resides.
Definition: LocalCoords.cpp:74
Class to represent a 2D/3D point in space.
Definition: Point.h:24
Point * getPoint()
Returns a pointer to the Point containing the coordinates for this LocalCoord.
Definition: LocalCoords.cpp:158
double getPhi() const
Returns the direction angle in radians with respect to the x-axis.
Definition: LocalCoords.cpp:139
double getZ() const
Returns the z-coordinate for this LocalCoords location.
Definition: LocalCoords.cpp:130
coordType getType()
Return the level (UNIV or LAT) of this LocalCoords.
Definition: LocalCoords.cpp:47
int getVersionNum()
Returns the version of the LocalCoords object.
Definition: LocalCoords.cpp:252
Definition: LocalCoords.h:35
void setLatticeY(int lattice_y)
Sets the column index for the Lattice cell within which this LocalCoords resides. ...
Definition: LocalCoords.cpp:308
void setLattice(Lattice *lattice)
Sets the Lattice within which this LocalCoords resides.
Definition: LocalCoords.cpp:288
The Cell class.
Universe * getUniverse() const
Return the Universe within which this LocalCoords resides.
Definition: LocalCoords.cpp:56
void updateMostLocal(Point *point)
Update the last element in the linked list (the one at the lowest level of nested Universes) to have ...
Definition: LocalCoords.cpp:491
void setLatticeX(int lattice_x)
Sets the row index for the Lattice cell within which this LocalCoords resides.
Definition: LocalCoords.cpp:298
The Universe class.
void setPhi(double phi)
Set the azimuthal angle for this LocalCoords.
Definition: LocalCoords.cpp:354
LocalCoords * getHighestLevel()
Find and return the first LocalCoords in the linked list which represents the local coordinates on th...
Definition: LocalCoords.cpp:442
coordType
The type of Universe level on which the LocalCoords reside.
Definition: LocalCoords.h:30
int getLatticeX() const
Return the first index of the Lattice cell within which this LocalCoords resides. ...
Definition: LocalCoords.cpp:83
void setUniverse(Universe *universe)
Set the Universe within which this LocalCoords resides.
Definition: LocalCoords.cpp:270
Definition: LocalCoords.h:32
void setX(double x)
Set the x-coordinate for this LocalCoords.
Definition: LocalCoords.cpp:327
void setType(coordType type)
Set the type of LocalCoords (UNIV or LAT).
Definition: LocalCoords.cpp:261
int getPosition()
Returns the LocalCoords position in the _next_array.
Definition: LocalCoords.cpp:212
std::string toString()
Converts this LocalCoords's attributes to a character array representation.
Definition: LocalCoords.cpp:592
void prune()
Removes and frees memory for all LocalCoords beyond this one in the linked list.
Definition: LocalCoords.cpp:510
int getLatticeY() const
Return the second index of the Lattice cell within which this LocalCoords resides.
Definition: LocalCoords.cpp:93
double getPolar() const
Returns the direction angle in radians with respect to the z-axis.
Definition: LocalCoords.cpp:148
void detectLoop()
Searches through the LocalCoords object to detect a loop.
Definition: LocalCoords.cpp:222
Cell * getCell() const
Return the Cell within which this LocalCoords resides.
Definition: LocalCoords.cpp:65
Represents a repeating 3D Lattice of Universes.
Definition: Universe.h:156
void setCell(Cell *cell)
Set the Cell within which this LocalCoords resides.
Definition: LocalCoords.cpp:279
LocalCoords * getNext() const
Return a pointer to the LocalCoord at the next lower nested Universe level if one exists...
Definition: LocalCoords.cpp:168
void copyCoords(LocalCoords *coords)
Copies a LocalCoords' values to this one.
Definition: LocalCoords.cpp:546
void setNext(LocalCoords *next)
Sets the pointer to the LocalCoords on the next lower nested Universe level.
Definition: LocalCoords.cpp:373
double getY() const
Returns the y-coordinate for this LocalCoords location.
Definition: LocalCoords.cpp:121