LCOV - code coverage report
Current view: top level - include/mesh - mesh_smoother_vsmoother.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 1 2 50.0 %
Date: 2025-08-19 19:27:09 Functions: 1 3 33.3 %
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_MESH_SMOOTHER_VSMOOTHER_H
      21             : #define LIBMESH_MESH_SMOOTHER_VSMOOTHER_H
      22             : 
      23             : #include "libmesh/libmesh_config.h"
      24             : #if defined(LIBMESH_ENABLE_VSMOOTHER)
      25             : 
      26             : // Local Includes
      27             : #include "libmesh/libmesh_common.h"
      28             : #include "libmesh/mesh_smoother.h"
      29             : #include "libmesh/variational_smoother_system.h"
      30             : #include "petsc_diff_solver.h"
      31             : 
      32             : // C++ Includes
      33             : #include <cstddef>
      34             : #include <vector>
      35             : #include <map>
      36             : #include <fstream>
      37             : 
      38             : namespace libMesh
      39             : {
      40             : 
      41             : // Forward declarations
      42             : class UnstructuredMesh;
      43             : 
      44             : /**
      45             :  * This is an implementation of Larisa Branets' smoothing algorithms.
      46             :  * The initial implementation was done by her, the adaptation to
      47             :  * libmesh was completed by Derek Gaston.  The code was heavily
      48             :  * refactored into something more closely resembling C++ by John
      49             :  * Peterson in 2014.
      50             :  *
      51             :  * Here are the relevant publications:
      52             :  * 1) L. Branets, G. Carey, "Extension of a mesh quality metric for
      53             :  * elements with a curved boundary edge or surface",
      54             :  * Journal of Computing and Information Science in Engineering, vol. 5(4), pp.302-308, 2005.
      55             :  *
      56             :  * 2) L. Branets, G. Carey, "A local cell quality metric and variational grid
      57             :  * smoothing algorithm", Engineering with Computers, vol. 21, pp.19-28, 2005.
      58             :  *
      59             :  * 3) L. Branets, "A variational grid optimization algorithm based on a local
      60             :  * cell quality metric", Ph.D. thesis, The University of Texas at Austin, 2005.
      61             :  *
      62             :  * \author Derek R. Gaston
      63             :  * \date 2006
      64             :  */
      65             : class VariationalMeshSmoother : public MeshSmoother
      66             : {
      67             : public:
      68             : 
      69             :   /**
      70             :    * Simple constructor to use for smoothing purposes
      71             :    */
      72             :   VariationalMeshSmoother(UnstructuredMesh & mesh,
      73             :                           Real dilation_weight=0.5,
      74             :                           const bool preserve_subdomain_boundaries=true);
      75             : 
      76             :   /**
      77             :    * Destructor.
      78             :    */
      79           0 :   virtual ~VariationalMeshSmoother() = default;
      80             : 
      81             :   /**
      82             :    * Redefinition of the smooth function from the
      83             :    * base class.  All this does is call the smooth
      84             :    * function in this class which takes an int, using
      85             :    * a default value of 1.
      86             :    */
      87         828 :   virtual void smooth() override {this->smooth(1); }
      88             : 
      89             :   /**
      90             :    * The actual smoothing function, gets called whenever
      91             :    * the user specifies an actual number of smoothing
      92             :    * iterations.
      93             :    */
      94             :   void smooth(unsigned int n_iterations);
      95             : 
      96             : 
      97             : private:
      98             : 
      99             :   /**
     100             :    * Smoother control variables
     101             :    */
     102             :   const Real _dilation_weight;
     103             : 
     104             :   /// Whether subdomain boundaries are subject to change via smoothing
     105             :   const bool _preserve_subdomain_boundaries;
     106             : };
     107             : 
     108             : } // namespace libMesh
     109             : 
     110             : #endif // defined(LIBMESH_ENABLE_VSMOOTHER)
     111             : 
     112             : #endif // LIBMESH_MESH_SMOOTHER_VSMOOTHER_H

Generated by: LCOV version 1.14