LCOV - code coverage report
Current view: top level - include/fe - hdiv_fe_transformation.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4529 (d6a6ff) with base 9779e6 Lines: 5 7 71.4 %
Date: 2026-09-01 14:14:34 Functions: 4 10 40.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // The libMesh Finite Element Library.
       2             : // Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
       3             : 
       4             : // This library is free software; you can redistribute it and/or
       5             : // modify it under the terms of the GNU Lesser General Public
       6             : // License as published by the Free Software Foundation; either
       7             : // version 2.1 of the License, or (at your option) any later version.
       8             : 
       9             : // This library is distributed in the hope that it will be useful,
      10             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12             : // Lesser General Public License for more details.
      13             : 
      14             : // You should have received a copy of the GNU Lesser General Public
      15             : // License along with this library; if not, write to the Free Software
      16             : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      17             : 
      18             : #ifndef LIBMESH_HDIV_FE_TRANSFORMATION_H
      19             : #define LIBMESH_HDIV_FE_TRANSFORMATION_H
      20             : 
      21             : #include "libmesh/fe_transformation_base.h"
      22             : 
      23             : namespace libMesh
      24             : {
      25             : 
      26             : /**
      27             :  * This class handles the computation of the shape functions in the
      28             :  * physical domain for HDiv conforming elements. This class assumes
      29             :  * the \p FEGenericBase object has been initialized in the reference
      30             :  * domain (i.e. \p init_shape_functions has been called).
      31             :  *
      32             :  * \author Nuno Nobre
      33             :  * \date 2023
      34             :  */
      35             : template<typename OutputShape>
      36             : class HDivFETransformation : public FETransformationBase<OutputShape>
      37             : {
      38             : public:
      39             : 
      40      120521 :   HDivFETransformation()
      41      120521 :     : FETransformationBase<OutputShape>() {}
      42             : 
      43      148271 :   virtual ~HDivFETransformation() = default;
      44             : 
      45             :   /**
      46             :    * Pre-requests any necessary data from FEMap
      47             :    */
      48             :   virtual void init_map_phi(const FEGenericBase<OutputShape> & fe) const override;
      49             : 
      50             :   /**
      51             :    * Pre-requests any necessary data from FEMap
      52             :    */
      53             :   virtual void init_map_dphi(const FEGenericBase<OutputShape> & fe) const override;
      54             : 
      55             :   /**
      56             :    * Pre-requests any necessary data from FEMap
      57             :    */
      58             :   virtual void init_map_d2phi(const FEGenericBase<OutputShape> & fe) const override;
      59             : 
      60             :   /**
      61             :    * Evaluates shape functions in physical coordinates for \f$ H(div)
      62             :    * \f$ conforming elements.  In this case \f$ \phi = J^{-1} (dx/d\xi)
      63             :    * \hat{\phi} \f$, where \f$ (dx/d\xi) \f$ is the Jacobian matrix of the
      64             :    * element map and J = \det( dx/d\xi ).
      65             :    *
      66             :    * \note Here \f$ x, \xi \f$ are vectors.
      67             :    */
      68             :   virtual void map_phi(const unsigned int dim,
      69             :                        const Elem * const elem,
      70             :                        const std::vector<Point> & qp,
      71             :                        const FEGenericBase<OutputShape> & fe,
      72             :                        std::vector<std::vector<OutputShape>> & phi,
      73             :                        bool add_p_level = true) const override;
      74             : 
      75             :   /**
      76             :    * Evaluates shape function gradients in physical coordinates for
      77             :    * \f$ H(div) \f$ conforming elements, via the contravariant Piola
      78             :    * map's derivative (the gradient of \f$ \phi = J^{-1} (dx/d\xi)
      79             :    * \hat{\phi} \f$ with respect to physical coordinates). Requires
      80             :    * \p LIBMESH_ENABLE_SECOND_DERIVATIVES, since the map's own second
      81             :    * derivatives are needed to differentiate \f$ J^{-1} \f$ and
      82             :    * \f$ (dx/d\xi) \f$.
      83             :    */
      84             :   virtual void map_dphi(const unsigned int dim,
      85             :                         const Elem * const elem,
      86             :                         const std::vector<Point> & qp,
      87             :                         const FEGenericBase<OutputShape> & fe,
      88             :                         std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi,
      89             :                         std::vector<std::vector<OutputShape>> & dphidx,
      90             :                         std::vector<std::vector<OutputShape>> & dphidy,
      91             :                         std::vector<std::vector<OutputShape>> & dphidz) const override;
      92             : 
      93             : #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
      94             :   /**
      95             :    * Evaluates shape function Hessians in physical coordinates based
      96             :    * on \f$ H(div) \f$ conforming finite element transformation.
      97             :    */
      98           0 :   virtual void map_d2phi(const unsigned int /*dim*/,
      99             :                          const std::vector<Point> & /*qp*/,
     100             :                          const FEGenericBase<OutputShape> & /*fe*/,
     101             :                          std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & /*d2phi*/,
     102             :                          std::vector<std::vector<OutputShape>> & /*d2phidx2*/,
     103             :                          std::vector<std::vector<OutputShape>> & /*d2phidxdy*/,
     104             :                          std::vector<std::vector<OutputShape>> & /*d2phidxdz*/,
     105             :                          std::vector<std::vector<OutputShape>> & /*d2phidy2*/,
     106             :                          std::vector<std::vector<OutputShape>> & /*d2phidydz*/,
     107             :                          std::vector<std::vector<OutputShape>> & /*d2phidz2*/) const override
     108             :   {
     109             :     libmesh_warning("WARNING: Shape function Hessians for HDiv elements are not currently being computed!");
     110           0 :   }
     111             : #endif //LIBMESH_ENABLE_SECOND_DERIVATIVES
     112             : 
     113             :   /**
     114             :    * Evaluates the shape function curl in physical coordinates
     115             :    * based on \f$ H(div) \f$ conforming finite element transformation.
     116             :    */
     117      112619 :   virtual void map_curl(const unsigned int /*dim*/,
     118             :                         const Elem * const /*elem*/,
     119             :                         const std::vector<Point> & /*qp*/,
     120             :                         const FEGenericBase<OutputShape> & /*fe*/,
     121             :                         std::vector<std::vector<OutputShape>> & /*curl_phi*/) const override
     122             :   {
     123             :     libmesh_warning("WARNING: Shape function curls for HDiv elements are not currently being computed!");
     124      112619 :   }
     125             : 
     126             :   /**
     127             :    * Evaluates the shape function divergence in physical coordinates based on \f$ H(div) \f$ conforming
     128             :    * finite element transformation.
     129             :    * The transformation is \f$ \nabla \cdot \phi = J^{-1} \nabla \cdot \hat{\phi} \f$ where
     130             :    * \f$ J = \det( dx/d\xi ) \f$
     131             :    */
     132             :   virtual void map_div(const unsigned int dim,
     133             :                        const Elem * const elem,
     134             :                        const std::vector<Point> & qp,
     135             :                        const FEGenericBase<OutputShape> & fe,
     136             :                        std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputDivergence>> & div_phi) const override;
     137             : 
     138             : }; // class HDivFETransformation
     139             : 
     140             : }
     141             : 
     142             : #endif // LIBMESH_HDIV_FE_TRANSFORMATION_H

Generated by: LCOV version 1.14