https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
26class RayTracingStudy;
27struct TraceData;
28
34{
35public:
37
39
40 virtual std::string filename() override;
41
42 void output() override;
43
44protected:
48 virtual void outputMesh() = 0;
49
51 virtual std::string fileExtension() const = 0;
52
55
57 const bool _output_data;
59 const std::vector<std::string> * const _output_data_names;
63 const bool _output_aux_data;
65 const std::vector<std::string> * const _output_aux_data_names;
66
68 std::unique_ptr<MeshBase> _segment_mesh;
70 std::unique_ptr<libMesh::EquationSystems> _es;
73
74private:
79 void buildBoundingBoxes();
84 void buildIDMap();
88 void buildSegmentMesh();
96 void fillFields();
97
101 dof_id_type neededNodes(const TraceData & trace_data) const;
105 void startingIDs(const TraceData & trace_data,
106 dof_id_type & start_node_id,
107 dof_id_type & start_elem_id) const;
108
110 unsigned int _ray_id_var;
112 unsigned int _intersections_var;
114 unsigned int _pid_var;
120 std::vector<std::pair<RayDataIndex, unsigned int>> _data_vars;
122 std::vector<std::pair<RayDataIndex, unsigned int>> _aux_data_vars;
123
125 BoundingBox _bbox;
127 std::vector<BoundingBox> _inflated_bboxes;
129 std::vector<std::pair<processor_id_type, BoundingBox>> _inflated_neighbor_bboxes;
130
132 std::unordered_map<RayID, std::pair<dof_id_type, dof_id_type>> _ray_starting_id_map;
134 dof_id_type _max_node_id;
137};
const InputParameters & parameters() const
Base class for outputting Ray data in a mesh format, where EDGE2 elems represent the individual Ray s...
unsigned int _intersections_var
The variable index in _sys for the intersection ID (if any)
static InputParameters validParams()
void buildBoundingBoxes()
Build the inflated neighbor bounding boxes stored in _inflated_neighbor_bboxes for the purposes of id...
std::unique_ptr< libMesh::EquationSystems > _es
The EquationSystems.
void fillFields()
Fill the Ray field data.
unsigned int _ray_id_var
The variable index in _sys for the Ray's ID (if any)
const std::vector< std::string > *const _output_aux_data_names
Specific Ray Aux data to output.
std::vector< BoundingBox > _inflated_bboxes
The inflated bounding boxes for all processors.
const bool _output_aux_data
Whether or not to output the Ray's aux data.
bool _segmented_rays
Whether or not we have segmented rays.
unsigned int _pid_var
The variable index in _sys for the Ray's processor id (if any)
const bool _output_data
Whether or not to output all of the Ray's data.
const bool _output_data_nodal
Whether or not to output the Ray's data in a nodal, linear sense.
void setupEquationSystem()
Setup the equation system that stores the segment-wise field data.
unsigned int _processor_crossings_var
The variable index in _sys for the Ray's processor crossings (if any)
dof_id_type neededNodes(const TraceData &trace_data) const
Gets the number of nodes needed to represent a given trace.
std::unique_ptr< MeshBase > _segment_mesh
The mesh that contains the segments.
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.
libMesh::ExplicitSystem * _sys
The system that stores the field data.
virtual std::string fileExtension() const =0
Return the file extension.
virtual std::string filename() override
const RayTracingStudy & _study
The RayTracingStudy.
const std::vector< std::string > *const _output_data_names
Specific Ray data to output.
void buildIDMap()
Builds a map for each Ray to starting element and node ID for the EDGE2 mesh that will represent said...
void buildSegmentMesh()
Build the mesh that contains the ray tracing segments.
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.
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)
BoundingBox _bbox
The bounding box for this processor.
std::vector< std::pair< RayDataIndex, unsigned int > > _data_vars
The ray data index -> variable index map.
virtual void outputMesh()=0
Output the mesh - to be overridden.
dof_id_type _max_node_id
The max node ID for the ray tracing mesh for creating unique elem IDs.
unsigned int _trajectory_changes_var
The variable index in _sys for the Ray's trajectory changes (if any)
std::vector< std::pair< RayDataIndex, unsigned int > > _aux_data_vars
The ray aux data index -> variable index map.
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...
Data structure that stores information for output of a partial trace of a Ray on a processor.
Definition TraceData.h:43