LCOV - code coverage report
Current view: top level - include/raytracing - TraceData.h (source / functions) Hit Total Coverage
Test: idaholab/moose ray_tracing: #31405 (292dce) with base fef103 Lines: 13 13 100.0 %
Date: 2025-09-04 07:56:07 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "Ray.h"
      14             : 
      15             : // MOOSE includes
      16             : #include "MooseError.h"
      17             : 
      18             : // libMesh includes
      19             : #include "libmesh/point.h"
      20             : 
      21             : /**
      22             :  * Data structure that stores the necessary information for outputting a Ray at a point
      23             :  */
      24      229489 : struct TracePointData
      25             : {
      26       72174 :   TracePointData(const libMesh::Point & point) : _point(point)
      27             :   {
      28             :     mooseAssert(_point != RayTracingCommon::invalid_point, "Invalid point");
      29             :   }
      30             : 
      31             :   /// The point on _elem this segment leaves from
      32             :   libMesh::Point _point;
      33             :   /// The data on the Ray after this segment is traced (optional)
      34             :   std::vector<RayData> _data;
      35             :   /// The aux data on the Ray after this segment is traced (optional)
      36             :   std::vector<RayData> _aux_data;
      37             : };
      38             : 
      39             : /**
      40             :  * Data structure that stores information for output of a partial trace of a Ray on a processor
      41             :  */
      42       30691 : struct TraceData
      43             : {
      44       13787 :   TraceData(const std::shared_ptr<Ray> & ray)
      45       13787 :     : _ray_id(ray->id()),
      46       13787 :       _intersections(ray->intersections()),
      47       13787 :       _processor_crossings(ray->processorCrossings()),
      48       13787 :       _trajectory_changes(ray->trajectoryChanges()),
      49       13787 :       _last(false)
      50             :   {
      51             :     mooseAssert(_ray_id != Ray::INVALID_RAY_ID, "Invalid Ray ID");
      52             :     addPoint(ray->currentPoint());
      53       13787 :   }
      54             : 
      55       72174 :   void addPoint(const libMesh::Point & point) { _point_data.emplace_back(point); }
      56             : 
      57             :   TracePointData & lastPoint() { return _point_data.back(); }
      58             : 
      59       44412 :   bool stationary() const { return _last && _intersections == 0 && _point_data.size() == 1; }
      60             : 
      61             :   unsigned int numSegments() const
      62             :   {
      63             :     mooseAssert(!_point_data.empty(), "Should not be empty");
      64       14556 :     return _point_data.size() - 1;
      65             :   }
      66             : 
      67             :   /// The Ray ID
      68             :   const RayID _ray_id;
      69             :   /// The number of intersections thus far
      70             :   const unsigned long int _intersections;
      71             :   /// Number of processor crossings thus far
      72             :   const unsigned int _processor_crossings;
      73             :   /// Number of trajectory changes thus far
      74             :   const unsigned int _trajectory_changes;
      75             :   /// Whether or not this was the last set of segments for this Ray
      76             :   bool _last;
      77             :   /// The data for each point along the track
      78             :   std::vector<TracePointData> _point_data;
      79             : };

Generated by: LCOV version 1.14