LCOV - code coverage report
Current view: top level - include/error_estimation - kelly_error_estimator.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 1 1 100.0 %
Date: 2025-08-19 19:27:09 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // The libMesh Finite Element Library.
       2             : // Copyright (C) 2002-2025 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             : 
      19             : 
      20             : #ifndef LIBMESH_KELLY_ERROR_ESTIMATOR_H
      21             : #define LIBMESH_KELLY_ERROR_ESTIMATOR_H
      22             : 
      23             : // Local Includes
      24             : #include "libmesh/jump_error_estimator.h"
      25             : 
      26             : // C++ includes
      27             : #include <cstddef>
      28             : #include <string>
      29             : #include <vector>
      30             : 
      31             : namespace libMesh
      32             : {
      33             : 
      34             : // Forward Declarations
      35             : class Point;
      36             : 
      37             : /**
      38             :  * This class implements the Kelly error indicator
      39             :  * which is based on the flux jumps between elements.
      40             :  * See the JumpErrorEstimator class for most user APIs
      41             :  *
      42             :  * Full BibteX reference:
      43             :  *
      44             :  * \verbatim
      45             :  * @Article{Kelly83error,
      46             :  * author = {D.~W.~Kelly and J.~P.~Gago and O.~C.~Zienkiewicz and I.~Babuska},
      47             :  * title  = {{A posteriori error analysis and adaptive
      48             :  *            processes in the finite element method: Part I Error analysis}},
      49             :  * journal = {Int. J. Num. Meth. Engng.},
      50             :  * volume  = {19},
      51             :  * pages   = {1593--1619},
      52             :  * year    = {1983}
      53             :  * }
      54             :  * \endverbatim
      55             :  *
      56             :  * \author Benjamin S. Kirk
      57             :  * \date 2003
      58             :  */
      59             : class KellyErrorEstimator : public JumpErrorEstimator
      60             : {
      61             : public:
      62             : 
      63             :   /**
      64             :    * Constructor.  Responsible for initializing the _bc_function function
      65             :    * pointer to nullptr.  Defaults to H1 seminorm; changes to system norm
      66             :    * are ignored.
      67             :    */
      68             :   KellyErrorEstimator();
      69             : 
      70             :   /**
      71             :    * This class cannot be (default) copy constructed/assigned because
      72             :    * its base class has unique_ptr members.
      73             :    */
      74             :   KellyErrorEstimator (const KellyErrorEstimator &) = delete;
      75             :   KellyErrorEstimator & operator= (const KellyErrorEstimator &) = delete;
      76             : 
      77             :   /**
      78             :    * Defaulted move ctor, move assignment operator, and destructor.
      79             :    */
      80             :   KellyErrorEstimator (KellyErrorEstimator &&) = default;
      81             :   KellyErrorEstimator & operator= (KellyErrorEstimator &&) = default;
      82           8 :   virtual ~KellyErrorEstimator() = default;
      83             : 
      84             :   /**
      85             :    * Register a user function to use in computing the flux BCs.
      86             :    */
      87             :   void attach_flux_bc_function (std::pair<bool,Real> fptr(const System & system,
      88             :                                                           const Point & p,
      89             :                                                           const std::string & var_name));
      90             : 
      91             :   virtual ErrorEstimatorType type() const override;
      92             : 
      93             : protected:
      94             : 
      95             :   /**
      96             :    * An initialization function, for requesting specific data from the FE
      97             :    * objects.
      98             :    */
      99             :   virtual void init_context(FEMContext & c) override;
     100             : 
     101             :   /**
     102             :    * The function which calculates a normal derivative jump based error
     103             :    * term on an internal side.
     104             :    */
     105             :   virtual void internal_side_integration() override;
     106             : 
     107             :   /**
     108             :    * The function which calculates a normal derivative jump based error
     109             :    * term on a boundary side.
     110             :    *
     111             :    * \returns \p true if the flux bc function is in fact defined on
     112             :    * the current side.
     113             :    */
     114             :   virtual bool boundary_side_integration() override;
     115             : 
     116             :   /**
     117             :    * Pointer to function that provides BC information.
     118             :    */
     119             :   std::pair<bool,Real> (* _bc_function) (const System & system,
     120             :                                          const Point & p,
     121             :                                          const std::string & var_name);
     122             : };
     123             : 
     124             : 
     125             : } // namespace libMesh
     126             : 
     127             : #endif // LIBMESH_KELLY_ERROR_ESTIMATOR_H

Generated by: LCOV version 1.14