libMesh
Public Member Functions | List of all members
libMesh::CompareElemIdsByLevel Struct Reference

Specific weak ordering for Elem *'s to be used in a set. More...

#include <compare_elems_by_level.h>

Public Member Functions

bool operator() (const Elem *a, const Elem *b) const
 

Detailed Description

Specific weak ordering for Elem *'s to be used in a set.

We use the id, but first sort by level. This guarantees when traversing the set from beginning to end the lower level (parent) elements are encountered first.

Definition at line 42 of file compare_elems_by_level.h.

Member Function Documentation

◆ operator()()

bool libMesh::CompareElemIdsByLevel::operator() ( const Elem a,
const Elem b 
) const
inline

Definition at line 44 of file compare_elems_by_level.h.

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  }

References libMesh::DofObject::id(), libMesh::Elem::level(), and libMesh::libmesh_assert().


The documentation for this struct was generated from the following file:
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::libmesh_assert
libmesh_assert(ctx)