https://mooseframework.inl.gov
RayTracingMeshOutput.h
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 
10 #pragma once
11 
12 // Local includes
13 #include "RayTracingCommon.h"
14 #include "Ray.h"
15 
16 // MOOSE includes
17 #include "FileOutput.h"
18 #include "UserObjectInterface.h"
19 
20 // libMesh includes
21 #include "libmesh/distributed_mesh.h"
22 #include "libmesh/equation_systems.h"
23 #include "libmesh/explicit_system.h"
24 
25 // Forward declarations
26 class RayTracingStudy;
27 struct TraceData;
28 
34 {
35 public:
37 
39 
40  virtual std::string filename() override;
41 
42  void output() override;
43 
44 protected:
48  virtual void outputMesh() = 0;
49 
52 
54  const bool _output_data;
56  const std::vector<std::string> * const _output_data_names;
58  const bool _output_data_nodal;
60  const bool _output_aux_data;
62  const std::vector<std::string> * const _output_aux_data_names;
63 
65  std::unique_ptr<MeshBase> _segment_mesh;
67  std::unique_ptr<libMesh::EquationSystems> _es;
70 
71 private:
76  void buildBoundingBoxes();
81  void buildIDMap();
85  void buildSegmentMesh();
89  void setupEquationSystem();
93  void fillFields();
94 
98  dof_id_type neededNodes(const TraceData & trace_data) const;
102  void startingIDs(const TraceData & trace_data,
103  dof_id_type & start_node_id,
104  dof_id_type & start_elem_id) const;
105 
107  unsigned int _ray_id_var;
109  unsigned int _intersections_var;
111  unsigned int _pid_var;
117  std::vector<std::pair<RayDataIndex, unsigned int>> _data_vars;
119  std::vector<std::pair<RayDataIndex, unsigned int>> _aux_data_vars;
120 
122  BoundingBox _bbox;
124  std::vector<BoundingBox> _inflated_bboxes;
126  std::vector<std::pair<processor_id_type, BoundingBox>> _inflated_neighbor_bboxes;
127 
129  std::unordered_map<RayID, std::pair<dof_id_type, dof_id_type>> _ray_starting_id_map;
134 };
void buildSegmentMesh()
Build the mesh that contains the ray tracing segments.
void fillFields()
Fill the Ray field data.
const bool _output_data
Whether or not to output all of the Ray&#39;s data.
const bool _output_data_nodal
Whether or not to output the Ray&#39;s data in a nodal, linear sense.
Data structure that stores information for output of a partial trace of a Ray on a processor...
Definition: TraceData.h:42
void startingIDs(const TraceData &trace_data, dof_id_type &start_node_id, dof_id_type &start_elem_id) const
Gets the starting node and element IDs in the EDGE2 mesh for a given trace.
std::vector< std::pair< RayDataIndex, unsigned int > > _data_vars
The ray data index -> variable index map.
std::unordered_map< RayID, std::pair< dof_id_type, dof_id_type > > _ray_starting_id_map
The map from RayID to the starting element and node ID of the mesh element for said Ray...
dof_id_type _max_node_id
The max node ID for the ray tracing mesh for creating unique elem IDs.
const RayTracingStudy & _study
The RayTracingStudy.
bool _segmented_rays
Whether or not we have segmented rays.
void buildIDMap()
Builds a map for each Ray to starting element and node ID for the EDGE2 mesh that will represent said...
const bool _output_aux_data
Whether or not to output the Ray&#39;s aux data.
std::vector< std::pair< RayDataIndex, unsigned int > > _aux_data_vars
The ray aux data index -> variable index map.
const std::vector< std::string > *const _output_data_names
Specific Ray data to output.
static InputParameters validParams()
void setupEquationSystem()
Setup the equation system that stores the segment-wise field data.
const std::vector< std::string > *const _output_aux_data_names
Specific Ray Aux data to output.
std::unique_ptr< libMesh::EquationSystems > _es
The EquationSystems.
dof_id_type neededNodes(const TraceData &trace_data) const
Gets the number of nodes needed to represent a given trace.
unsigned int _intersections_var
The variable index in _sys for the intersection ID (if any)
RayTracingMeshOutput(const InputParameters &parameters)
virtual void outputMesh()=0
Output the mesh - to be overridden.
unsigned int _ray_id_var
The variable index in _sys for the Ray&#39;s ID (if any)
libMesh::ExplicitSystem * _sys
The system that stores the field data.
std::vector< std::pair< processor_id_type, BoundingBox > > _inflated_neighbor_bboxes
Inflated bounding boxes that are neighboring to this processor (pid : bbox for each entry) ...
std::unique_ptr< MeshBase > _segment_mesh
The mesh that contains the segments.
const InputParameters & parameters() const
std::vector< BoundingBox > _inflated_bboxes
The inflated bounding boxes for all processors.
BoundingBox _bbox
The bounding box for this processor.
Base class for outputting Ray data in a mesh format, where EDGE2 elems represent the individual Ray s...
unsigned int _processor_crossings_var
The variable index in _sys for the Ray&#39;s processor crossings (if any)
unsigned int _pid_var
The variable index in _sys for the Ray&#39;s processor id (if any)
void buildBoundingBoxes()
Build the inflated neighbor bounding boxes stored in _inflated_neighbor_bboxes for the purposes of id...
virtual std::string filename() override
unsigned int _trajectory_changes_var
The variable index in _sys for the Ray&#39;s trajectory changes (if any)
uint8_t dof_id_type
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...