LCOV - code coverage report
Current view: top level - include/dirackernels - DiracKernelInfo.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 2 2 100.0 %
Date: 2025-07-17 01:28:37 Functions: 2 2 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 "Moose.h"
      13             : #include "MooseTypes.h"
      14             : 
      15             : #include <set>
      16             : #include <map>
      17             : #include <memory>
      18             : 
      19             : // Forward declarations
      20             : class MooseMesh;
      21             : 
      22             : namespace libMesh
      23             : {
      24             : class Elem;
      25             : class PointLocatorBase;
      26             : class Point;
      27             : }
      28             : 
      29             : /**
      30             :  * The DiracKernelInfo object is a place where all the Dirac points
      31             :  * added by different DiracKernels are collected.  It is used, for
      32             :  * example, by the FEProblemBase class to determine if finite element data
      33             :  * needs to be recomputed on a given element.
      34             :  */
      35             : class DiracKernelInfo
      36             : {
      37             : public:
      38             :   DiracKernelInfo();
      39             :   virtual ~DiracKernelInfo();
      40             : 
      41             : public:
      42             :   /**
      43             :    * Adds a point source
      44             :    * @param elem Pointer to the geometric element in which the point is located
      45             :    * @param p The (x,y,z) location of the Dirac point
      46             :    */
      47             :   void addPoint(const Elem * elem, const Point & p);
      48             : 
      49             :   /**
      50             :    * Remove all of the current points and elements.
      51             :    */
      52             :   void clearPoints();
      53             : 
      54             :   /**
      55             :    * Return true if we have Point 'p' in Element 'elem'
      56             :    */
      57             :   bool hasPoint(const Elem * elem, const Point & p);
      58             : 
      59             :   /**
      60             :    * Returns a writeable reference to the _elements container.
      61             :    */
      62      360208 :   std::set<const Elem *> & getElements() { return _elements; }
      63             : 
      64             :   typedef std::map<const Elem *, std::pair<std::vector<Point>, std::vector<unsigned int>>>
      65             :       MultiPointMap;
      66             : 
      67             :   /**
      68             :    * Returns a writeable reference to the _points container.
      69             :    */
      70      308333 :   MultiPointMap & getPoints() { return _points; }
      71             : 
      72             :   /**
      73             :    * Called during FEProblemBase::meshChanged() to update the PointLocator
      74             :    * object used by the DiracKernels.
      75             :    */
      76             :   void updatePointLocator(const MooseMesh & mesh);
      77             : 
      78             :   /**
      79             :    * Used by client DiracKernel classes to determine the Elem in which
      80             :    * the Point p resides.  Uses the PointLocator owned by this object.
      81             :    */
      82             :   const Elem *
      83             :   findPoint(const Point & p, const MooseMesh & mesh, const std::set<SubdomainID> & blocks);
      84             : 
      85             : protected:
      86             :   /**
      87             :    * Check if two points are equal with respect to a tolerance
      88             :    */
      89             :   bool pointsFuzzyEqual(const Point &, const Point &);
      90             : 
      91             :   /// The list of elements that need distributions.
      92             :   std::set<const Elem *> _elements;
      93             : 
      94             :   /// The list of physical xyz Points that need to be evaluated in each element.
      95             :   MultiPointMap _points;
      96             : 
      97             :   /// The DiracKernelInfo object manages a PointLocator object which is used
      98             :   /// by all DiracKernels to find Points.  It needs to be centrally managed and it
      99             :   /// also needs to be rebuilt in FEProblemBase::meshChanged() to work with Mesh
     100             :   /// adaptivity.
     101             :   std::unique_ptr<libMesh::PointLocatorBase> _point_locator;
     102             : 
     103             :   /// threshold distance squared below which two points are considered identical
     104             :   const Real _point_equal_distance_sq;
     105             : };

Generated by: LCOV version 1.14