LCOV - code coverage report
Current view: top level - include/mesh - ElemInfo.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 8 9 88.9 %
Date: 2025-07-17 01:28:37 Functions: 8 9 88.9 %
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 "MooseTypes.h"
      13             : #include "libmesh/point.h"
      14             : #include "libmesh/elem.h"
      15             : 
      16             : #include <map>
      17             : #include <set>
      18             : #include <memory>
      19             : 
      20             : class FaceInfo;
      21             : 
      22             : /// Class used for caching additional information for elements
      23             : /// such as the volume and centroid. This also supports the
      24             : /// ghost elements used in the finite volume setting (for the time being).
      25             : class ElemInfo
      26             : {
      27             : public:
      28             :   /// Constructor using a real element from libmesh
      29             :   ElemInfo(const Elem * const elem);
      30             : 
      31             :   /// Default constructor
      32           0 :   ElemInfo() : _elem(nullptr) {}
      33             : 
      34  1098993489 :   const Elem * elem() const { return _elem; }
      35    23543325 :   Real volume() const { return _volume; }
      36    39445524 :   const Point & centroid() const { return _centroid; }
      37     4062912 :   Real coordFactor() const { return _coord_transform_factor; }
      38     1225459 :   Real & coordFactor() { return _coord_transform_factor; }
      39    27378378 :   const std::vector<std::vector<dof_id_type>> & dofIndices() const { return _dof_indices; }
      40     1225451 :   std::vector<std::vector<dof_id_type>> & dofIndices() { return _dof_indices; }
      41             : 
      42             :   /// We return the subdomain ID of the corresponding libmesh element.
      43    85411978 :   SubdomainID subdomain_id() const { return _elem->subdomain_id(); }
      44             : 
      45             : protected:
      46             :   /// Reference to the element in libmesh
      47             :   const Elem * const _elem;
      48             :   /// Volume of the element
      49             :   Real _volume;
      50             :   /// Centroid of the element
      51             :   Point _centroid;
      52             :   /// Cached coordinate transformation factor
      53             :   Real _coord_transform_factor;
      54             :   /// Cached dof indices mainly for segregated linear FV evaluations
      55             :   /// with the following structure: _dof_indices[system_number][variable_number] = dof_index
      56             :   /// Systems with no FV variables will store an empty vector and should not be accessed.
      57             :   /// This will be checked through multiple asserts in the assembly routines.
      58             :   /// Furthermore, if the current variable is not active on the subdomain or if it
      59             :   /// is an FE variable of this element, we return an invalid_dof_index.
      60             :   std::vector<std::vector<dof_id_type>> _dof_indices;
      61             : };

Generated by: LCOV version 1.14