LCOV - code coverage report
Current view: top level - include/variables - MooseVariableFieldBase.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 2 3 66.7 %
Date: 2025-07-17 01:28:37 Functions: 2 3 66.7 %
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 "MooseVariableBase.h"
      13             : 
      14             : namespace libMesh
      15             : {
      16             : template <typename>
      17             : class DenseVector;
      18             : template <typename>
      19             : class NumericVector;
      20             : class Point;
      21             : }
      22             : 
      23             : class FaceInfo;
      24             : 
      25             : /**
      26             :  * This class provides an interface for common operations on field variables of
      27             :  * both FE and FV types with all their scalar, vector, eigenvector permutations.
      28             :  */
      29             : class MooseVariableFieldBase : public MooseVariableBase
      30             : {
      31             : public:
      32             :   static InputParameters validParams();
      33             : 
      34             :   MooseVariableFieldBase(const InputParameters & parameters);
      35             : 
      36             :   /**
      37             :    * Clear out the dof indices.  We do this in case this variable is not going to be prepared at
      38             :    * all...
      39             :    */
      40             :   virtual void clearDofIndices() = 0;
      41             : 
      42             :   /**
      43             :    * Prepare the elemental degrees of freedom
      44             :    */
      45             :   virtual void prepare() = 0;
      46             : 
      47             :   /**
      48             :    * Prepare the neighbor element degrees of freedom
      49             :    */
      50             :   virtual void prepareNeighbor() = 0;
      51             : 
      52             :   /**
      53             :    * Prepare a lower dimensional element's degrees of freedom
      54             :    */
      55             :   virtual void prepareLowerD() = 0;
      56             : 
      57             :   virtual void prepareAux() = 0;
      58             : 
      59             :   virtual void reinitNode() = 0;
      60             :   virtual void reinitAux() = 0;
      61             :   virtual void reinitAuxNeighbor() = 0;
      62             : 
      63             :   virtual void reinitNodes(const std::vector<dof_id_type> & nodes) = 0;
      64             :   virtual void reinitNodesNeighbor(const std::vector<dof_id_type> & nodes) = 0;
      65             : 
      66             :   /**
      67             :    * Field type of this variable
      68             :    */
      69             :   virtual Moose::VarFieldType fieldType() const = 0;
      70             : 
      71             :   /**
      72             :    * Get the variable name of a component in libMesh
      73             :    */
      74             :   const std::string & componentName(const unsigned int comp) const;
      75             : 
      76             :   /**
      77             :    * @returns true if this is a vector-valued element, false otherwise.
      78             :    */
      79             :   virtual bool isVector() const = 0;
      80             : 
      81    51076382 :   virtual bool isFV() const { return false; }
      82             : 
      83             :   /**
      84             :    * Is this variable defined at nodes
      85             :    * @return true if it the variable is defined at nodes, otherwise false
      86             :    */
      87             :   virtual bool isNodalDefined() const = 0;
      88             : 
      89             :   virtual const dof_id_type & nodalDofIndex() const = 0;
      90             :   virtual const dof_id_type & nodalDofIndexNeighbor() const = 0;
      91             : 
      92             :   /**
      93             :    * Current element this variable is evaluated at
      94             :    */
      95             :   virtual const Elem * const & currentElem() const = 0;
      96             : 
      97             :   /**
      98             :    * The subdomains the variable is active on
      99             :    */
     100             :   const std::set<SubdomainID> & activeSubdomains() const;
     101             : 
     102             :   /**
     103             :    * Is the variable active on the subdomain?
     104             :    * @param subdomain The subdomain id in question
     105             :    * @return true if active on subdomain, false otherwise
     106             :    */
     107             :   bool activeOnSubdomain(SubdomainID subdomain) const;
     108             : 
     109             :   /**
     110             :    * Is the variable active on the subdomains?
     111             :    * @param subdomains The subdomain ids in question
     112             :    * @return true if active on all provided subdomains, false otherwise
     113             :    */
     114             :   bool activeOnSubdomains(const std::set<SubdomainID> & subdomains) const;
     115             : 
     116             :   /**
     117             :    * Check if this variable needs a raw vector of gradients at dof-values.
     118             :    * This is mainly used for finite volume variables.
     119             :    */
     120      150768 :   virtual bool needsGradientVectorStorage() const { return false; }
     121             : 
     122             :   /**
     123             :    * Prepare the initial condition
     124             :    */
     125             :   virtual void prepareIC() = 0;
     126             : 
     127             :   /**
     128             :    * Compute values at face quadrature points for the element+neighbor (both
     129             :    * sides of the face).
     130             :    */
     131           0 :   virtual void computeFaceValues(const FaceInfo & /*fi*/) { mooseError("not implemented"); }
     132             : 
     133             :   /**
     134             :    * Compute values at interior quadrature points
     135             :    */
     136             :   virtual void computeElemValues() = 0;
     137             :   /**
     138             :    * Compute values at facial quadrature points
     139             :    */
     140             :   virtual void computeElemValuesFace() = 0;
     141             :   /**
     142             :    * Compute values at facial quadrature points for the neighbor
     143             :    */
     144             :   virtual void computeNeighborValuesFace() = 0;
     145             :   /**
     146             :    * Compute values at quadrature points for the neighbor
     147             :    */
     148             :   virtual void computeNeighborValues() = 0;
     149             :   /**
     150             :    * compute values at quadrature points on the lower dimensional element
     151             :    */
     152             :   virtual void computeLowerDValues() = 0;
     153             :   /**
     154             :    * Compute nodal values of this variable in the neighbor
     155             :    */
     156             :   virtual void computeNodalNeighborValues() = 0;
     157             :   /**
     158             :    * Compute nodal values of this variable
     159             :    */
     160             :   virtual void computeNodalValues() = 0;
     161             : 
     162             :   /**
     163             :    * Get neighbor DOF indices for currently selected element
     164             :    * @return the neighbor degree of freedom indices
     165             :    */
     166             :   virtual const std::vector<dof_id_type> & dofIndicesNeighbor() const = 0;
     167             : 
     168             :   /**
     169             :    * Get dof indices for the current lower dimensional element (this is meaningful when performing
     170             :    * mortar FEM)
     171             :    * @return the lower dimensional element's dofs
     172             :    */
     173             :   virtual const std::vector<dof_id_type> & dofIndicesLower() const = 0;
     174             : 
     175             :   virtual unsigned int numberOfDofsNeighbor() = 0;
     176             : 
     177             :   /**
     178             :    * Insert the currently cached degree of freedom values into the provided \p vector
     179             :    */
     180             :   virtual void insert(libMesh::NumericVector<libMesh::Number> & vector) = 0;
     181             : 
     182             :   /**
     183             :    * Insert the currently cached degree of freedom values for a lower-dimensional element into the
     184             :    * provided \p vector
     185             :    */
     186             :   virtual void insertLower(libMesh::NumericVector<libMesh::Number> & vector) = 0;
     187             : 
     188             :   /**
     189             :    * Add the currently cached degree of freedom values into the provided \p vector
     190             :    */
     191             :   virtual void add(libMesh::NumericVector<libMesh::Number> & vector) = 0;
     192             : 
     193             :   /**
     194             :    * Return phi size
     195             :    */
     196             :   virtual std::size_t phiSize() const = 0;
     197             :   /**
     198             :    * Return phiFace size
     199             :    */
     200             :   virtual std::size_t phiFaceSize() const = 0;
     201             :   /**
     202             :    * Return phiNeighbor size
     203             :    */
     204             :   virtual std::size_t phiNeighborSize() const = 0;
     205             :   /**
     206             :    * Return phiFaceNeighbor size
     207             :    */
     208             :   virtual std::size_t phiFaceNeighborSize() const = 0;
     209             :   /**
     210             :    * Return the number of shape functions on the lower dimensional element for this variable
     211             :    */
     212             :   virtual std::size_t phiLowerSize() const = 0;
     213             : 
     214             :   /**
     215             :    * The oldest solution state that is requested for this variable
     216             :    * (0 = current, 1 = old, 2 = older, etc).
     217             :    */
     218             :   virtual unsigned int oldestSolutionStateRequested() const = 0;
     219             : };
     220             : 
     221             : #define usingMooseVariableFieldBaseMembers usingMooseVariableBaseMembers

Generated by: LCOV version 1.14