https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PerProcessorRayTracingResultsVectorPostprocessor.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
12// Local includes
13#include "RayTracingStudy.h"
14
15#include "TraceRay.h"
16#include "ParallelRayStudy.h"
17
19
22{
24
26 "Accumulates ray tracing results (information about the trace) on a per-processor basis.");
27
28 params.addRequiredParam<UserObjectName>("study", "The RayTracingStudy to get results from");
29
30 const std::string result_names =
31 "rays_started rays_traced chunks_traced rays_received buffers_received rays_sent "
32 "buffers_sent intersections generation_time propagation_time num_probes ray_pool_created "
33 "receive_ray_pool_created receive_buffer_pool_created send_buffer_pool_created face_hit "
34 "vertex_hit edge_hit moved_through_neighbors backface_culling_successes "
35 "backface_culling_failures intersection_calls vertex_neighbor_builds vertex_neighbor_lookups "
36 "edge_neighbor_builds edge_neighbor_lookups point_neighbor_builds failed_traces";
37 MultiMooseEnum results(result_names, result_names);
38
39 params.addParam<MultiMooseEnum>("results", results, "The selection of results you want reported");
40
41 return params;
42}
43
45 const InputParameters & parameters)
46 : GeneralVectorPostprocessor(parameters),
47 _study(getUserObject<RayTracingStudy>("study")),
48 _results(getParam<MultiMooseEnum>("results")),
49 _pid(processor_id()),
50 _pid_values(declareVector("pid"))
51{
52 auto num_procs = n_processors();
53
54 _pid_values.resize(num_procs, 0);
55
56 for (auto & result : _results)
57 {
58 std::string lower_result_name;
59
60 std::transform(result.name().begin(),
61 result.name().end(),
62 std::back_inserter(lower_result_name),
63 ::tolower);
64
65 auto id = result.id();
66
67 _result_values[id] = &declareVector(lower_result_name);
68
69 _result_values[id]->resize(num_procs, 0);
70 }
71}
72
73void
77
78void
80{
82
83 for (auto & result : _results)
84 {
85 switch (result)
86 {
87 case 0: // rays_started
89 break;
90 case 1: // rays_traced
92 break;
93 case 2: // chunks_traced
95 break;
96 case 3: // rays_received
97 (*_result_values[3])[_pid] = _study.parallelRayStudy().receiveBuffer().objectsReceived();
98 break;
99 case 4: // buffers_received
100 (*_result_values[4])[_pid] = _study.parallelRayStudy().receiveBuffer().buffersReceived();
101 break;
102 case 5: // rays_sent
104 break;
105 case 6: // buffers_sent
107 break;
108 case 7: // intersections
110 break;
111 case 8: // generation_time
113 break;
114 case 9: // propagation_time
116 break;
117 case 10: // num_probes
118 (*_result_values[10])[_pid] = _study.parallelRayStudy().receiveBuffer().numProbes();
119 break;
120 case 11: // ray_pool_created
122 break;
123 case 12: // receive_ray_pool_created
124 (*_result_values[12])[_pid] = _study.parallelRayStudy().receiveBuffer().objectPoolCreated();
125 break;
126 case 13: // receive_buffer_pool_created
127 (*_result_values[13])[_pid] = _study.parallelRayStudy().receiveBuffer().bufferPoolCreated();
128 break;
129 case 14: // send_buffer_pool_created
131 break;
132 case 15: // face_hit
134 break;
135 case 16: // vertex_hit
137 break;
138 case 17: // edge_hit
140 break;
141 case 18: // moved_through_neighbors
143 break;
144 case 19: // backface_culling_successes
145 (*_result_values[19])[_pid] =
147 break;
148 case 20: // backface_culling_failures
149 (*_result_values[20])[_pid] =
151 break;
152 case 21: // intersection_calls
154 break;
155 case 22: // vertex_neighbor_builds
157 break;
158 case 23: // vertex_neighbor_lookups
160 break;
161 case 24: // edge_neighbor_builds
163 break;
164 case 25: // edge_neighbor_lookups
166 break;
167 case 26: // point_neighbor_builds
169 break;
170 case 27: // failed_traces
172 break;
173 default:
174 mooseError("Unknown result type '",
175 result.name(),
176 "/",
177 result.id(),
178 "' in PerProcessorRayTracingResultsVectorPostprocessor ",
179 name());
180 }
181 }
182}
183
184void
186{
187 // TODO: Should be able to just "gather" to proc zero - but that's not working....
189
190 for (auto & result : _results)
191 gatherMax(*_result_values[result.id()]);
192}
registerMooseObject("RayTracingApp", PerProcessorRayTracingResultsVectorPostprocessor)
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
const std::string & name() const
void mooseError(Args &&... args) const
unsigned long long int localWorkExecuted() const
Gets the total amount of work executed on this processor.
unsigned long long int localChunksExecuted() const
Gets the total number of chunks of work executed on this processor.
unsigned long long int buffersSent() const
Gets the total number of buffers sent from this processor.
unsigned long long int poolParallelDataCreated() const
Gets the total number of parallel data created in all of the threaded pools.
unsigned long long int parallelDataSent() const
Gets the total number of parallel data objects sent from this processor.
const ReceiveBuffer< ParallelDataType, ParallelStudy< WorkType, ParallelDataType > > & receiveBuffer() const
Gets the receive buffer.
unsigned long long int localWorkStarted() const
Gets the total amount of work started from this processor.
unsigned long long int sendBufferPoolCreated() const
Gets the total number of send buffer pools created.
std::map< processor_id_type, VectorPostprocessorValue * > _result_values
The VPP values.
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...
Real generationTime() const
Duration for creation of all Rays in seconds.
const ParallelRayStudy & parallelRayStudy() const
Real propagationTime() const
Duration for creation of all Rays in seconds.
unsigned long long int localTraceRayResult(const int result) const
@ FAILED_TRACES
Definition TraceRay.h:71
@ FACE_HITS
Definition TraceRay.h:59
@ VERTEX_HITS
Definition TraceRay.h:60
@ INTERSECTION_CALLS
Definition TraceRay.h:65
@ EDGE_HITS
Definition TraceRay.h:61
@ EDGE_NEIGHBOR_BUILDS
Definition TraceRay.h:68
@ POINT_NEIGHBOR_BUILDS
Definition TraceRay.h:70
@ EDGE_NEIGHBOR_LOOKUPS
Definition TraceRay.h:69
@ INTERSECTIONS
Definition TraceRay.h:58
@ BACKFACE_CULLING_FAILURES
Definition TraceRay.h:64
@ VERTEX_NEIGHBOR_LOOKUPS
Definition TraceRay.h:67
@ BACKFACE_CULLING_SUCCESSES
Definition TraceRay.h:63
@ MOVED_THROUGH_NEIGHBORS
Definition TraceRay.h:62
@ VERTEX_NEIGHBOR_BUILDS
Definition TraceRay.h:66
VectorPostprocessorValue & declareVector(const std::string &vector_name)
processor_id_type n_processors() const