An open source method of characteristics neutron transport code.
TrackTraversingAlgorithms.h
Go to the documentation of this file.
1 
20 #ifndef TRACK_TRAVERSING_ALGORITHMS_H_
21 #define TRACK_TRAVERSING_ALGORITHMS_H_
22 
23 #include "TraverseSegments.h"
24 #include "ExpEvaluator.h"
25 
27 #ifdef THREED
28 #define _NUM_COEFFS 6
29 #endif
30 
32 class CPUSolver;
33 class CPULSSolver;
34 
35 
46 private:
47  FP_PRECISION _max_tau;
48 
49 public:
50 
51  MaxOpticalLength(TrackGenerator* track_generator);
52  void execute();
53  void onTrack(Track* track, segment* segments);
54 };
55 
56 
68 private:
69  int _max_num_segments;
70  long _total_num_segments;
71  bool _count_total_segments;
72  bool _total_segments_counted;
73 
74 public:
75 
76  SegmentCounter(TrackGenerator* track_generator);
77  void execute();
78  void onTrack(Track* track, segment* segments);
79  void countTotalNumSegments();
80  long getTotalNumSegments();
81 };
82 
83 
94 
95 public:
96 
97  SegmentSplitter(TrackGenerator* track_generator);
98  void execute();
99  void onTrack(Track* track, segment* segments);
100 };
101 
102 
113 
114 public:
115 
116  VolumeCalculator(TrackGenerator* track_generator);
117  void execute();
118  void onTrack(Track* track, segment* segments);
119 };
120 
121 
134 
135 private:
136 
137  Point** _centroids;
138  FP_PRECISION* _FSR_volumes;
139  omp_lock_t* _FSR_locks;
140  Quadrature* _quadrature;
141  Point** _starting_points;
142 
143 public:
144 
145  CentroidGenerator(TrackGenerator* track_generator);
146  virtual ~CentroidGenerator();
147  void setCentroids(Point** centroids);
148  void execute();
149  void onTrack(Track* track, segment* segments);
150 };
151 
152  //TODO Improve
162 
163 private:
164 
165  double* _lin_exp_coeffs;
166  FP_PRECISION* _FSR_volumes;
167  omp_lock_t* _FSR_locks;
168  double* _src_constants;
169  Quadrature* _quadrature;
170  CPULSSolver* _solver;
171  int _num_groups;
172 #ifndef THREED
173  int _NUM_COEFFS;
174 #endif
175  int _num_flat;
176  Point** _starting_points;
177  double** _thread_source_constants;
178  ExpEvaluator* _exp_evaluator;
179  Progress* _progress;
180 
181 public:
182 
184  virtual ~LinearExpansionGenerator();
185  void execute();
186  void onTrack(Track* track, segment* segments);
187 };
188 
189 
200 
201 private:
202 
203  CPUSolver* _cpu_solver;
204  CPULSSolver* _ls_solver;
205  Geometry* _geometry;
206  int _num_groups;
207  FP_PRECISION** _thread_fsr_fluxes;
208  FP_PRECISION** _thread_scratch_pads;
209 
210 public:
211 
212  TransportSweep(CPUSolver* cpu_solver);
213  virtual ~TransportSweep();
214  void execute();
215  void onTrack(Track* track, segment* segments);
216 
217 };
218 
219 
228 
229 private:
230 
231  FILE* _out;
232 
233 public:
234 
235  DumpSegments(TrackGenerator* track_generator);
236  void setOutputFile(FILE* out);
237  void execute();
238  void onTrack(Track* track, segment* segments);
239 };
240 
241 
250 
251 private:
252 
253  FILE* _in;
254 
255 public:
256 
257  ReadSegments(TrackGenerator* track_generator);
258  void setInputFile(FILE* input);
259  void execute();
260  void onTrack(Track* track, segment* segments);
261 };
262 
263 
274 
275 private:
276 
277  CPUSolver* _cpu_solver;
278 
279 public:
280 
281  TransportSweepOTF(TrackGenerator* track_generator);
282  void setCPUSolver(CPUSolver* cpu_solver);
283  void onTrack(Track* track, segment* segments);
284  void execute();
285 };
286 
287 
299 
300 private:
301 
302  Geometry* _geometry;
303 
304 public:
305 
306  RecenterSegments(TrackGenerator* track_generator);
307  void onTrack(Track* track, segment* segments);
308  void execute();
309 };
310 
311 
320 
321 private:
322 
323  FILE* _out;
324 
325 public:
326 
327  PrintSegments(TrackGenerator* track_generator);
328  void setOutputFile(FILE* out);
329  void execute();
330  void onTrack(Track* track, segment* segments);
331 };
332 
333 #endif
This a subclass of the Solver class for multi-core CPUs using OpenMP multi-threading.
Definition: CPUSolver.h:54
void execute()
Determines the maximum number of segments per Track.
Definition: TrackTraversingAlgorithms.cpp:93
void execute()
Reads a tracking file and saves the information explicitly for every Track in the TrackGenerator...
Definition: TrackTraversingAlgorithms.cpp:1132
SegmentSplitter(TrackGenerator *track_generator)
Constructor for SegmentSplitter calls the TraverseSegments constructor.
Definition: TrackTraversingAlgorithms.cpp:152
DumpSegments(TrackGenerator *track_generator)
Constructor for DumpSegments calls the TraverseSegments constructor and initializes the output FILE t...
Definition: TrackTraversingAlgorithms.cpp:1029
void onTrack(Track *track, segment *segments)
Writes tracking information to file for a Track and associated segments.
Definition: TrackTraversingAlgorithms.cpp:1352
A class used to calculate the centroids of each FSR.
Definition: TrackTraversingAlgorithms.h:133
void onTrack(Track *track, segment *segments)
Updates the maximum number of segments per Track if a Track with a larger number of segments is obser...
Definition: TrackTraversingAlgorithms.cpp:133
A class used to count the number of segments on each Track and the maximum number of segments per Tra...
Definition: TrackTraversingAlgorithms.h:67
void onTrack(Track *track, segment *segments)
Applies the MOC equations the Track and segments.
Definition: TrackTraversingAlgorithms.cpp:860
void onTrack(Track *track, segment *segments)
Contributions to the linear source expansion terms and constant terms are calculated for every segmen...
Definition: TrackTraversingAlgorithms.cpp:644
void setInputFile(FILE *input)
Sets the input file to read in tracking information.
Definition: TrackTraversingAlgorithms.cpp:1141
long getTotalNumSegments()
Get the total number of segments.
Definition: TrackTraversingAlgorithms.cpp:118
A class used to recenter Segments once their related FSR centroid is known.
Definition: TrackTraversingAlgorithms.h:298
The TrackGenerator is dedicated to generating and storing Tracks which cyclically wrap across the Geo...
Definition: TrackGenerator.h:36
Class to represent a 2D/3D point in space.
Definition: Point.h:24
This a subclass of the CPUSolver class for using the linear source approximation. ...
Definition: CPULSSolver.h:40
void execute()
Writes all tracking information to file.
Definition: TrackTraversingAlgorithms.cpp:1041
virtual ~TransportSweep()
Destructor for the TransportSweep.
Definition: TrackTraversingAlgorithms.cpp:825
A class used to write tracking data to a file.
Definition: TrackTraversingAlgorithms.h:227
The arbitrary quadrature parent class.
Definition: Quadrature.h:76
SegmentCounter(TrackGenerator *track_generator)
Constructor for SegmentCounter calls the TraverseSegments constructor and sets the max number of segm...
Definition: TrackTraversingAlgorithms.cpp:78
CentroidGenerator(TrackGenerator *track_generator)
Constructor for CentroidGenerator calls the TraverseSegments constructor and imports references to bo...
Definition: TrackTraversingAlgorithms.cpp:292
void execute()
When executed, the Kernel loops over all tracks, both generating them and solving the MOC equations...
Definition: TrackTraversingAlgorithms.cpp:1226
A class used to ray trace and apply the MOC transport equations simultaneously On-The-Fly.
Definition: TrackTraversingAlgorithms.h:273
The master class containing references to all geometry-related objects - Surfaces, Cells, Universes and Lattices - and Materials.
Definition: Geometry.h:122
void setCPUSolver(CPUSolver *cpu_solver)
Set the solver for the OTF TransportSweep.
Definition: TrackTraversingAlgorithms.cpp:1240
void execute()
MOC equations are applied to every segment in the TrackGenerator.
Definition: TrackTraversingAlgorithms.cpp:836
Definition: Progress.h:33
A segment represents a line segment within a single flat source region along a track.
Definition: Track.h:27
void onTrack(Track *track, segment *segments)
Writes tracking information to file for a Track and associated segments.
Definition: TrackTraversingAlgorithms.cpp:1070
void execute()
Calculates the centroid of every FSR.
Definition: TrackTraversingAlgorithms.cpp:328
TransportSweepOTF(TrackGenerator *track_generator)
Constructor for TransportSweepOTF calls the TraverseSegments constructor.
Definition: TrackTraversingAlgorithms.cpp:1216
A class used to write tracking data to a file.
Definition: TrackTraversingAlgorithms.h:319
ReadSegments(TrackGenerator *track_generator)
Constructor for ReadSegments calls the TraverseSegments constructor and initializes the input FILE to...
Definition: TrackTraversingAlgorithms.cpp:1121
RecenterSegments(TrackGenerator *track_generator)
Constructor for the RecenterSegments calls the TraverseSegments constructor and sets the track genera...
Definition: TrackTraversingAlgorithms.cpp:1260
A class used to apply the MOC transport equations to all segments.
Definition: TrackTraversingAlgorithms.h:199
void execute()
Determines the maximum optical path length for the TrackGenerator provided during construction...
Definition: TrackTraversingAlgorithms.cpp:26
The ExpEvaluator class.
A class used to calculate the linear expansion coeffs of each FSR.
Definition: TrackTraversingAlgorithms.h:161
This is a class for evaluating exponentials.
Definition: ExpEvaluator.h:29
void execute()
Splits segments stored explicity along each Track.
Definition: TrackTraversingAlgorithms.cpp:161
void onTrack(Track *track, segment *segments)
Placeholder, an onTrack routine is not required when performing track generation and transport simult...
Definition: TrackTraversingAlgorithms.cpp:1251
virtual ~CentroidGenerator()
Destructor for the CentroidGenerator.
Definition: TrackTraversingAlgorithms.cpp:313
void execute()
Writes all tracking information to file.
Definition: TrackTraversingAlgorithms.cpp:1322
A class used to calculate the maximum optical path length across all segments in the Geometry...
Definition: TrackTraversingAlgorithms.h:45
void onTrack(Track *track, segment *segments)
Saves tracking information to the corresponding Track explicitly.
Definition: TrackTraversingAlgorithms.cpp:1152
void onTrack(Track *track, segment *segments)
Centroid contributions are calculated for every segment in the Track.
Definition: TrackTraversingAlgorithms.cpp:357
void setOutputFile(FILE *out)
Sets the file which to write tracking information.
Definition: TrackTraversingAlgorithms.cpp:1339
void setOutputFile(FILE *out)
Sets the file in which to write tracking information.
Definition: TrackTraversingAlgorithms.cpp:1058
void onTrack(Track *track, segment *segments)
Loops over all segments provided, obtain their region (FSR) centroid and re-center the segment...
Definition: TrackTraversingAlgorithms.cpp:1291
void onTrack(Track *track, segment *segments)
Calculates the optical path length for the provided segments and updates the maximum optical path len...
Definition: TrackTraversingAlgorithms.cpp:51
PrintSegments(TrackGenerator *track_generator)
Constructor for PrintSegments calls the TraverseSegments constructor and initializes the output FILE ...
Definition: TrackTraversingAlgorithms.cpp:1309
MaxOpticalLength(TrackGenerator *track_generator)
Constructor for MaxOpticalLength calls the TraverseSegments constructor and sets the max optical path...
Definition: TrackTraversingAlgorithms.cpp:11
void onTrack(Track *track, segment *segments)
Segments for the provided Track are split so that no segment has a larger optical path length than th...
Definition: TrackTraversingAlgorithms.cpp:175
virtual ~LinearExpansionGenerator()
Destructor for the LinearExpansionGenerator.
Definition: TrackTraversingAlgorithms.cpp:494
An TraverseSegments object defines how to loop over Tracks given various different segmentation schem...
Definition: TraverseSegments.h:35
void execute()
When executed, the LinearExpansionGenerator Kernel loops over all Tracks to compute constant terms us...
Definition: TrackTraversingAlgorithms.cpp:511
A class used to read tracking data from a file.
Definition: TrackTraversingAlgorithms.h:249
A TraverseSegments object.
void setCentroids(Point **centroids)
Specifies an array to save calculated FSR centroids.
Definition: TrackTraversingAlgorithms.cpp:347
void execute()
When executed, the Kernel loops over all Tracks to recenter their segments.
Definition: TrackTraversingAlgorithms.cpp:1270
TransportSweep(CPUSolver *cpu_solver)
Constructor for TransportSweep calls the TraverseSegments constructor and initializes the associated ...
Definition: TrackTraversingAlgorithms.cpp:809
void onTrack(Track *track, segment *segments)
No functionality is applied for each Track during the execution of the VolumeCalculator.
Definition: TrackTraversingAlgorithms.cpp:282
A class used to split explicit segments along Tracks.
Definition: TrackTraversingAlgorithms.h:93
void execute()
FSR volumes are calculated and saved in the TrackGenerator's FSR volumes buffer.
Definition: TrackTraversingAlgorithms.cpp:267
void countTotalNumSegments()
Turn on counting segments.
Definition: TrackTraversingAlgorithms.cpp:109
A Track represents a characteristic line across the geometry.
Definition: Track.h:67
LinearExpansionGenerator(CPULSSolver *solver)
Constructor for LinearExpansionGenerator calls the TraverseSegments constructor, allocates memory for...
Definition: TrackTraversingAlgorithms.cpp:447
VolumeCalculator(TrackGenerator *track_generator)
Constructor for SegmentSplitter calls the TraverseSegments constructor.
Definition: TrackTraversingAlgorithms.cpp:256
A class used to calculate FSR volumes.
Definition: TrackTraversingAlgorithms.h:112