libMesh
compare_elems_by_level.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 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 
43 {
44  bool operator()(const Elem * a,
45  const Elem * b) const
46  {
47  libmesh_assert (a);
48  libmesh_assert (b);
49  const unsigned int
50  al = a->level(), bl = b->level();
51  const dof_id_type
52  aid = a->id(), bid = b->id();
53 
54  return (al == bl) ? aid < bid : al < bl;
55  }
56 };
57 
58 
59 } // namespace libMesh
60 
61 #endif // LIBMESH_COMPARE_ELEMS_BY_LEVEL_H
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
The libMesh namespace provides an interface to certain functionality in the library.
bool operator()(const Elem *a, const Elem *b) const
dof_id_type id() const
Definition: dof_object.h:823
libmesh_assert(ctx)
unsigned int level() const
Definition: elem.h:2911
Specific weak ordering for Elem *&#39;s to be used in a set.
uint8_t dof_id_type
Definition: id_types.h:67