LCOV - code coverage report
Current view: top level - include/geom - compare_elems_by_level.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 6 6 100.0 %
Date: 2025-08-19 19:27:09 Functions: 1 1 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_COMPARE_ELEMS_BY_LEVEL_H
      21             : #define LIBMESH_COMPARE_ELEMS_BY_LEVEL_H
      22             : 
      23             : 
      24             : // Local Includes
      25             : #include "libmesh/elem.h"
      26             : 
      27             : // C++ Includes
      28             : #include <numeric>
      29             : #include <set>
      30             : 
      31             : 
      32             : 
      33             : 
      34             : namespace libMesh {
      35             : 
      36             : /**
      37             :  * Specific weak ordering for Elem *'s to be used in a set.
      38             :  * We use the id, but first sort by level.  This guarantees
      39             :  * when traversing the set from beginning to end the lower
      40             :  * level (parent) elements are encountered first.
      41             :  */
      42             : struct CompareElemIdsByLevel
      43             : {
      44  2036016473 :   bool operator()(const Elem * a,
      45             :                   const Elem * b) const
      46             :   {
      47      842518 :     libmesh_assert (a);
      48      842518 :     libmesh_assert (b);
      49             :     const unsigned int
      50  2036016473 :       al = a->level(), bl = b->level();
      51             :     const dof_id_type
      52      842518 :       aid = a->id(),   bid = b->id();
      53             : 
      54  2036016473 :     return (al == bl) ? aid < bid : al < bl;
      55             :   }
      56             : };
      57             : 
      58             : 
      59             : } // namespace libMesh
      60             : 
      61             : #endif // LIBMESH_COMPARE_ELEMS_BY_LEVEL_H

Generated by: LCOV version 1.14