An open source method of characteristics neutron transport code.
TrackGenerator3D.h
Go to the documentation of this file.
1 
8 #ifndef TRACKGENERATOR3D_H_
9 #define TRACKGENERATOR3D_H_
10 
11 #include "TrackGenerator.h"
12 #include "Track3D.h"
13 
14 
22 
24  int _azim;
25 
27  int _x;
28 
30  int _polar;
31 
33  int _lz;
34 
36  int _link;
37 
40  _azim = -1;
41  _x = -1;
42  _polar = -1;
43  _lz = -1;
44  _link = -1;
45  }
46 };
47 
48 
55 
57  int _azim;
58 
60  int _xy;
61 
63  int _polar;
64 
66  int _z;
67 
70  _azim = -1;
71  _xy = -1;
72  _polar = -1;
73  _z = -1;
74  }
75 };
76 
77 
87 
88 private:
89 
91  int _num_polar;
92 
94  double _z_spacing;
95 
97  Track**** _tracks_2D_chains;
98 
100  int*** _tracks_per_stack;
101 
104  long*** _cum_tracks_per_stack;
105 
108  long** _cum_tracks_per_xy;
109 
111  int*** _first_lz_of_stack;
112 
114  int _num_3D_tracks;
115 
117  int** _num_z;
118  int** _num_l;
119 
120  /* Arrays for the spacing along each axis */
121  double** _dz_eff;
122  double** _dl_eff;
123 
125  Track3D**** _tracks_3D;
126 
129  std::vector<double> _segmentation_heights;
130 
132  std::vector<double> _global_z_mesh;
133 
135  int _num_seg_matrix_rows;
136  int _num_seg_matrix_columns;
137 
140  std::vector<segment*> _temporary_segments;
141  bool _contains_temporary_segments;
142 
145  std::vector<Track3D*> _temporary_3D_tracks;
146  std::vector<Track**> _temporary_tracks_array;
147  bool _contains_temporary_tracks;
148 
151  int _max_num_tracks_per_stack;
152 
155  bool _contains_3D_tracks;
156  bool _contains_3D_segments;
157  bool _contains_global_z_mesh;
158  bool _contains_segmentation_heights;
159 
161  void initializeTracks();
162  void initialize2DTrackChains();
163  void recalibrateTracksToOrigin();
164  void segmentize();
165  void setContainsSegments(bool contains_segments);
166  void allocateTemporarySegments();
167  void allocateTemporaryTracks();
168  void resetStatus();
169  void initializeDefaultQuadrature();
170  std::string getTestFilename(std::string directory);
171  void getCycleTrackData(TrackChainIndexes* tcis, int num_cycles,
172  bool save_tracks);
173 
174  void segmentizeExtruded();
175  void set3DTrackData(TrackChainIndexes* tci, Track3D* track,
176  bool create_arrays, bool save_tracks);
177  double getLStart(TrackChainIndexes* tci);
178  int getFirst2DTrackLinkIndex(TrackChainIndexes* tci, Track3D* track_3D);
179 
180  void writeExtrudedFSRInfo(FILE* out);
181  void readExtrudedFSRInfo(FILE* in);
182 
183 public:
184 
185  TrackGenerator3D(Geometry* geometry, int num_azim, int num_polar,
186  double azim_spacing, double z_spacing);
187  virtual ~TrackGenerator3D();
188 
189  /* Get parameters */
190  int getNumPolar();
191  double getDesiredZSpacing();
192  long getNumTracks();
193  long getNumSegments();
194  long getNum3DTracks();
195  long getNum3DSegments();
196  Track3D**** get3DTracks();
197  double getZSpacing(int azim, int polar);
198  int getNumRows();
199  int getNumColumns();
200  segment* getTemporarySegments(int thread_id);
201  Track3D* getTemporary3DTracks(int thread_id);
202  Track** getTemporaryTracksArray(int thread_id);
203  int getNumZ(int azim, int polar);
204  int getNumL(int azim, int polar);
205  int*** getTracksPerStack();
207  bool containsTracks();
208  bool containsSegments();
210  long get3DTrackID(TrackStackIndexes* tsi);
215  void getTSIByIndex(long id, TrackStackIndexes* tsi);
216 
217  void getTrackOTF(Track3D* track, TrackStackIndexes* tsi);
218 
219  /* Set parameters */
220  void setNumPolar(int num_polar);
221  void setDesiredZSpacing(double spacing);
222  void setSegmentFormation(segmentationType segmentation_type);
223  void setSegmentationZones(std::vector<double> z_mesh);
225  bool outgoing, Track3D* track);
227  void useGlobalZMesh();
228 
229  /* Worker functions */
230  void retrieveTrackCoords(double* coords, long num_tracks);
231  void retrieve3DTrackCoords(double* coords, long num_tracks);
232  void retrieveGlobalZMesh(double*& z_mesh, int& num_fsrs);
233  void retrieveSingle3DTrackCoords(double coords[6], long track_id);
234  void retrieveSegmentCoords(double* coords, long num_segments);
235  void retrieve3DSegmentCoords(double* coords, long num_segments);
236  void create3DTracksArrays();
238 };
239 
240 #endif /* TRACKGENERATOR3D_H_ */
void retrieveSingle3DTrackCoords(double coords[6], long track_id)
Fills an array with the x,y,z coordinates for a given track.
Definition: TrackGenerator3D.cpp:1363
void retrieveGlobalZMesh(double *&z_mesh, int &num_fsrs)
Provides the global z-mesh and size if available.
Definition: TrackGenerator3D.cpp:479
int getNumPolar()
Return the number of polar angles in .
Definition: TrackGenerator3D.cpp:121
void retrieve3DTrackCoords(double *coords, long num_tracks)
Fills an array with the x,y,z coordinates for each Track.
Definition: TrackGenerator3D.cpp:528
void getTSIByIndex(long id, TrackStackIndexes *tsi)
Updates stack indexes to reflect those from the given Track ID.
Definition: TrackGenerator3D.cpp:2382
bool containsTracks()
Returns whether or not the TrackGenerator contains Tracks for its current number of azimuthal angles...
Definition: TrackGenerator3D.cpp:1672
virtual ~TrackGenerator3D()
Destructor frees memory for all Tracks.
Definition: TrackGenerator3D.cpp:42
Track3D * getTemporary3DTracks(int thread_id)
Returns an array of temporary 3D Tracks for use in on-the-fly computations.
Definition: TrackGenerator3D.cpp:278
void checkBoundaryConditions()
Checks the boundary conditions for all 3D surfaces for inconsistent periodic boundary conditions...
Definition: TrackGenerator3D.cpp:1551
int _azim
Definition: TrackGenerator3D.h:57
int _z
Definition: TrackGenerator3D.h:66
A Track chain represents a list of Tracks connected via periodic BCs that extend in the l-z plane and...
Definition: TrackGenerator3D.h:21
void setDesiredZSpacing(double spacing)
Set the suggested track polar spacing (cm).
Definition: TrackGenerator3D.cpp:367
double getZSpacing(int azim, int polar)
Returns the spacing between tracks in the axial direction for the requested azimuthal angle index and...
Definition: TrackGenerator3D.cpp:210
void retrieveTrackCoords(double *coords, long num_tracks)
Fills an array with the x,y,z coordinates for each Track.
Definition: TrackGenerator3D.cpp:507
int _x
Definition: TrackGenerator3D.h:27
int getNum3DTrackChainLinks(TrackChainIndexes *tci)
Calculates the number of Tracks in the l-z traversal.
Definition: TrackGenerator3D.cpp:1821
The TrackGenerator is dedicated to generating and storing Tracks which cyclically wrap across the Geo...
Definition: TrackGenerator.h:36
bool containsSegments()
Returns whether or not the TrackGenerator contains 3D segments for its current number of azimuthal an...
Definition: TrackGenerator3D.cpp:1683
int getNumColumns()
Returns the number of columns in the temporary segment storage matrix.
Definition: TrackGenerator3D.cpp:248
segmentationType
The types of Track segmentation supported by OpenMOC.
Definition: segmentation_type.h:15
A stack track represents a track in a z-stack of tracks and this struct contains the azim...
Definition: TrackGenerator3D.h:54
void setSegmentationZones(std::vector< double > z_mesh)
Sets the z-planes over which 2D segmentation is performed for on-the-fly calculations.
Definition: TrackGenerator3D.cpp:396
void convertTCItoTSI(TrackChainIndexes *tci, TrackStackIndexes *tsi)
Converts TrackChainIndexes to TrackStackIndexes.
Definition: TrackGenerator3D.cpp:1779
Track3D **** get3DTracks()
Get the array of 3D Tracks, only used in EXPLICT-3D ray tracing.
Definition: TrackGenerator3D.cpp:1752
TrackChainIndexes()
Definition: TrackGenerator3D.h:39
A 3D Track represents a characteristic line across the geometry.
Definition: Track3D.h:35
int _polar
Definition: TrackGenerator3D.h:30
The master class containing references to all geometry-related objects - Surfaces, Cells, Universes and Lattices - and Materials.
Definition: Geometry.h:122
int *** getTracksPerStack()
Returns a 3D array of the number of 3D Tracks in each z-stack.
Definition: TrackGenerator3D.cpp:315
void setSegmentFormation(segmentationType segmentation_type)
Set the type of segmentation used for segment formation.
Definition: TrackGenerator3D.cpp:385
A segment represents a line segment within a single flat source region along a track.
Definition: Track.h:27
void convertTSItoTCI(TrackStackIndexes *tsi, TrackChainIndexes *tci)
Converts TrackStackIndexes to TrackChainIndexes.
Definition: TrackGenerator3D.cpp:1762
The 3D Track class.
void create3DTracksArrays()
Allocates memory for 3D Tracks.
Definition: TrackGenerator3D.cpp:1404
segment * getTemporarySegments(int thread_id)
Returns an array of temporary segments for use in on-the-fly computations.
Definition: TrackGenerator3D.cpp:265
The TrackGenerator class.
long get3DTrackID(TrackStackIndexes *tsi)
Returns the 3D Track ID based on its indexes.
Definition: TrackGenerator3D.cpp:1456
double getDesiredZSpacing()
Return the track polar spacing (cm).
Definition: TrackGenerator3D.cpp:133
void setLinkingTracks(TrackStackIndexes *tsi, TrackChainIndexes *tci, bool outgoing, Track3D *track)
Fills the provided 3D Track with its linking information.
Definition: TrackGenerator3D.cpp:1864
long getNum3DSegments()
Return the total number of 3D Track segments across the Geometry.
Definition: TrackGenerator3D.cpp:173
long getNum3DTracks()
Return the total number of 3D Tracks across the Geometry.
Definition: TrackGenerator3D.cpp:151
void setNumPolar(int num_polar)
Set the number of polar angles in .
Definition: TrackGenerator3D.cpp:348
int getNumRows()
Returns the number of rows in the temporary segment storage matrix.
Definition: TrackGenerator3D.cpp:233
int _azim
Definition: TrackGenerator3D.h:24
bool containsTemporaryTracks()
Returns whether or not the TrackGenerator contains an allocation for temporary Tracks to be filled on...
Definition: TrackGenerator3D.cpp:303
void useGlobalZMesh()
Sets a global z-mesh to use during axial on-the-fly ray tracing.
Definition: TrackGenerator3D.cpp:463
int getLinkIndex(TrackChainIndexes *tci)
Returns the index into the chain based on chain indexes.
Definition: TrackGenerator3D.cpp:1796
TrackGenerator3D(Geometry *geometry, int num_azim, int num_polar, double azim_spacing, double z_spacing)
Constructor for the TrackGenerator3D assigns default values.
Definition: TrackGenerator3D.cpp:13
void retrieve3DSegmentCoords(double *coords, long num_segments)
Fills an array with the x,y coordinates for each Track segment.
Definition: TrackGenerator3D.cpp:604
void getTrackOTF(Track3D *track, TrackStackIndexes *tsi)
Updates the provided Track with the correct information based on the Track indexes.
Definition: TrackGenerator3D.cpp:1697
int _xy
Definition: TrackGenerator3D.h:60
int _polar
Definition: TrackGenerator3D.h:63
long getNumSegments()
Return the total number of Track segments across the Geometry.
Definition: TrackGenerator3D.cpp:164
void retrieveSegmentCoords(double *coords, long num_segments)
Fills an array with the x,y,z coordinates for each Track segment.
Definition: TrackGenerator3D.cpp:582
TrackStackIndexes()
Definition: TrackGenerator3D.h:69
Track ** getTemporaryTracksArray(int thread_id)
Returns an array of pointers to temporary Tracks for use in on-the-fly computations.
Definition: TrackGenerator3D.cpp:291
void setLinkIndex(TrackChainIndexes *tci, TrackStackIndexes *tsi)
Updates the index into the 3D chain based on chain and stack indexes.
Definition: TrackGenerator3D.cpp:1807
int _lz
Definition: TrackGenerator3D.h:33
int getNumL(int azim, int polar)
Returns the number of 3D Tracks in the radial direction for a given azimuthal angle index and polar a...
Definition: TrackGenerator3D.cpp:339
A Track represents a characteristic line across the geometry.
Definition: Track.h:67
int getNumZ(int azim, int polar)
Returns the number of 3D Tracks in the z-direction for a given azimuthal angle index and polar angle ...
Definition: TrackGenerator3D.cpp:327
long getNumTracks()
Return the total number of 3D Tracks across the Geometry.
Definition: TrackGenerator3D.cpp:142
The TrackGenerator3D is dedicated to generating and storing Tracks which cyclically wrap across the G...
Definition: TrackGenerator3D.h:86
int getMaxNumTracksPerStack()
Returns the maximum number of tracks in a single stack.
Definition: TrackGenerator3D.cpp:219
int _link
Definition: TrackGenerator3D.h:36