LCOV - code coverage report
Current view: top level - include/userobjects - SelfShadowSideUserObject.h (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #31405 (292dce) with base fef103 Lines: 1 1 100.0 %
Date: 2025-09-04 07:53:51 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             : #include "SideUserObject.h"
      13             : #include <vector>
      14             : #include "libmesh/data_type.h"
      15             : 
      16             : /**
      17             :  * Given a radiation direction vector this user object computes the illumination state of each side
      18             :  * QP on the sideset it is operating on. A value of 1 indicates that the QP is receiving radiation,
      19             :  * while a value of 0 indicates it is in the shadow of another element.
      20             :  */
      21             : class SelfShadowSideUserObject : public SideUserObject
      22             : {
      23             : public:
      24             :   using SideIDType = std::pair<dof_id_type, unsigned int>;
      25             : 
      26             :   static InputParameters validParams();
      27             : 
      28             :   SelfShadowSideUserObject(const InputParameters & parameters);
      29             : 
      30             :   virtual void initialize() override;
      31             :   virtual void execute() override;
      32             :   virtual void finalize() override;
      33             : 
      34             :   /// only needed for ElementUserObjects and NodalUseroObjects
      35             :   virtual void threadJoin(const UserObject & y) override;
      36             : 
      37             :   // API to check if a QP is illuminated
      38             :   unsigned int illumination(const SideIDType & id) const;
      39             : 
      40             :   /// API to chek if the UO runs on the displaced mesh
      41         840 :   bool useDisplacedMesh() const { return getParam<bool>("use_displaced_mesh"); }
      42             : 
      43             :   using Triangle = std::tuple<Point, Point, Point, SideIDType>;
      44             :   using LineSegment = std::tuple<Point, Point, SideIDType>;
      45             : 
      46             : protected:
      47             :   /// problem dimension
      48             :   const unsigned int _dim;
      49             : 
      50             :   /// raw illumination vector data (direction the radiation is propagating in)
      51             :   std::vector<const PostprocessorValue *> _raw_direction;
      52             : 
      53             :   /// matrix that rotates the direction onto the z-axis
      54             :   RealTensorValue _rotation;
      55             : 
      56             :   /// illumination status data (partition local), we use a bit for each QP
      57             :   std::map<SideIDType, unsigned int> & _illumination_status;
      58             : 
      59             :   /// global triange data (3D)
      60             :   std::vector<Triangle> _triangles;
      61             : 
      62             :   /// global line segment data (2D)
      63             :   std::vector<LineSegment> _lines;
      64             : 
      65             :   /// local QP data
      66             :   std::vector<std::pair<SideIDType, MooseArray<Point>>> _local_qps;
      67             : 
      68             : private:
      69             :   void addLines(const SideIDType & id);
      70             :   void addTriangles(const SideIDType & id);
      71             :   bool check2DIllumination(const Point & qp, const SideIDType & id);
      72             :   bool check3DIllumination(const Point & qp, const SideIDType & id);
      73             : 
      74             :   /// rotate all points in the given container
      75             :   void rotate(MooseArray<Point> & points);
      76             :   void rotate(Triangle & triangle);
      77             :   void rotate(LineSegment & line);
      78             : };

Generated by: LCOV version 1.14