libMesh::Elem Class Referenceabstract

The base class for all geometric element types. More...

#include <elem.h>

Inheritance diagram for libMesh::Elem:

Classes

class  ChildRefIter
 
class  ConstChildRefIter
 
class  ConstNodeRefIter
 
class  NodeRefIter
 
struct  side_iterator
 
class  SideIter
 

Public Types

enum  RefinementState {
  COARSEN = 0, DO_NOTHING, REFINE, JUST_REFINED,
  JUST_COARSENED, INACTIVE, COARSEN_INACTIVE, INVALID_REFINEMENTSTATE
}
 
typedef Elem *const * NeighborPtrIter
 
typedef const Elem *const * ConstNeighborPtrIter
 
typedef Predicates::multi_predicate Predicate
 

Public Member Functions

 Elem (Elem &&)=delete
 
 Elem (const Elem &)=delete
 
Elemoperator= (const Elem &)=delete
 
Elemoperator= (Elem &&)=delete
 
virtual ~Elem ()
 
const Pointpoint (const unsigned int i) const
 
Pointpoint (const unsigned int i)
 
virtual Point master_point (const unsigned int i) const =0
 
dof_id_type node_id (const unsigned int i) const
 
dof_id_type node (const unsigned int i) const
 
unsigned int local_node (const dof_id_type i) const
 
unsigned int get_node_index (const Node *node_ptr) const
 
const Node *const * get_nodes () const
 
const Nodenode_ptr (const unsigned int i) const
 
Nodenode_ptr (const unsigned int i)
 
const Nodenode_ref (const unsigned int i) const
 
Nodenode_ref (const unsigned int i)
 
Nodeget_node (const unsigned int i) const
 
virtual Node *& set_node (const unsigned int i)
 
SimpleRange< NodeRefIternode_ref_range ()
 
SimpleRange< ConstNodeRefIternode_ref_range () const
 
subdomain_id_type subdomain_id () const
 
subdomain_id_typesubdomain_id ()
 
const Elemreference_elem () const
 
virtual dof_id_type key (const unsigned int s) const =0
 
virtual dof_id_type key () const
 
bool operator== (const Elem &rhs) const
 
const Elemneighbor_ptr (unsigned int i) const
 
Elemneighbor_ptr (unsigned int i)
 
Elemneighbor (const unsigned int i) const
 
SimpleRange< NeighborPtrIterneighbor_ptr_range ()
 
SimpleRange< ConstNeighborPtrIterneighbor_ptr_range () const
 
const Elemtopological_neighbor (const unsigned int i, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb) const
 
Elemtopological_neighbor (const unsigned int i, MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb)
 
bool has_topological_neighbor (const Elem *elem, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb) const
 
void set_neighbor (const unsigned int i, Elem *n)
 
bool has_neighbor (const Elem *elem) const
 
Elemchild_neighbor (Elem *elem)
 
const Elemchild_neighbor (const Elem *elem) const
 
bool on_boundary () const
 
bool is_semilocal (const processor_id_type my_pid) const
 
unsigned int which_neighbor_am_i (const Elem *e) const
 
unsigned int which_side_am_i (const Elem *e) const
 
virtual unsigned int which_node_am_i (unsigned int side, unsigned int side_node) const =0
 
bool contains_vertex_of (const Elem *e) const
 
bool contains_edge_of (const Elem *e) const
 
void find_point_neighbors (const Point &p, std::set< const Elem *> &neighbor_set) const
 
void find_point_neighbors (std::set< const Elem *> &neighbor_set) const
 
void find_point_neighbors (std::set< const Elem *> &neighbor_set, const Elem *start_elem) const
 
void find_edge_neighbors (const Point &p1, const Point &p2, std::set< const Elem *> &neighbor_set) const
 
void find_edge_neighbors (std::set< const Elem *> &neighbor_set) const
 
void find_interior_neighbors (std::set< const Elem *> &neighbor_set) const
 
void remove_links_to_me ()
 
void make_links_to_me_remote ()
 
void make_links_to_me_local (unsigned int n)
 
virtual bool is_remote () const
 
virtual void connectivity (const unsigned int sc, const IOPackage iop, std::vector< dof_id_type > &conn) const =0
 
void write_connectivity (std::ostream &out, const IOPackage iop) const
 
virtual ElemType type () const =0
 
virtual unsigned short dim () const =0
 
virtual unsigned int n_nodes () const =0
 
IntRange< unsigned short > node_index_range () const
 
virtual unsigned int n_nodes_in_child (unsigned int) const
 
virtual unsigned int n_sides () const =0
 
IntRange< unsigned short > side_index_range () const
 
unsigned int n_neighbors () const
 
virtual unsigned int n_vertices () const =0
 
virtual unsigned int n_edges () const =0
 
IntRange< unsigned short > edge_index_range () const
 
virtual unsigned int n_faces () const =0
 
virtual unsigned int n_children () const =0
 
virtual bool is_vertex (const unsigned int i) const =0
 
virtual unsigned int is_vertex_on_child (unsigned int, unsigned int n) const
 
virtual bool is_vertex_on_parent (unsigned int c, unsigned int n) const
 
virtual bool is_edge (const unsigned int i) const =0
 
virtual bool is_face (const unsigned int i) const =0
 
virtual bool is_node_on_side (const unsigned int n, const unsigned int s) const =0
 
virtual std::vector< unsigned int > nodes_on_side (const unsigned int) const =0
 
virtual bool is_node_on_edge (const unsigned int n, const unsigned int e) const =0
 
virtual bool is_edge_on_side (const unsigned int e, const unsigned int s) const =0
 
virtual unsigned int opposite_side (const unsigned int s) const
 
virtual unsigned int opposite_node (const unsigned int n, const unsigned int s) const
 
virtual unsigned int n_sub_elem () const =0
 
virtual std::unique_ptr< Elemside_ptr (unsigned int i)=0
 
std::unique_ptr< const Elemside_ptr (unsigned int i) const
 
virtual void side_ptr (std::unique_ptr< Elem > &side, const unsigned int i)=0
 
void side_ptr (std::unique_ptr< const Elem > &side, const unsigned int i) const
 
std::unique_ptr< Elemside (const unsigned int i) const
 
virtual std::unique_ptr< Elembuild_side_ptr (const unsigned int i, bool proxy=true)=0
 
std::unique_ptr< const Elembuild_side_ptr (const unsigned int i, bool proxy=true) const
 
virtual void build_side_ptr (std::unique_ptr< Elem > &side, const unsigned int i)=0
 
void build_side_ptr (std::unique_ptr< const Elem > &side, const unsigned int i) const
 
std::unique_ptr< Elembuild_side (const unsigned int i, bool proxy=true) const
 
virtual std::unique_ptr< Elembuild_edge_ptr (const unsigned int i)=0
 
std::unique_ptr< const Elembuild_edge_ptr (const unsigned int i) const
 
std::unique_ptr< Elembuild_edge (const unsigned int i) const
 
virtual Order default_order () const =0
 
virtual Point centroid () const
 
virtual Real hmin () const
 
virtual Real hmax () const
 
virtual Real volume () const
 
virtual BoundingBox loose_bounding_box () const
 
virtual Real quality (const ElemQuality q) const
 
virtual std::pair< Real, Realqual_bounds (const ElemQuality) const
 
virtual bool contains_point (const Point &p, Real tol=TOLERANCE) const
 
virtual bool close_to_point (const Point &p, Real tol) const
 
virtual bool has_affine_map () const
 
virtual bool is_linear () const
 
void print_info (std::ostream &os=libMesh::out) const
 
std::string get_info () const
 
bool active () const
 
bool ancestor () const
 
bool subactive () const
 
bool has_children () const
 
bool has_ancestor_children () const
 
bool is_ancestor_of (const Elem *descendant) const
 
const Elemparent () const
 
Elemparent ()
 
void set_parent (Elem *p)
 
const Elemtop_parent () const
 
const Eleminterior_parent () const
 
Eleminterior_parent ()
 
void set_interior_parent (Elem *p)
 
Real length (const unsigned int n1, const unsigned int n2) const
 
virtual unsigned int n_second_order_adjacent_vertices (const unsigned int n) const
 
virtual unsigned short int second_order_adjacent_vertex (const unsigned int n, const unsigned int v) const
 
virtual std::pair< unsigned short int, unsigned short int > second_order_child_vertex (const unsigned int n) const
 
unsigned int level () const
 
unsigned int p_level () const
 
virtual bool is_child_on_side (const unsigned int c, const unsigned int s) const =0
 
const Elemraw_child_ptr (unsigned int i) const
 
const Elemchild_ptr (unsigned int i) const
 
Elemchild_ptr (unsigned int i)
 
Elemchild (const unsigned int i) const
 
SimpleRange< ChildRefIterchild_ref_range ()
 
SimpleRange< ConstChildRefIterchild_ref_range () const
 
unsigned int which_child_am_i (const Elem *e) const
 
virtual bool is_child_on_edge (const unsigned int c, const unsigned int e) const
 
void add_child (Elem *elem)
 
void add_child (Elem *elem, unsigned int c)
 
void replace_child (Elem *elem, unsigned int c)
 
void family_tree (std::vector< const Elem *> &family, const bool reset=true) const
 
void total_family_tree (std::vector< const Elem *> &active_family, const bool reset=true) const
 
void active_family_tree (std::vector< const Elem *> &active_family, const bool reset=true) const
 
void family_tree_by_side (std::vector< const Elem *> &family, const unsigned int side, const bool reset=true) const
 
void active_family_tree_by_side (std::vector< const Elem *> &family, const unsigned int side, const bool reset=true) const
 
void family_tree_by_neighbor (std::vector< const Elem *> &family, const Elem *neighbor, const bool reset=true) const
 
void total_family_tree_by_neighbor (std::vector< const Elem *> &family, const Elem *neighbor, const bool reset=true) const
 
void family_tree_by_subneighbor (std::vector< const Elem *> &family, const Elem *neighbor, const Elem *subneighbor, const bool reset=true) const
 
void total_family_tree_by_subneighbor (std::vector< const Elem *> &family, const Elem *neighbor, const Elem *subneighbor, const bool reset=true) const
 
void active_family_tree_by_neighbor (std::vector< const Elem *> &family, const Elem *neighbor, const bool reset=true) const
 
void active_family_tree_by_topological_neighbor (std::vector< const Elem *> &family, const Elem *neighbor, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb, const bool reset=true) const
 
RefinementState refinement_flag () const
 
void set_refinement_flag (const RefinementState rflag)
 
RefinementState p_refinement_flag () const
 
void set_p_refinement_flag (const RefinementState pflag)
 
unsigned int max_descendant_p_level () const
 
unsigned int min_p_level_by_neighbor (const Elem *neighbor, unsigned int current_min) const
 
unsigned int min_new_p_level_by_neighbor (const Elem *neighbor, unsigned int current_min) const
 
void set_p_level (const unsigned int p)
 
void hack_p_level (const unsigned int p)
 
virtual void refine (MeshRefinement &mesh_refinement)
 
void coarsen ()
 
void contract ()
 
void libmesh_assert_valid_neighbors () const
 
void libmesh_assert_valid_node_pointers () const
 
side_iterator boundary_sides_begin ()
 
side_iterator boundary_sides_end ()
 
virtual bool infinite () const =0
 
virtual bool is_mid_infinite_edge_node (const unsigned int) const
 
virtual Point origin () const
 
virtual unsigned int as_parent_node (unsigned int c, unsigned int n) const
 
virtual const std::vector< std::pair< unsigned char, unsigned char > > & parent_bracketing_nodes (unsigned int c, unsigned int n) const
 
virtual const std::vector< std::pair< dof_id_type, dof_id_type > > bracketing_nodes (unsigned int c, unsigned int n) const
 
virtual float embedding_matrix (const unsigned int child_num, const unsigned int child_node_num, const unsigned int parent_node_num) const =0
 
virtual unsigned int embedding_matrix_version () const
 
void nullify_neighbors ()
 
void clear_old_dof_object ()
 
void set_old_dof_object ()
 
void clear_dofs ()
 
void invalidate_dofs (const unsigned int sys_num=libMesh::invalid_uint)
 
void invalidate_id ()
 
void invalidate_processor_id ()
 
void invalidate ()
 
unsigned int n_dofs (const unsigned int s, const unsigned int var=libMesh::invalid_uint) const
 
dof_id_type id () const
 
dof_id_typeset_id ()
 
void set_id (const dof_id_type dofid)
 
unique_id_type unique_id () const
 
unique_id_typeset_unique_id ()
 
bool valid_id () const
 
bool valid_unique_id () const
 
processor_id_type processor_id () const
 
processor_id_typeprocessor_id ()
 
void processor_id (const processor_id_type pid)
 
bool valid_processor_id () const
 
unsigned int n_systems () const
 
void set_n_systems (const unsigned int s)
 
void add_system ()
 
unsigned int n_var_groups (const unsigned int s) const
 
unsigned int n_vars (const unsigned int s, const unsigned int vg) const
 
unsigned int n_vars (const unsigned int s) const
 
void set_n_vars_per_group (const unsigned int s, const std::vector< unsigned int > &nvpg)
 
unsigned int n_comp (const unsigned int s, const unsigned int var) const
 
unsigned int n_comp_group (const unsigned int s, const unsigned int vg) const
 
void set_n_comp (const unsigned int s, const unsigned int var, const unsigned int ncomp)
 
void set_n_comp_group (const unsigned int s, const unsigned int vg, const unsigned int ncomp)
 
dof_id_type dof_number (const unsigned int s, const unsigned int var, const unsigned int comp) const
 
dof_id_type dof_number (const unsigned int s, const unsigned int vg, const unsigned int vig, const unsigned int comp, const unsigned int n_comp) const
 
std::pair< unsigned int, unsigned int > var_to_vg_and_offset (const unsigned int s, const unsigned int var) const
 
void set_dof_number (const unsigned int s, const unsigned int var, const unsigned int comp, const dof_id_type dn)
 
bool has_dofs (const unsigned int s=libMesh::invalid_uint) const
 
void set_vg_dof_base (const unsigned int s, const unsigned int vg, const dof_id_type db)
 
dof_id_type vg_dof_base (const unsigned int s, const unsigned int vg) const
 
unsigned int packed_indexing_size () const
 
void unpack_indexing (std::vector< largest_id_type >::const_iterator begin)
 
void pack_indexing (std::back_insert_iterator< std::vector< largest_id_type >> target) const
 
void debug_buffer () const
 
void print_dof_info () const
 
void set_buffer (const std::vector< dof_id_type > &buf)
 

Static Public Member Functions

static ElemType second_order_equivalent_type (const ElemType et, const bool full_ordered=true)
 
static ElemType first_order_equivalent_type (const ElemType et)
 
static std::unique_ptr< Elembuild (const ElemType type, Elem *p=nullptr)
 
static std::string get_info ()
 
static void print_info (std::ostream &out=libMesh::out)
 
static unsigned int n_objects ()
 
static void enable_print_counter_info ()
 
static void disable_print_counter_info ()
 
static unsigned int unpackable_indexing_size (std::vector< largest_id_type >::const_iterator begin)
 
static std::string get_info ()
 
static void print_info (std::ostream &out=libMesh::out)
 
static unsigned int n_objects ()
 
static void enable_print_counter_info ()
 
static void disable_print_counter_info ()
 

Public Attributes

DofObjectold_dof_object
 

Static Public Attributes

static const subdomain_id_type invalid_subdomain_id = std::numeric_limits<subdomain_id_type>::max()
 
static const unsigned int type_to_n_nodes_map [INVALID_ELEM]
 
static const unsigned int max_n_nodes = 27
 
static const unsigned int type_to_n_sides_map [INVALID_ELEM]
 
static const unsigned int type_to_n_edges_map [INVALID_ELEM]
 
static const dof_id_type invalid_id = static_cast<dof_id_type>(-1)
 
static const unique_id_type invalid_unique_id = static_cast<unique_id_type>(-1)
 
static const processor_id_type invalid_processor_id = static_cast<processor_id_type>(-1)
 

Protected Types

typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 
typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 

Protected Member Functions

 Elem (const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
 
template<typename Subclass >
void simple_build_side_ptr (std::unique_ptr< Elem > &side, const unsigned int i, ElemType sidetype)
 
virtual std::vector< std::vector< std::vector< std::vector< std::pair< unsigned char, unsigned char > > > > > & _get_bracketing_node_cache () const
 
virtual std::vector< std::vector< std::vector< signed char > > > & _get_parent_indices_cache () const
 
void increment_constructor_count (const std::string &name)
 
void increment_destructor_count (const std::string &name)
 
void increment_constructor_count (const std::string &name)
 
void increment_destructor_count (const std::string &name)
 

Static Protected Member Functions

static dof_id_type compute_key (dof_id_type n0)
 
static dof_id_type compute_key (dof_id_type n0, dof_id_type n1)
 
static dof_id_type compute_key (dof_id_type n0, dof_id_type n1, dof_id_type n2)
 
static dof_id_type compute_key (dof_id_type n0, dof_id_type n1, dof_id_type n2, dof_id_type n3)
 

Protected Attributes

Node ** _nodes
 
Elem ** _elemlinks
 
Elem ** _children
 
subdomain_id_type _sbd_id
 
unsigned char _rflag
 
unsigned char _pflag
 
unsigned char _p_level
 

Static Protected Attributes

static Counts _counts
 
static Threads::atomic< unsigned int > _n_objects
 
static Threads::spin_mutex _mutex
 
static bool _enable_print_counter = true
 
static Counts _counts
 
static Threads::atomic< unsigned int > _n_objects
 
static Threads::spin_mutex _mutex
 
static bool _enable_print_counter = true
 

Private Member Functions

bool point_test (const Point &p, Real box_tol, Real map_tol) const
 
void set_child (unsigned int c, Elem *elem)
 
SideIter _first_side ()
 
SideIter _last_side ()
 

Detailed Description

The base class for all geometric element types.

This is the base class from which all geometric element types are derived. The Elem class provides standard information such as the number of nodes, edges, faces, vertices, children, and neighbors it has, as well as access to (or the ability to construct) these entities.

An Elem has pointers to its Node objects. Some of these nodes live at the vertices of the element, while others may live on edges (and faces in 3D), or interior to the element. The number of nodes in a given element, n_nodes(), is encoded into the name of the class. For example, a Tri3 has three nodes which correspond to the vertices, while a Tri6 has six nodes, three of which are located at vertices, and three which are located at the midpoint of each edge. Nodes on edges, faces, and element interiors are called second-order nodes.

A 1D Elem is an Edge, a 2D Elem is a Face, and a 3D Elem is a Cell. An Elem is composed of a number of sides, which can be accessed as dim-1 dimensional Elem types. For example, a Hex8 is a 3D hexahedral element. A Hex8 has 6 sides, which are Faces of type Quad4.

Author
Benjamin S. Kirk
Date
2002-2007

Definition at line 100 of file elem.h.

Member Typedef Documentation

◆ ConstNeighborPtrIter

Definition at line 324 of file elem.h.

◆ Counts [1/2]

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information. The log is identified by the class name.

Definition at line 117 of file reference_counter.h.

◆ Counts [2/2]

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information. The log is identified by the class name.

Definition at line 117 of file reference_counter.h.

◆ NeighborPtrIter

Nested "classes" for use iterating over all neighbors of an element.

Definition at line 323 of file elem.h.

◆ Predicate

Useful iterator typedefs

Definition at line 1499 of file elem.h.

Member Enumeration Documentation

◆ RefinementState

Enumeration of possible element refinement states.

Enumerator
COARSEN 
DO_NOTHING 
REFINE 
JUST_REFINED 
JUST_COARSENED 
INACTIVE 
COARSEN_INACTIVE 
INVALID_REFINEMENTSTATE 

Definition at line 1198 of file elem.h.

Constructor & Destructor Documentation

◆ Elem() [1/3]

libMesh::Elem::Elem ( const unsigned int  n_nodes,
const unsigned int  n_sides,
Elem parent,
Elem **  elemlinkdata,
Node **  nodelinkdata 
)
inlineprotected

Constructor. Creates an element with n_nodes nodes, n_sides sides, n_children possible children, and parent p. The constructor allocates the memory necessary to support this data.

Definition at line 1811 of file elem.h.

References _elemlinks, _nodes, libMesh::DofObject::invalid_processor_id, max_n_nodes, p_level(), parent(), libMesh::DofObject::processor_id(), set_p_level(), and subdomain_id().

1815  :
1816  _nodes(nodelinkdata),
1817  _elemlinks(elemlinkdata),
1818 #ifdef LIBMESH_ENABLE_AMR
1819  _children(nullptr),
1820 #endif
1821  _sbd_id(0)
1822 #ifdef LIBMESH_ENABLE_AMR
1823  ,
1826  _p_level(0)
1827 #endif
1828 {
1830 
1831  // If this ever legitimately fails we need to increase max_n_nodes
1832  libmesh_assert_less_equal(nn, max_n_nodes);
1833 
1834  // Initialize the nodes data structure
1835  if (_nodes)
1836  {
1837  for (unsigned int n=0; n<nn; n++)
1838  _nodes[n] = nullptr;
1839  }
1840 
1841  // Initialize the neighbors/parent data structure
1842  // _elemlinks = new Elem *[ns+1];
1843 
1844  if (_elemlinks)
1845  {
1846  _elemlinks[0] = p;
1847 
1848  for (unsigned int n=1; n<ns+1; n++)
1849  _elemlinks[n] = nullptr;
1850  }
1851 
1852  // Optionally initialize data from the parent
1853  if (this->parent() != nullptr)
1854  {
1855  this->subdomain_id() = this->parent()->subdomain_id();
1856  this->processor_id() = this->parent()->processor_id();
1857  }
1858 
1859 #ifdef LIBMESH_ENABLE_AMR
1860  if (this->parent())
1861  this->set_p_level(this->parent()->p_level());
1862 #endif
1863 }
1864 
1865 
1866 
1867 inline
1868 Elem::~Elem()
1869 {
1870  // Deleting my parent/neighbor/nodes storage isn't necessary since it's
1871  // handled by the subclass
1872 
1873  // if (_nodes != nullptr)
1874  // delete [] _nodes;
1875  // _nodes = nullptr;
1876 
1877  // delete [] _elemlinks;
1878 
1879 #ifdef LIBMESH_ENABLE_AMR
1880 
1881  // Delete my children's storage
1882  if (_children != nullptr)
1883  delete [] _children;
1884  _children = nullptr;
1885 
1886 #endif
1887 }
void set_p_level(const unsigned int p)
Definition: elem.h:2692
const Elem * parent() const
Definition: elem.h:2479
Node ** _nodes
Definition: elem.h:1695
unsigned char _pflag
Definition: elem.h:1726
unsigned char _p_level
Definition: elem.h:1736
virtual ~Elem()
unsigned int p_level() const
Definition: elem.h:2555
static const processor_id_type invalid_processor_id
Definition: dof_object.h:358
Elem ** _elemlinks
Definition: elem.h:1701
Elem ** _children
Definition: elem.h:1707
subdomain_id_type _sbd_id
Definition: elem.h:1713
unsigned char _rflag
Definition: elem.h:1720
subdomain_id_type subdomain_id() const
Definition: elem.h:2034
processor_id_type processor_id() const
Definition: dof_object.h:717
static const unsigned int max_n_nodes
Definition: elem.h:600

◆ Elem() [2/3]

libMesh::Elem::Elem ( Elem &&  )
delete

Elems are responsible for allocating and deleting their children during refinement, so they cannot be (default) copied or assigned. We therefore explicitly delete these operations. Note that because _children is a C-style array, an Elem cannot even be safely default move-constructed (we would have to maintain a custom move constructor that explicitly sets _children to nullptr to do this safely).

◆ Elem() [3/3]

libMesh::Elem::Elem ( const Elem )
delete

◆ ~Elem()

virtual libMesh::Elem::~Elem ( )
virtual

Destructor. Frees all the memory associated with the element.

Member Function Documentation

◆ _first_side()

Elem::SideIter libMesh::Elem::_first_side ( )
inlineprivate

Side iterator helper functions. Used to replace the begin() and end() functions of the STL containers.

Definition at line 2955 of file elem.h.

Referenced by boundary_sides_begin().

2956 {
2957  return SideIter(0, this);
2958 }

◆ _get_bracketing_node_cache()

virtual std::vector<std::vector<std::vector<std::vector<std::pair<unsigned char, unsigned char> > > > >& libMesh::Elem::_get_bracketing_node_cache ( ) const
inlineprotectedvirtual

Elem subclasses which don't do their own bracketing node calculations will need to supply a static cache, since the default calculation is slow.

Definition at line 1659 of file elem.h.

Referenced by parent_bracketing_nodes().

1660  {
1661  static std::vector<std::vector<std::vector<std::vector<std::pair<unsigned char, unsigned char>>>>> c;
1662  libmesh_error();
1663  return c;
1664  }

◆ _get_parent_indices_cache()

virtual std::vector<std::vector<std::vector<signed char> > >& libMesh::Elem::_get_parent_indices_cache ( ) const
inlineprotectedvirtual

Elem subclasses which don't do their own child-to-parent node calculations will need to supply a static cache, since the default calculation is slow.

Definition at line 1673 of file elem.h.

Referenced by as_parent_node().

1674  {
1675  static std::vector<std::vector<std::vector<signed char>>> c;
1676  libmesh_error();
1677  return c;
1678  }

◆ _last_side()

Elem::SideIter libMesh::Elem::_last_side ( )
inlineprivate

Definition at line 2963 of file elem.h.

References n_neighbors().

Referenced by boundary_sides_begin(), and boundary_sides_end().

2964 {
2965  return SideIter(this->n_neighbors(), this);
2966 }
unsigned int n_neighbors() const
Definition: elem.h:644

◆ active()

bool libMesh::Elem::active ( ) const
inline
Returns
true if the element is active (i.e. has no active descendants) or AMR is disabled, false otherwise.
Note
It suffices to check the first child only.

Definition at line 2390 of file elem.h.

References COARSEN_INACTIVE, INACTIVE, and refinement_flag().

Referenced by libMesh::DofMap::_dof_indices(), active_family_tree(), active_family_tree_by_neighbor(), active_family_tree_by_side(), active_family_tree_by_topological_neighbor(), libMesh::HPCoarsenTest::add_projection(), ancestor(), libMesh::Patch::build_around_element(), libMesh::Partitioner::build_graph(), coarsen(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::FEAbstract::compute_periodic_node_constraints(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_proj_constraints(), libMesh::connect_families(), libMesh::UnstructuredMesh::contract(), contract(), libMesh::DofMap::dof_indices(), libMesh::JumpErrorEstimator::estimate_error(), family_tree(), family_tree_by_neighbor(), family_tree_by_side(), family_tree_by_subneighbor(), find_interior_neighbors(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshTools::find_nodal_neighbors(), find_point_neighbors(), get_info(), libMesh::ErrorVector::is_active_elem(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshRefinement::make_coarsening_compatible(), make_links_to_me_local(), libMesh::MeshRefinement::make_refinement_compatible(), max_descendant_p_level(), min_new_p_level_by_neighbor(), min_p_level_by_neighbor(), libMesh::DofMap::old_dof_indices(), libMesh::PointLocatorTree::operator()(), libMesh::MetisPartitioner::partition_range(), refine(), subactive(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::MeshRefinement::test_level_one(), and libMesh::Parallel::Packing< T >::unpack().

2391 {
2392 #ifdef LIBMESH_ENABLE_AMR
2393  if ((this->refinement_flag() == INACTIVE) ||
2394  (this->refinement_flag() == COARSEN_INACTIVE))
2395  return false;
2396  else
2397  return true;
2398 #else
2399  return true;
2400 #endif
2401 }
RefinementState refinement_flag() const
Definition: elem.h:2638

◆ active_family_tree()

void libMesh::Elem::active_family_tree ( std::vector< const Elem *> &  active_family,
const bool  reset = true 
) const

Same as the family_tree() member, but only adds the active children. Can be thought of as removing all the inactive elements from the vector created by family_tree, but is implemented more efficiently.

Definition at line 1577 of file elem.C.

References active(), child_ref_range(), and subactive().

Referenced by libMesh::MeshCommunication::delete_remote_elements(), and libMesh::SiblingCoupling::operator()().

1579 {
1580  // The "family tree" doesn't include subactive elements
1581  libmesh_assert(!this->subactive());
1582 
1583  // Clear the vector if the flag reset tells us to.
1584  if (reset)
1585  active_family.clear();
1586 
1587  // Add this element to the family tree if it is active
1588  if (this->active())
1589  active_family.push_back(this);
1590 
1591  // Otherwise recurse into the element's children.
1592  // Do not clear the vector any more.
1593  else
1594  for (auto & c : this->child_ref_range())
1595  if (!c.is_remote())
1596  c.active_family_tree (active_family, false);
1597 }
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390

◆ active_family_tree_by_neighbor()

void libMesh::Elem::active_family_tree_by_neighbor ( std::vector< const Elem *> &  family,
const Elem neighbor,
const bool  reset = true 
) const

Same as the active_family_tree() member, but only adds elements which are next to neighbor.

Definition at line 1837 of file elem.C.

References active(), child_ref_range(), has_neighbor(), level(), libMesh::remote_elem, and subactive().

Referenced by libMesh::DefaultCoupling::operator()().

1840 {
1841  // The "family tree" doesn't include subactive elements or
1842  // remote_elements
1843  libmesh_assert(!this->subactive());
1844  libmesh_assert(this != remote_elem);
1845 
1846  // Clear the vector if the flag reset tells us to.
1847  if (reset)
1848  family.clear();
1849 
1850  // This only makes sense if we're already a neighbor
1851 #ifndef NDEBUG
1852  if (this->level() >= neighbor_in->level())
1853  libmesh_assert (this->has_neighbor(neighbor_in));
1854 #endif
1855 
1856  // Add an active element to the family tree.
1857  if (this->active())
1858  family.push_back(this);
1859 
1860  // Or recurse into an ancestor element's children.
1861  // Do not clear the vector any more.
1862  else if (!this->active())
1863  for (auto & c : this->child_ref_range())
1864  if (&c != remote_elem && c.has_neighbor(neighbor_in))
1865  c.active_family_tree_by_neighbor (family, neighbor_in, false);
1866 }
bool has_neighbor(const Elem *elem) const
Definition: elem.h:2093
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
unsigned int level() const
Definition: elem.h:2521
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ active_family_tree_by_side()

void libMesh::Elem::active_family_tree_by_side ( std::vector< const Elem *> &  family,
const unsigned int  side,
const bool  reset = true 
) const

Same as the active_family_tree() member, but only adds elements which are next to side.

Definition at line 1630 of file elem.C.

References active(), active_family_tree_by_side(), child_ptr(), is_child_on_side(), is_remote(), n_children(), n_sides(), libMesh::remote_elem, and subactive().

Referenced by active_family_tree_by_side(), libMesh::Nemesis_IO_Helper::write_sidesets(), and libMesh::ExodusII_IO_Helper::write_sidesets().

1633 {
1634  // The "family tree" doesn't include subactive or remote elements
1635  libmesh_assert(!this->subactive());
1636  libmesh_assert(this != remote_elem);
1637 
1638  // Clear the vector if the flag reset tells us to.
1639  if (reset)
1640  family.clear();
1641 
1642  libmesh_assert_less (s, this->n_sides());
1643 
1644  // Add an active element to the family tree.
1645  if (this->active())
1646  family.push_back(this);
1647 
1648  // Or recurse into an ancestor element's children.
1649  // Do not clear the vector any more.
1650  else
1651  {
1652  const unsigned int nc = this->n_children();
1653  for (unsigned int c = 0; c != nc; c++)
1654  if (!this->child_ptr(c)->is_remote() && this->is_child_on_side(c, s))
1655  this->child_ptr(c)->active_family_tree_by_side (family, s, false);
1656  }
1657 }
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const =0
virtual unsigned int n_children() const =0
void active_family_tree_by_side(std::vector< const Elem *> &family, const unsigned int side, const bool reset=true) const
Definition: elem.C:1630
virtual bool is_remote() const
Definition: elem.h:555
virtual unsigned int n_sides() const =0
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2578
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ active_family_tree_by_topological_neighbor()

void libMesh::Elem::active_family_tree_by_topological_neighbor ( std::vector< const Elem *> &  family,
const Elem neighbor,
const MeshBase mesh,
const PointLocatorBase point_locator,
const PeriodicBoundaries pb,
const bool  reset = true 
) const

Same as the active_family_tree_by_neighbor() member, but the neighbor here may be a topological (e.g. periodic boundary condition) neighbor, not just a local neighbor.

Definition at line 1795 of file elem.C.

References active(), child_ref_range(), has_topological_neighbor(), level(), mesh, libMesh::remote_elem, and subactive().

Referenced by libMesh::DefaultCoupling::operator()().

1801 {
1802  // The "family tree" doesn't include subactive elements or
1803  // remote_elements
1804  libmesh_assert(!this->subactive());
1805  libmesh_assert(this != remote_elem);
1806 
1807  // Clear the vector if the flag reset tells us to.
1808  if (reset)
1809  family.clear();
1810 
1811  // This only makes sense if we're already a topological neighbor
1812 #ifndef NDEBUG
1813  if (this->level() >= neighbor_in->level())
1814  libmesh_assert (this->has_topological_neighbor(neighbor_in,
1815  mesh,
1816  point_locator,
1817  pb));
1818 #endif
1819 
1820  // Add an active element to the family tree.
1821  if (this->active())
1822  family.push_back(this);
1823 
1824  // Or recurse into an ancestor element's children.
1825  // Do not clear the vector any more.
1826  else if (!this->active())
1827  for (auto & c : this->child_ref_range())
1828  if (&c != remote_elem &&
1829  c.has_topological_neighbor(neighbor_in, mesh, point_locator,
1830  pb))
1831  c.active_family_tree_by_topological_neighbor
1832  (family, neighbor_in, mesh, point_locator, pb, false);
1833 }
MeshBase & mesh
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
bool has_topological_neighbor(const Elem *elem, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb) const
Definition: elem.C:957
unsigned int level() const
Definition: elem.h:2521
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ add_child() [1/2]

void libMesh::Elem::add_child ( Elem elem)

Adds a child pointer to the array of children of this element. If this is the first child to be added, this method allocates memory in the parent's _children array, otherwise, it just sets the pointer.

Definition at line 1461 of file elem.C.

References _children, n_children(), parent(), libMesh::remote_elem, and set_child().

Referenced by libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::CheckpointIO::read_connectivity(), libMesh::CheckpointIO::read_remote_elem(), libMesh::XdrIO::read_serialized_connectivity(), and libMesh::Parallel::Packing< T >::unpack().

1462 {
1463  const unsigned int nc = this->n_children();
1464 
1465  if (_children == nullptr)
1466  {
1467  _children = new Elem *[nc];
1468 
1469  for (unsigned int c = 0; c != nc; c++)
1470  this->set_child(c, nullptr);
1471  }
1472 
1473  for (unsigned int c = 0; c != nc; c++)
1474  {
1475  if (this->_children[c] == nullptr || this->_children[c] == remote_elem)
1476  {
1477  libmesh_assert_equal_to (this, elem->parent());
1478  this->set_child(c, elem);
1479  return;
1480  }
1481  }
1482 
1483  libmesh_error_msg("Error: Tried to add a child to an element with full children array");
1484 }
virtual unsigned int n_children() const =0
Elem ** _children
Definition: elem.h:1707
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811
void set_child(unsigned int c, Elem *elem)
Definition: elem.h:2610
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ add_child() [2/2]

void libMesh::Elem::add_child ( Elem elem,
unsigned int  c 
)

Adds a new child pointer to the specified index in the array of children of this element. If this is the first child to be added, this method allocates memory in the parent's _children array, otherwise, it just sets the pointer.

Definition at line 1488 of file elem.C.

References _children, child_ptr(), has_children(), n_children(), parent(), libMesh::remote_elem, and set_child().

1489 {
1490  if (!this->has_children())
1491  {
1492  const unsigned int nc = this->n_children();
1493  _children = new Elem *[nc];
1494 
1495  for (unsigned int i = 0; i != nc; i++)
1496  this->set_child(i, nullptr);
1497  }
1498 
1499  libmesh_assert (this->_children[c] == nullptr || this->child_ptr(c) == remote_elem);
1500  libmesh_assert (elem == remote_elem || this == elem->parent());
1501 
1502  this->set_child(c, elem);
1503 }
const Elem * parent() const
Definition: elem.h:2479
virtual unsigned int n_children() const =0
Elem ** _children
Definition: elem.h:1707
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811
void set_child(unsigned int c, Elem *elem)
Definition: elem.h:2610
bool has_children() const
Definition: elem.h:2428
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2578
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ add_system()

void libMesh::DofObject::add_system ( )
inherited

Adds an additional system to the DofObject

Definition at line 195 of file dof_object.C.

References libMesh::DofObject::_idx_buf, libMesh::DofObject::n_systems(), libMesh::DofObject::n_var_groups(), libMesh::DofObject::n_vars(), and libMesh::DofObject::set_n_systems().

196 {
197  // quick return?
198  if (this->n_systems() == 0)
199  {
200  this->set_n_systems(1);
201  return;
202  }
203 
204  DofObject::index_buffer_t::iterator it = _idx_buf.begin();
205 
206  std::advance(it, this->n_systems());
207 
208  // this inserts the current vector size at the position for the new system - creating the
209  // entry we need for the new system indicating there are 0 variables.
210  _idx_buf.insert(it, cast_int<dof_id_type>(_idx_buf.size()));
211 
212  // cache this value before we screw it up!
213  const unsigned int ns_orig = this->n_systems();
214 
215  // increment the number of systems and the offsets for each of
216  // the systems including the new one we just added.
217  for (unsigned int i=0; i<ns_orig+1; i++)
218  _idx_buf[i]++;
219 
220  libmesh_assert_equal_to (this->n_systems(), (ns_orig+1));
221  libmesh_assert_equal_to (this->n_vars(ns_orig), 0);
222  libmesh_assert_equal_to (this->n_var_groups(ns_orig), 0);
223 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:758
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:768
unsigned int n_systems() const
Definition: dof_object.h:749
void set_n_systems(const unsigned int s)
Definition: dof_object.C:165
index_buffer_t _idx_buf
Definition: dof_object.h:508

◆ ancestor()

bool libMesh::Elem::ancestor ( ) const
Returns
true if the element is an ancestor (i.e. has an active child or ancestor child), false otherwise or when AMR is disabled.

Definition at line 1427 of file elem.C.

References active(), child_ref_range(), has_children(), libMesh::remote_elem, and subactive().

Referenced by libMesh::UnstructuredMesh::contract(), libMesh::UnstructuredMesh::find_neighbors(), get_info(), and refine().

1428 {
1429 #ifdef LIBMESH_ENABLE_AMR
1430 
1431  // Use a fast, DistributedMesh-safe definition
1432  const bool is_ancestor =
1433  !this->active() && !this->subactive();
1434 
1435  // But check for inconsistencies if we have time
1436 #ifdef DEBUG
1437  if (!is_ancestor && this->has_children())
1438  {
1439  for (auto & c : this->child_ref_range())
1440  {
1441  if (&c != remote_elem)
1442  {
1443  libmesh_assert(!c.active());
1444  libmesh_assert(!c.ancestor());
1445  }
1446  }
1447  }
1448 #endif // DEBUG
1449 
1450  return is_ancestor;
1451 
1452 #else
1453  return false;
1454 #endif
1455 }
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390
bool has_children() const
Definition: elem.h:2428
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ as_parent_node()

unsigned int libMesh::Elem::as_parent_node ( unsigned int  c,
unsigned int  n 
) const
virtual
Returns
The local node id on the parent which corresponds to node n of child c, or invalid_uint if no such parent node exists.

Definition at line 1933 of file elem.C.

References _get_parent_indices_cache(), child(), embedding_matrix(), embedding_matrix_version(), libMesh::invalid_uint, n_children(), n_nodes(), n_nodes_in_child(), and libMesh::parent_indices_mutex.

Referenced by libMesh::MeshRefinement::add_node(), and parent_bracketing_nodes().

1935 {
1936  const unsigned int nc = this->n_children();
1937  libmesh_assert_less(child, nc);
1938 
1939  // Cached return values, indexed first by embedding_matrix version,
1940  // then by child number, then by child node number.
1941  std::vector<std::vector<std::vector<signed char>>> &
1942  cached_parent_indices = this->_get_parent_indices_cache();
1943 
1944  unsigned int em_vers = this->embedding_matrix_version();
1945 
1946  // We may be updating the cache on one thread, and while that
1947  // happens we can't safely access the cache from other threads.
1948  Threads::spin_mutex::scoped_lock lock(parent_indices_mutex);
1949 
1950  if (em_vers >= cached_parent_indices.size())
1951  cached_parent_indices.resize(em_vers+1);
1952 
1953  if (child >= cached_parent_indices[em_vers].size())
1954  {
1955  const signed char nn = cast_int<signed char>(this->n_nodes());
1956 
1957  cached_parent_indices[em_vers].resize(nc);
1958 
1959  for (unsigned int c = 0; c != nc; ++c)
1960  {
1961  const unsigned int ncn = this->n_nodes_in_child(c);
1962  cached_parent_indices[em_vers][c].resize(ncn);
1963  for (unsigned int cn = 0; cn != ncn; ++cn)
1964  {
1965  for (signed char n = 0; n != nn; ++n)
1966  {
1967  const float em_val = this->embedding_matrix
1968  (c, cn, n);
1969  if (em_val == 1)
1970  {
1971  cached_parent_indices[em_vers][c][cn] = n;
1972  break;
1973  }
1974 
1975  if (em_val != 0)
1976  {
1977  cached_parent_indices[em_vers][c][cn] =
1978  -1;
1979  break;
1980  }
1981 
1982  // We should never see an all-zero embedding matrix
1983  // row
1984  libmesh_assert_not_equal_to (n+1, nn);
1985  }
1986  }
1987  }
1988  }
1989 
1990  const signed char cache_val =
1991  cached_parent_indices[em_vers][child][child_node];
1992  if (cache_val == -1)
1993  return libMesh::invalid_uint;
1994 
1995  return cached_parent_indices[em_vers][child][child_node];
1996 }
const unsigned int invalid_uint
Definition: libmesh.h:245
virtual unsigned int embedding_matrix_version() const
Definition: elem.h:1609
Threads::spin_mutex parent_indices_mutex
Definition: elem.C:85
virtual float embedding_matrix(const unsigned int child_num, const unsigned int child_node_num, const unsigned int parent_node_num) const =0
virtual unsigned int n_children() const =0
virtual std::vector< std::vector< std::vector< signed char > > > & _get_parent_indices_cache() const
Definition: elem.h:1673
virtual unsigned int n_nodes() const =0
Elem * child(const unsigned int i) const
Definition: elem.h:2598
virtual unsigned int n_nodes_in_child(unsigned int) const
Definition: elem.h:613

◆ boundary_sides_begin()

Elem::side_iterator libMesh::Elem::boundary_sides_begin ( )

Iterator accessor functions

Definition at line 2808 of file elem.C.

References _first_side(), and _last_side().

2809 {
2810  Predicates::BoundarySide<SideIter> bsp;
2811  return side_iterator(this->_first_side(), this->_last_side(), bsp);
2812 }
SideIter _last_side()
Definition: elem.h:2963
SideIter _first_side()
Definition: elem.h:2955

◆ boundary_sides_end()

Elem::side_iterator libMesh::Elem::boundary_sides_end ( )

Definition at line 2817 of file elem.C.

References _last_side().

2818 {
2819  Predicates::BoundarySide<SideIter> bsp;
2820  return side_iterator(this->_last_side(), this->_last_side(), bsp);
2821 }
SideIter _last_side()
Definition: elem.h:2963

◆ bracketing_nodes()

const std::vector< std::pair< dof_id_type, dof_id_type > > libMesh::Elem::bracketing_nodes ( unsigned int  c,
unsigned int  n 
) const
virtual
Returns
All the pairs of nodes (indexed by global node id) which should bracket node n of child c.

Definition at line 2206 of file elem.C.

References build(), child(), child_ptr(), default_order(), libMesh::FIRST, libMesh::HEX20, libMesh::DofObject::invalid_id, n_nodes(), n_nodes_in_child(), node_id(), parent_bracketing_nodes(), second_order_equivalent_type(), and type().

Referenced by libMesh::MeshRefinement::add_node(), and libMesh::TopologyMap::fill().

2208 {
2209  std::vector<std::pair<dof_id_type, dof_id_type>> returnval;
2210 
2211  const std::vector<std::pair<unsigned char, unsigned char>> & pbc =
2212  this->parent_bracketing_nodes(child,child_node);
2213 
2214  for (const auto & pb : pbc)
2215  {
2216  const unsigned short n_n = this->n_nodes();
2217  if (pb.first < n_n && pb.second < n_n)
2218  returnval.push_back(std::make_pair(this->node_id(pb.first),
2219  this->node_id(pb.second)));
2220  else
2221  {
2222  // We must be on a non-full-order higher order element...
2223  libmesh_assert_not_equal_to(this->default_order(), FIRST);
2224  libmesh_assert_not_equal_to
2225  (second_order_equivalent_type (this->type(), true),
2226  this->type());
2227  libmesh_assert_equal_to
2228  (second_order_equivalent_type (this->type(), false),
2229  this->type());
2230 
2231  // And that's a shame, because this is a nasty search:
2232 
2233  // Build the full-order type
2234  ElemType full_type =
2235  second_order_equivalent_type(this->type(), /*full_ordered=*/ true);
2236  std::unique_ptr<Elem> full_elem = Elem::build(full_type);
2237 
2240 
2241  // Find the bracketing nodes by figuring out what
2242  // already-created children will have them.
2243 
2244  // This only doesn't break horribly because we add children
2245  // and nodes in straightforward + hierarchical orders...
2246  for (unsigned int c=0; c <= child; ++c)
2247  for (unsigned int n=0; n != this->n_nodes_in_child(c); ++n)
2248  {
2249  if (c == child && n == child_node)
2250  break;
2251 
2252  if (pb.first == full_elem->as_parent_node(c,n))
2253  {
2254  // We should be consistent
2255  if (pt1 != DofObject::invalid_id)
2256  libmesh_assert_equal_to(pt1, this->child_ptr(c)->node_id(n));
2257 
2258  pt1 = this->child_ptr(c)->node_id(n);
2259  }
2260 
2261  if (pb.second == full_elem->as_parent_node(c,n))
2262  {
2263  // We should be consistent
2264  if (pt2 != DofObject::invalid_id)
2265  libmesh_assert_equal_to(pt2, this->child_ptr(c)->node_id(n));
2266 
2267  pt2 = this->child_ptr(c)->node_id(n);
2268  }
2269  }
2270 
2271  // We should *usually* find all bracketing nodes by the time
2272  // we query them (again, because of the child & node add
2273  // order)
2274  //
2275  // The exception is if we're a HEX20, in which case we will
2276  // find pairs of vertex nodes and edge nodes bracketing the
2277  // new central node but we *won't* find the pairs of face
2278  // nodes which we would have had on a HEX27. In that case
2279  // we'll still have enough bracketing nodes for a
2280  // topological lookup, but we won't be able to make the
2281  // following assertions.
2282  if (this->type() != HEX20)
2283  {
2284  libmesh_assert_not_equal_to (pt1, DofObject::invalid_id);
2285  libmesh_assert_not_equal_to (pt2, DofObject::invalid_id);
2286  }
2287 
2288  if (pt1 != DofObject::invalid_id &&
2289  pt2 != DofObject::invalid_id)
2290  returnval.push_back(std::make_pair(pt1, pt2));
2291  }
2292  }
2293 
2294  return returnval;
2295 }
virtual unsigned int n_nodes() const =0
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
Definition: elem.C:245
static const dof_id_type invalid_id
Definition: dof_object.h:347
static ElemType second_order_equivalent_type(const ElemType et, const bool full_ordered=true)
Definition: elem.C:2643
Elem * child(const unsigned int i) const
Definition: elem.h:2598
virtual Order default_order() const =0
virtual const std::vector< std::pair< unsigned char, unsigned char > > & parent_bracketing_nodes(unsigned int c, unsigned int n) const
Definition: elem.C:2001
virtual ElemType type() const =0
dof_id_type node_id(const unsigned int i) const
Definition: elem.h:1914
virtual unsigned int n_nodes_in_child(unsigned int) const
Definition: elem.h:613
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2578
uint8_t dof_id_type
Definition: id_types.h:64

◆ build()

std::unique_ptr< Elem > libMesh::Elem::build ( const ElemType  type,
Elem p = nullptr 
)
static
Returns
An Elem of type type wrapped in a smart pointer.

Definition at line 245 of file elem.C.

References libMesh::EDGE2, libMesh::EDGE3, libMesh::EDGE4, libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::INFEDGE2, libMesh::INFHEX16, libMesh::INFHEX18, libMesh::INFHEX8, libMesh::INFPRISM12, libMesh::INFPRISM6, libMesh::INFQUAD4, libMesh::INFQUAD6, libMesh::NODEELEM, libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM6, libMesh::PYRAMID13, libMesh::PYRAMID14, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::QUADSHELL4, libMesh::QUADSHELL8, libMesh::TET10, libMesh::TET4, libMesh::TRI3, libMesh::TRI3SUBDIVISION, libMesh::TRI6, libMesh::TRISHELL3, and type().

Referenced by libMesh::GMVIO::_read_one_cell(), libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::all_second_order(), bracketing_nodes(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTools::Modification::flatten(), parent_bracketing_nodes(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::AbaqusIO::read_elements(), libMesh::UCDIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::XdrIO::read_serialized_connectivity(), refine(), libMesh::Parallel::Packing< T >::unpack(), and libMesh::GMVIO::write_ascii_old_impl().

247 {
248  switch (type)
249  {
250  // 0D elements
251  case NODEELEM:
252  return libmesh_make_unique<NodeElem>(p);
253 
254  // 1D elements
255  case EDGE2:
256  return libmesh_make_unique<Edge2>(p);
257  case EDGE3:
258  return libmesh_make_unique<Edge3>(p);
259  case EDGE4:
260  return libmesh_make_unique<Edge4>(p);
261 
262  // 2D elements
263  case TRI3:
264  return libmesh_make_unique<Tri3>(p);
265  case TRISHELL3:
266  return libmesh_make_unique<TriShell3>(p);
267  case TRI3SUBDIVISION:
268  return libmesh_make_unique<Tri3Subdivision>(p);
269  case TRI6:
270  return libmesh_make_unique<Tri6>(p);
271  case QUAD4:
272  return libmesh_make_unique<Quad4>(p);
273  case QUADSHELL4:
274  return libmesh_make_unique<QuadShell4>(p);
275  case QUAD8:
276  return libmesh_make_unique<Quad8>(p);
277  case QUADSHELL8:
278  return libmesh_make_unique<QuadShell8>(p);
279  case QUAD9:
280  return libmesh_make_unique<Quad9>(p);
281 
282  // 3D elements
283  case TET4:
284  return libmesh_make_unique<Tet4>(p);
285  case TET10:
286  return libmesh_make_unique<Tet10>(p);
287  case HEX8:
288  return libmesh_make_unique<Hex8>(p);
289  case HEX20:
290  return libmesh_make_unique<Hex20>(p);
291  case HEX27:
292  return libmesh_make_unique<Hex27>(p);
293  case PRISM6:
294  return libmesh_make_unique<Prism6>(p);
295  case PRISM15:
296  return libmesh_make_unique<Prism15>(p);
297  case PRISM18:
298  return libmesh_make_unique<Prism18>(p);
299  case PYRAMID5:
300  return libmesh_make_unique<Pyramid5>(p);
301  case PYRAMID13:
302  return libmesh_make_unique<Pyramid13>(p);
303  case PYRAMID14:
304  return libmesh_make_unique<Pyramid14>(p);
305 
306 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
307  // 1D infinite elements
308  case INFEDGE2:
309  return libmesh_make_unique<InfEdge2>(p);
310 
311  // 2D infinite elements
312  case INFQUAD4:
313  return libmesh_make_unique<InfQuad4>(p);
314  case INFQUAD6:
315  return libmesh_make_unique<InfQuad6>(p);
316 
317  // 3D infinite elements
318  case INFHEX8:
319  return libmesh_make_unique<InfHex8>(p);
320  case INFHEX16:
321  return libmesh_make_unique<InfHex16>(p);
322  case INFHEX18:
323  return libmesh_make_unique<InfHex18>(p);
324  case INFPRISM6:
325  return libmesh_make_unique<InfPrism6>(p);
326  case INFPRISM12:
327  return libmesh_make_unique<InfPrism12>(p);
328 #endif
329 
330  default:
331  libmesh_error_msg("ERROR: Undefined element type!");
332  }
333 }
virtual ElemType type() const =0

◆ build_edge()

std::unique_ptr< Elem > libMesh::Elem::build_edge ( const unsigned int  i) const
inline

Creates an element coincident with edge i.

Deprecated:
This method will eventually be removed since it hands back a non-const pointer to an edge that could be used to indirectly modify this Elem. Please use the the const-correct build_edge_ptr() function instead.

Definition at line 2292 of file elem.h.

References build_edge_ptr().

2293 {
2294  // Call the const version of build_edge_ptr(), and const_cast the result.
2295  libmesh_deprecated();
2296  Elem * e = const_cast<Elem *>(this->build_edge_ptr(i).release());
2297  return std::unique_ptr<Elem>(e);
2298 }
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811
virtual std::unique_ptr< Elem > build_edge_ptr(const unsigned int i)=0

◆ build_edge_ptr() [1/2]

virtual std::unique_ptr<Elem> libMesh::Elem::build_edge_ptr ( const unsigned int  i)
pure virtual
Returns
An element coincident with edge i wrapped in a smart pointer.

The element returned is full-ordered. For example, calling build_edge_ptr(0) on a 20-noded hex will build a 3-noded edge coincident with edge 0 and pass back the pointer. A std::unique_ptr<Elem> is returned to prevent a memory leak. This way the user need not remember to delete the object.

The const version of this function is non-virtual; it simply calls the virtual non-const version and const_casts the return type.

Implemented in libMesh::Pyramid14, libMesh::Prism18, libMesh::Hex27, libMesh::RemoteElem, libMesh::InfQuad, libMesh::InfHex16, libMesh::Prism15, libMesh::Pyramid13, libMesh::Edge, libMesh::Hex20, libMesh::Tet10, libMesh::InfHex18, libMesh::InfPrism12, libMesh::Tet4, libMesh::InfPrism6, libMesh::InfHex8, libMesh::Hex8, libMesh::NodeElem, libMesh::Prism6, libMesh::Pyramid5, and libMesh::Face.

Referenced by build_edge(), build_edge_ptr(), libMesh::FE< Dim, LAGRANGE_VEC >::edge_reinit(), libMesh::ElemCutter::find_intersection_points(), and is_child_on_edge().

◆ build_edge_ptr() [2/2]

std::unique_ptr< const Elem > libMesh::Elem::build_edge_ptr ( const unsigned int  i) const
inline

Definition at line 2278 of file elem.h.

References build_edge_ptr().

2279 {
2280  // Call the non-const version of this function, return the result as
2281  // a std::unique_ptr<const Elem>.
2282  Elem * me = const_cast<Elem *>(this);
2283  const Elem * e = const_cast<const Elem *>(me->build_edge_ptr(i).release());
2284  return std::unique_ptr<const Elem>(e);
2285 }
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811

◆ build_side()

std::unique_ptr< Elem > libMesh::Elem::build_side ( const unsigned int  i,
bool  proxy = true 
) const
inline
Returns
A proxy element coincident with side i.
Deprecated:
This method will eventually be removed since it hands back a non-const pointer to a side that could be used to indirectly modify this. Please use the the const-correct build_side_ptr() function instead.

Definition at line 2243 of file elem.h.

References build_side_ptr().

2244 {
2245  // Call the const version of build_side_ptr(), and const_cast the result.
2246  libmesh_deprecated();
2247  Elem * s = const_cast<Elem *>(this->build_side_ptr(i, proxy).release());
2248  return std::unique_ptr<Elem>(s);
2249 }
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i, bool proxy=true)=0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811

◆ build_side_ptr() [1/4]

virtual std::unique_ptr<Elem> libMesh::Elem::build_side_ptr ( const unsigned int  i,
bool  proxy = true 
)
pure virtual
Returns
An element coincident with side i wrapped in a smart pointer.

The element returned is full-ordered, in contrast to the side method. For example, calling build_side_ptr(0) on a 20-noded hex will build a 8-noded quadrilateral coincident with face 0 and pass back the pointer. A std::unique_ptr<Elem> is returned to prevent a memory leak. This way the user need not remember to delete the object.

The second argument, which is true by default, specifies that a "proxy" element (of type Side) will be returned. This type of value is useful because it does not allocate additional memory, and is usually sufficient for FE calculation purposes. If you really need a full-ordered, non-proxy side object, call this function with proxy=false.

The const version of this function is non-virtual; it simply calls the virtual non-const version and const_casts the return type.

Implemented in libMesh::RemoteElem, libMesh::Pyramid14, libMesh::Prism18, libMesh::Hex27, libMesh::Quad9, libMesh::Edge, libMesh::Prism15, libMesh::Pyramid13, libMesh::Hex20, libMesh::Tri6, libMesh::Tet10, libMesh::InfHex16, libMesh::Quad8, libMesh::InfQuad6, libMesh::InfHex18, libMesh::Tet4, libMesh::InfPrism12, libMesh::NodeElem, libMesh::Hex8, libMesh::InfPrism6, libMesh::Tri3, libMesh::InfHex8, libMesh::Prism6, libMesh::Pyramid5, libMesh::InfQuad4, and libMesh::Quad4.

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::Elem::SideIter::_update_side_ptr(), libMesh::BoundaryInfo::add_elements(), libMesh::MeshTools::Modification::all_tri(), libMesh::Face::build_edge_ptr(), libMesh::InfQuad::build_edge_ptr(), libMesh::InfFE< Dim, T_radial, T_map >::Base::build_elem(), libMesh::InfElemBuilder::build_inf_elem(), build_side(), build_side_ptr(), libMesh::InfFE< Dim, T_radial, T_map >::compute_data(), libMesh::FEAbstract::compute_node_constraints(), libMesh::FEAbstract::compute_periodic_node_constraints(), libMesh::BoundaryInfo::get_side_and_node_maps(), libMesh::Cell::loose_bounding_box(), libMesh::PeriodicBoundaries::neighbor(), libMesh::PostscriptIO::plot_quadratic_elem(), libMesh::FE< Dim, LAGRANGE_VEC >::reinit(), libMesh::InfFE< Dim, T_radial, T_map >::reinit(), libMesh::FEXYZ< Dim >::reinit(), libMesh::InfFE< Dim, T_radial, T_map >::shape(), simple_build_side_ptr(), libMesh::MeshTools::Modification::smooth(), libMesh::FroIO::write(), and libMesh::GmshIO::write_mesh().

◆ build_side_ptr() [2/4]

std::unique_ptr< const Elem > libMesh::Elem::build_side_ptr ( const unsigned int  i,
bool  proxy = true 
) const
inline

Definition at line 2215 of file elem.h.

References build_side_ptr().

2216 {
2217  // Call the non-const version of this function, return the result as
2218  // a std::unique_ptr<const Elem>.
2219  Elem * me = const_cast<Elem *>(this);
2220  const Elem * s = const_cast<const Elem *>(me->build_side_ptr(i, proxy).release());
2221  return std::unique_ptr<const Elem>(s);
2222 }
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811

◆ build_side_ptr() [3/4]

virtual void libMesh::Elem::build_side_ptr ( std::unique_ptr< Elem > &  side,
const unsigned int  i 
)
pure virtual

Resets the loose element side, which may currently point to a different side than i or even a different element than this, to point to side i on this. If side is currently an element of the wrong type, it will be freed and a new element allocated; otherwise no memory allocation will occur.

This should not be called with proxy Side elements. This will cause side to be a full-ordered element, even if it is handed a lower-ordered element that must be replaced.

The const version of this function is non-virtual; it simply calls the virtual non-const version and const_casts the return type.

Implemented in libMesh::Pyramid14, libMesh::RemoteElem, libMesh::Prism18, libMesh::Hex27, libMesh::Quad9, libMesh::Edge, libMesh::Prism15, libMesh::Pyramid13, libMesh::Hex20, libMesh::Tri6, libMesh::InfHex16, libMesh::Tet10, libMesh::Quad8, libMesh::InfQuad6, libMesh::InfHex18, libMesh::Tet4, libMesh::InfPrism12, libMesh::InfPrism6, libMesh::NodeElem, libMesh::Hex8, libMesh::Tri3, libMesh::InfHex8, libMesh::Prism6, libMesh::Pyramid5, libMesh::InfQuad4, and libMesh::Quad4.

◆ build_side_ptr() [4/4]

void libMesh::Elem::build_side_ptr ( std::unique_ptr< const Elem > &  side,
const unsigned int  i 
) const
inline

Definition at line 2228 of file elem.h.

References build_side_ptr().

2230 {
2231  // Hand off to the non-const version of this function
2232  Elem * me = const_cast<Elem *>(this);
2233  std::unique_ptr<Elem> e {const_cast<Elem *>(elem.release())};
2234  me->build_side_ptr(e, i);
2235  elem.reset(e.release());
2236 }
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811

◆ centroid()

Point libMesh::Elem::centroid ( ) const
virtual
Returns
The centroid of the element. The centroid is computed as the average of all the element vertices.

This method is virtual since some derived elements might want to use shortcuts to compute their centroid.

Definition at line 344 of file elem.C.

References libMesh::TypeVector< T >::add(), and n_vertices().

Referenced by libMesh::UnstructuredMesh::find_neighbors(), libMesh::LocationMap< T >::point_of(), libMesh::FE< Dim, LAGRANGE_VEC >::shape(), libMesh::FE< Dim, LAGRANGE_VEC >::shape_deriv(), and libMesh::FE< Dim, LAGRANGE_VEC >::shape_second_deriv().

345 {
346  Point cp;
347 
348  for (unsigned int n=0; n<this->n_vertices(); n++)
349  cp.add (this->point(n));
350 
351  return (cp /= static_cast<Real>(this->n_vertices()));
352 }
virtual unsigned int n_vertices() const =0

◆ child()

Elem * libMesh::Elem::child ( const unsigned int  i) const
inline
Returns
A non-constant pointer to the $ i^{th} $ child for this element.
Deprecated:
Use the more accurately-named and const correct child_ptr() function instead.

Definition at line 2598 of file elem.h.

References child_ptr().

Referenced by as_parent_node(), bracketing_nodes(), find_interior_neighbors(), make_links_to_me_remote(), and parent_bracketing_nodes().

2599 {
2600  // Support the deprecated interface by calling the new,
2601  // const-correct interface and casting the result to an Elem *.
2602  libmesh_deprecated();
2603  return const_cast<Elem *>(this->child_ptr(i));
2604 }
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2578

◆ child_neighbor() [1/2]

Elem * libMesh::Elem::child_neighbor ( Elem elem)
inline
Returns
If elem is a neighbor of a child of this element, a pointer to that child, otherwise nullptr.

Definition at line 2105 of file elem.h.

References neighbor_ptr_range().

2106 {
2107  for (auto n : elem->neighbor_ptr_range())
2108  if (n && n->parent() == this)
2109  return n;
2110 
2111  return nullptr;
2112 }

◆ child_neighbor() [2/2]

const Elem * libMesh::Elem::child_neighbor ( const Elem elem) const
inline
Returns
If elem is a neighbor of a child of this element, a pointer to that child, otherwise nullptr.

Definition at line 2117 of file elem.h.

References neighbor_ptr_range().

2118 {
2119  for (auto n : elem->neighbor_ptr_range())
2120  if (n && n->parent() == this)
2121  return n;
2122 
2123  return nullptr;
2124 }

◆ child_ptr() [1/2]

const Elem * libMesh::Elem::child_ptr ( unsigned int  i) const
inline

◆ child_ptr() [2/2]

Elem * libMesh::Elem::child_ptr ( unsigned int  i)
inline
Returns
A non-constant pointer to the $ i^{th} $ child for this element. Do not call if this element has no children, i.e. is active.

Definition at line 2587 of file elem.h.

References _children.

2588 {
2589  libmesh_assert(_children);
2590  libmesh_assert(_children[i]);
2591 
2592  return _children[i];
2593 }
Elem ** _children
Definition: elem.h:1707

◆ child_ref_range() [1/2]

SimpleRange< Elem::ChildRefIter > libMesh::Elem::child_ref_range ( )
inline

Returns a range with all children of a parent element, usable in range-based for loops. The exact type of the return value here may be subject to change in future libMesh releases, but the iterators will always dereference to produce a reference to a child element.

Definition at line 1779 of file elem.h.

References _children, and n_children().

Referenced by active_family_tree(), active_family_tree_by_neighbor(), active_family_tree_by_topological_neighbor(), libMesh::HPCoarsenTest::add_projection(), ancestor(), libMesh::OldSolutionBase< Output, point_output >::check_old_context(), coarsen(), libMesh::FEGenericBase< FEOutputType< T >::type >::coarsened_dof_values(), libMesh::connect_children(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), family_tree(), family_tree_by_neighbor(), family_tree_by_subneighbor(), find_interior_neighbors(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), has_ancestor_children(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Elem >(), libMesh::MeshRefinement::make_coarsening_compatible(), make_links_to_me_remote(), libMesh::MeshRefinement::make_refinement_compatible(), max_descendant_p_level(), min_new_p_level_by_neighbor(), min_p_level_by_neighbor(), set_p_level(), libMesh::Partitioner::set_parent_processor_ids(), total_family_tree(), total_family_tree_by_neighbor(), and total_family_tree_by_subneighbor().

1780 {
1781  libmesh_assert(_children);
1782  return {_children, _children + this->n_children()};
1783 }
virtual unsigned int n_children() const =0
Elem ** _children
Definition: elem.h:1707

◆ child_ref_range() [2/2]

SimpleRange< Elem::ConstChildRefIter > libMesh::Elem::child_ref_range ( ) const
inline

Definition at line 1787 of file elem.h.

References _children, and n_children().

1788 {
1789  libmesh_assert(_children);
1790  return {_children, _children + this->n_children()};
1791 }
virtual unsigned int n_children() const =0
Elem ** _children
Definition: elem.h:1707

◆ clear_dofs()

void libMesh::DofObject::clear_dofs ( )
inlineinherited

Clear the DofMap data structures and return to a pristine state.

Definition at line 621 of file dof_object.h.

References libMesh::DofObject::_idx_buf, and libMesh::DofObject::n_systems().

Referenced by libMesh::DofObject::set_n_systems(), and libMesh::DofObject::~DofObject().

622 {
623  // vector swap trick to force deallocation
624  index_buffer_t().swap(_idx_buf);
625 
626  libmesh_assert_equal_to (this->n_systems(), 0);
627  libmesh_assert (_idx_buf.empty());
628 }
unsigned int n_systems() const
Definition: dof_object.h:749
std::vector< index_t > index_buffer_t
Definition: dof_object.h:507
index_buffer_t _idx_buf
Definition: dof_object.h:508

◆ clear_old_dof_object()

void libMesh::DofObject::clear_old_dof_object ( )
inherited

Sets the old_dof_object to nullptr

Definition at line 142 of file dof_object.C.

References libMesh::DofObject::old_dof_object.

Referenced by libMesh::DofObject::operator=(), libMesh::DofObject::set_old_dof_object(), libMesh::DofObject::unpack_indexing(), and libMesh::DofObject::~DofObject().

143 {
144  delete this->old_dof_object;
145  this->old_dof_object = nullptr;
146 }
DofObject * old_dof_object
Definition: dof_object.h:79

◆ close_to_point()

bool libMesh::Elem::close_to_point ( const Point p,
Real  tol 
) const
virtual
Returns
true if this element is "close" to the point p, where "close" is determined by the tolerance tol.

Definition at line 2326 of file elem.C.

References point_test().

2327 {
2328  // This test uses the user's passed-in tolerance for the
2329  // bounding box test as well, thereby allowing the routine to
2330  // find points which are not only "in" the element, but also
2331  // "nearby" to within some tolerance.
2332  return this->point_test(p, tol, tol);
2333 }
bool point_test(const Point &p, Real box_tol, Real map_tol) const
Definition: elem.C:2338

◆ coarsen()

void libMesh::Elem::coarsen ( )

Coarsen the element. This function is non-virtual since it is the same for all element types.

Definition at line 106 of file elem_refinement.C.

References active(), libMesh::TypeVector< T >::add_scaled(), child_ptr(), child_ref_range(), COARSEN, COARSEN_INACTIVE, embedding_matrix(), INACTIVE, JUST_COARSENED, n_children(), n_nodes(), point(), refinement_flag(), libMesh::remote_elem, set_p_level(), and set_refinement_flag().

107 {
108  libmesh_assert_equal_to (this->refinement_flag(), Elem::COARSEN_INACTIVE);
109  libmesh_assert (!this->active());
110 
111  // We no longer delete children until MeshRefinement::contract()
112  // delete [] _children;
113  // _children = nullptr;
114 
115  unsigned int parent_p_level = 0;
116 
117  // re-compute hanging node nodal locations
118  for (unsigned int c = 0, nc = this->n_children(); c != nc; ++c)
119  {
120  Elem * mychild = this->child_ptr(c);
121  if (mychild == remote_elem)
122  continue;
123  for (unsigned int cnode=0; cnode != mychild->n_nodes(); ++cnode)
124  {
125  Point new_pos;
126  bool calculated_new_pos = false;
127 
128  for (unsigned int n=0; n<this->n_nodes(); n++)
129  {
130  // The value from the embedding matrix
131  const float em_val = this->embedding_matrix(c,cnode,n);
132 
133  // The node location is somewhere between existing vertices
134  if ((em_val != 0.) && (em_val != 1.))
135  {
136  new_pos.add_scaled (this->point(n), em_val);
137  calculated_new_pos = true;
138  }
139  }
140 
141  if (calculated_new_pos)
142  {
143  //Move the existing node back into it's original location
144  for (unsigned int i=0; i<LIBMESH_DIM; i++)
145  {
146  Point & child_node = mychild->point(cnode);
147  child_node(i)=new_pos(i);
148  }
149  }
150  }
151  }
152 
153  for (auto & mychild : this->child_ref_range())
154  {
155  if (&mychild == remote_elem)
156  continue;
157  libmesh_assert_equal_to (mychild.refinement_flag(), Elem::COARSEN);
158  mychild.set_refinement_flag(Elem::INACTIVE);
159  if (mychild.p_level() > parent_p_level)
160  parent_p_level = mychild.p_level();
161  }
162 
164  this->set_p_level(parent_p_level);
165 
166  libmesh_assert (this->active());
167 }
void set_p_level(const unsigned int p)
Definition: elem.h:2692
RefinementState refinement_flag() const
Definition: elem.h:2638
void set_refinement_flag(const RefinementState rflag)
Definition: elem.h:2646
virtual float embedding_matrix(const unsigned int child_num, const unsigned int child_node_num, const unsigned int parent_node_num) const =0
virtual unsigned int n_children() const =0
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
virtual unsigned int n_nodes() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811
bool active() const
Definition: elem.h:2390
const Point & point(const unsigned int i) const
Definition: elem.h:1892
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2578
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ compute_key() [1/4]

◆ compute_key() [2/4]

dof_id_type libMesh::Elem::compute_key ( dof_id_type  n0,
dof_id_type  n1 
)
inlinestaticprotected
Returns
A hash key computed from two node ids.

Definition at line 2762 of file elem.h.

References libMesh::Utility::hashword2(), and swap().

2764 {
2765  // Order the two so that n0 < n1
2766  if (n0 > n1) std::swap (n0, n1);
2767 
2768  return Utility::hashword2(n0, n1);
2769 }
void swap(Iterator &lhs, Iterator &rhs)
uint32_t hashword2(const uint32_t &first, const uint32_t &second, uint32_t initval=0)
Definition: hashword.h:210

◆ compute_key() [3/4]

dof_id_type libMesh::Elem::compute_key ( dof_id_type  n0,
dof_id_type  n1,
dof_id_type  n2 
)
inlinestaticprotected
Returns
A hash key computed from three node ids.

Definition at line 2774 of file elem.h.

References libMesh::Utility::hashword(), and swap().

2777 {
2778  // Order the numbers such that n0 < n1 < n2.
2779  // We'll do it in 3 steps like this:
2780  //
2781  // n0 n1 n2
2782  // min(n0,n1) max(n0,n1) n2
2783  // min(n0,n1) min(n2,max(n0,n1) max(n2,max(n0,n1)
2784  // |\ /| |
2785  // | \ / | |
2786  // | / | |
2787  // | / \| |
2788  // gb min= min max gb max
2789 
2790  // Step 1
2791  if (n0 > n1) std::swap (n0, n1);
2792 
2793  // Step 2
2794  if (n1 > n2) std::swap (n1, n2);
2795 
2796  // Step 3
2797  if (n0 > n1) std::swap (n0, n1);
2798 
2799  libmesh_assert ((n0 < n1) && (n1 < n2));
2800 
2801  dof_id_type array[3] = {n0, n1, n2};
2802  return Utility::hashword(array, 3);
2803 }
uint32_t hashword(const uint32_t *k, size_t length, uint32_t initval=0)
Definition: hashword.h:153
void swap(Iterator &lhs, Iterator &rhs)
uint8_t dof_id_type
Definition: id_types.h:64

◆ compute_key() [4/4]

dof_id_type libMesh::Elem::compute_key ( dof_id_type  n0,
dof_id_type  n1,
dof_id_type  n2,
dof_id_type  n3 
)
inlinestaticprotected
Returns
A hash key computed from four node ids.

Definition at line 2808 of file elem.h.

References libMesh::Utility::hashword(), and swap().

2812 {
2813  // Sort first
2814  // Step 1
2815  if (n0 > n1) std::swap (n0, n1);
2816 
2817  // Step 2
2818  if (n2 > n3) std::swap (n2, n3);
2819 
2820  // Step 3
2821  if (n0 > n2) std::swap (n0, n2);
2822 
2823  // Step 4
2824  if (n1 > n3) std::swap (n1, n3);
2825 
2826  // Finally sort step 5
2827  if (n1 > n2) std::swap (n1, n2);
2828 
2829  libmesh_assert ((n0 < n1) && (n1 < n2) && (n2 < n3));
2830 
2831  dof_id_type array[4] = {n0, n1, n2, n3};
2832  return Utility::hashword(array, 4);
2833 }
uint32_t hashword(const uint32_t *k, size_t length, uint32_t initval=0)
Definition: hashword.h:153
void swap(Iterator &lhs, Iterator &rhs)
uint8_t dof_id_type
Definition: id_types.h:64

◆ connectivity()

◆ contains_edge_of()

bool libMesh::Elem::contains_edge_of ( const Elem e) const
Returns
true if an edge of e is contained in this element. (Internally, this is done by checking whether at least two vertices of e are contained in this element).

Definition at line 477 of file elem.C.

References contains_point(), n_vertices(), and point().

Referenced by find_edge_neighbors().

478 {
479  unsigned int num_contained_edges = 0;
480 
481  // Our vertices are the first numbered nodes
482  for (unsigned int n = 0; n != e->n_vertices(); ++n)
483  {
484  if (this->contains_point(e->point(n)))
485  {
486  num_contained_edges++;
487  if (num_contained_edges>=2)
488  {
489  return true;
490  }
491  }
492  }
493  return false;
494 }
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
Definition: elem.C:2301

◆ contains_point()

bool libMesh::Elem::contains_point ( const Point p,
Real  tol = TOLERANCE 
) const
virtual
Returns
true if the point p is contained in this element, false otherwise.

For linear elements, performs an initial tight bounding box check (as an optimization step) and (if that passes) then uses the user-defined tolerance "tol" in a call to inverse_map() to actually test if the point is in the element. For quadratic elements, the bounding box optimization is skipped, and only the inverse_map() steps are performed.

Note
This routine should not be used to determine if a point is merely "nearby" an element to within some tolerance. For that, use Elem::close_to_point() instead.

Reimplemented in libMesh::Tet4, libMesh::InfHex, libMesh::Tri3, libMesh::InfPrism, and libMesh::InfQuad4.

Definition at line 2301 of file elem.C.

References libMesh::err, point_test(), and libMesh::TOLERANCE.

Referenced by contains_edge_of(), contains_vertex_of(), find_edge_neighbors(), find_interior_neighbors(), find_point_neighbors(), libMesh::PointLocatorTree::operator()(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), and libMesh::System::point_value().

2302 {
2303  // We currently allow the user to enlarge the bounding box by
2304  // providing a tol > TOLERANCE (so this routine is identical to
2305  // Elem::close_to_point()), but print a warning so that the
2306  // user can eventually switch his code over to calling close_to_point()
2307  // instead, which is intended to be used for this purpose.
2308  if (tol > TOLERANCE)
2309  {
2310  libmesh_do_once(libMesh::err
2311  << "WARNING: Resizing bounding box to match user-specified tolerance!\n"
2312  << "In the future, calls to Elem::contains_point() with tol > TOLERANCE\n"
2313  << "will be more optimized, but should not be used\n"
2314  << "to search for points 'close to' elements!\n"
2315  << "Instead, use Elem::close_to_point() for this purpose.\n"
2316  << std::endl;);
2317  return this->point_test(p, tol, tol);
2318  }
2319  else
2320  return this->point_test(p, TOLERANCE, tol);
2321 }
static const Real TOLERANCE
bool point_test(const Point &p, Real box_tol, Real map_tol) const
Definition: elem.C:2338
OStreamProxy err(std::cerr)

◆ contains_vertex_of()

bool libMesh::Elem::contains_vertex_of ( const Elem e) const
Returns
true if a vertex of e is contained in this element.

Definition at line 466 of file elem.C.

References contains_point(), n_vertices(), and point().

Referenced by find_interior_neighbors(), and find_point_neighbors().

467 {
468  // Our vertices are the first numbered nodes
469  for (unsigned int n = 0; n != e->n_vertices(); ++n)
470  if (this->contains_point(e->point(n)))
471  return true;
472  return false;
473 }
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
Definition: elem.C:2301

◆ contract()

void libMesh::Elem::contract ( )

Contract an active element, i.e. remove pointers to any subactive children. This should only be called via MeshRefinement::contract, which will also remove subactive children from the mesh.

Definition at line 171 of file elem_refinement.C.

References _children, active(), DO_NOTHING, JUST_COARSENED, refinement_flag(), and set_refinement_flag().

Referenced by libMesh::UnstructuredMesh::contract().

172 {
173  // Subactive elements get deleted entirely, not contracted
174  libmesh_assert (this->active());
175 
176  // Active contracted elements no longer can have children
177  delete [] _children;
178  _children = nullptr;
179 
180  if (this->refinement_flag() == Elem::JUST_COARSENED)
182 }
RefinementState refinement_flag() const
Definition: elem.h:2638
void set_refinement_flag(const RefinementState rflag)
Definition: elem.h:2646
Elem ** _children
Definition: elem.h:1707
bool active() const
Definition: elem.h:2390

◆ debug_buffer()

void libMesh::DofObject::debug_buffer ( ) const
inherited

Print our buffer for debugging.

Definition at line 538 of file dof_object.C.

References libMesh::DofObject::_idx_buf, libMesh::MeshTools::Generation::Private::idx(), and libMesh::out.

539 {
540  libMesh::out << " [ ";
541  for (const auto & idx : _idx_buf)
542  libMesh::out << idx << " ";
543  libMesh::out << "]\n";
544 }
index_buffer_t _idx_buf
Definition: dof_object.h:508
OStreamProxy out(std::cout)
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)

◆ default_order()

◆ dim()

virtual unsigned short libMesh::Elem::dim ( ) const
pure virtual
Returns
The dimensionality of the object.

Implemented in libMesh::RemoteElem, libMesh::InfQuad, libMesh::NodeElem, libMesh::InfCell, libMesh::Edge, libMesh::Cell, and libMesh::Face.

Referenced by libMesh::DofMap::_dof_indices(), libMesh::GMVIO::_read_one_cell(), libMesh::AbaqusIO::assign_sideset_ids(), libMesh::AbaqusIO::assign_subdomain_ids(), libMesh::DiscontinuityMeasure::boundary_side_integration(), libMesh::KellyErrorEstimator::boundary_side_integration(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::FEMContext::build_new_fe(), libMesh::MeshBase::cache_elem_dims(), libMesh::FEGenericBase< FEOutputType< T >::type >::coarsened_dof_values(), libMesh::FEInterface::compute_constraints(), libMesh::FEAbstract::compute_node_constraints(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::FEAbstract::compute_periodic_node_constraints(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_proj_constraints(), libMesh::DofMap::constrain_p_dofs(), libMesh::MeshBase::detect_interior_parents(), libMesh::UNVIO::elements_in(), find_interior_neighbors(), get_info(), libMesh::MeshFunction::gradient(), libMesh::UNVIO::groups_in(), libMesh::MeshFunction::hessian(), libMesh::QComposite< QSubCell >::init(), interior_parent(), libMesh::LaplacianErrorEstimator::internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), libMesh::KellyErrorEstimator::internal_side_integration(), level(), libmesh_assert_valid_neighbors(), make_links_to_me_remote(), libMesh::DofMap::old_dof_indices(), libMesh::ElemCutter::operator()(), libMesh::MeshFunction::operator()(), libMesh::Parallel::Packing< T >::pack(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), point_test(), libMesh::System::point_value(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::UCDIO::read_implementation(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::FEMContext::set_elem(), set_interior_parent(), libMesh::ReplicatedMesh::stitching_helper(), libMesh::Parallel::Packing< T >::unpack(), and volume().

◆ disable_print_counter_info() [1/2]

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 106 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

Referenced by libMesh::LibMeshInit::LibMeshInit().

107 {
108  _enable_print_counter = false;
109  return;
110 }

◆ disable_print_counter_info() [2/2]

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 106 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

Referenced by libMesh::LibMeshInit::LibMeshInit().

107 {
108  _enable_print_counter = false;
109  return;
110 }

◆ dof_number() [1/2]

dof_id_type libMesh::DofObject::dof_number ( const unsigned int  s,
const unsigned int  var,
const unsigned int  comp 
) const
inlineinherited
Returns
The global degree of freedom number for variable var, component comp for system s associated with this DofObject

When partitioning and DoF numbering have been performed by libMesh, every current DoF on this DofObject will belong to its processor.

Definition at line 833 of file dof_object.h.

References libMesh::DofObject::n_comp(), libMesh::DofObject::n_comp_group(), libMesh::DofObject::n_systems(), libMesh::DofObject::n_vars(), and libMesh::DofObject::var_to_vg_and_offset().

Referenced by libMesh::DofMap::_dof_indices(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::DofMap::constrain_p_dofs(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::dof_indices(), libMesh::DofObject::DofObject(), libMesh::OldSolutionValue< Output, point_output >::eval_at_node(), libMesh::OldSolutionCoefs< Output, point_output >::eval_at_node(), libMesh::Node::get_info(), get_info(), libMesh::DofMap::local_variable_indices(), libMesh::DofMap::old_dof_indices(), libMesh::BuildProjectionList::operator()(), libMesh::DofObject::operator=(), libMesh::DofObject::print_dof_info(), libMesh::HPCoarsenTest::select_refinement(), libMesh::DofObject::set_dof_number(), and libMesh::DofMap::set_nonlocal_dof_objects().

836 {
837  libmesh_assert_less (s, this->n_systems());
838  libmesh_assert_less (var, this->n_vars(s));
839  libmesh_assert_less (comp, this->n_comp(s,var));
840 
841  const std::pair<unsigned int, unsigned int>
842  vg_vig = this->var_to_vg_and_offset(s,var);
843 
844  const unsigned int
845  n_comp = this->n_comp_group(s,vg_vig.first);
846 
847  return this->dof_number(s, vg_vig.first, vg_vig.second,
848  comp, n_comp);
849 }
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:833
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:803
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:768
unsigned int n_systems() const
Definition: dof_object.h:749
std::pair< unsigned int, unsigned int > var_to_vg_and_offset(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:887
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:816

◆ dof_number() [2/2]

dof_id_type libMesh::DofObject::dof_number ( const unsigned int  s,
const unsigned int  vg,
const unsigned int  vig,
const unsigned int  comp,
const unsigned int  n_comp 
) const
inlineinherited
Returns
The global degree of freedom number for variable group vg, variable index vig within the group, component comp out of n_comp, for system s on this DofObject

Even users who need to call dof_number from user code probably don't want to call this overload.

Definition at line 854 of file dof_object.h.

References libMesh::DofObject::_idx_buf, libMesh::DofObject::invalid_id, libMesh::DofObject::n_comp(), libMesh::DofObject::n_systems(), libMesh::DofObject::n_var_groups(), libMesh::DofObject::n_vars(), and libMesh::DofObject::start_idx().

859 {
860  libmesh_assert_less (s, this->n_systems());
861  libmesh_assert_less (vg, this->n_var_groups(s));
862  libmesh_assert_less (vig, this->n_vars(s,vg));
863 
864  const unsigned int
865  start_idx_sys = this->start_idx(s);
866 
867  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
868 
869  const dof_id_type
870  base_idx = _idx_buf[start_idx_sys + 2*vg + 1];
871 
872  // if the first component is invalid, they
873  // are all invalid
874  if (base_idx == invalid_id)
875  return invalid_id;
876 
877  // otherwise the index is the first component
878  // index augmented by the component number
879  else
880  return cast_int<dof_id_type>(base_idx + vig*n_comp + comp);
881 }
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:803
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:758
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:768
unsigned int n_systems() const
Definition: dof_object.h:749
static const dof_id_type invalid_id
Definition: dof_object.h:347
unsigned int start_idx(const unsigned int s) const
Definition: dof_object.h:936
index_buffer_t _idx_buf
Definition: dof_object.h:508
uint8_t dof_id_type
Definition: id_types.h:64

◆ edge_index_range()

IntRange< unsigned short > libMesh::Elem::edge_index_range ( ) const
inline
Returns
An integer range from 0 up to (but not including) the number of edges this element has.

Definition at line 2157 of file elem.h.

References n_edges().

Referenced by libMesh::FEGenericBase< FEOutputType< T >::type >::coarsened_dof_values(), libMesh::BoundaryInfo::copy_boundary_ids(), libMesh::Parallel::Packing< T >::pack(), and libMesh::Parallel::Packing< T >::unpack().

2158 {
2159  return {0, cast_int<unsigned short>(this->n_edges())};
2160 }
virtual unsigned int n_edges() const =0

◆ embedding_matrix()

◆ embedding_matrix_version()

virtual unsigned int libMesh::Elem::embedding_matrix_version ( ) const
inlinevirtual
Returns
A "version number" that identifies which embedding matrix is in use.

Some element types may use a different embedding matrix depending on their geometric characteristics.

Reimplemented in libMesh::Tet.

Definition at line 1609 of file elem.h.

Referenced by as_parent_node(), and parent_bracketing_nodes().

1609 { return 0; }

◆ enable_print_counter_info() [1/2]

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info()

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = true;
103  return;
104 }

◆ enable_print_counter_info() [2/2]

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info()

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = true;
103  return;
104 }

◆ family_tree()

void libMesh::Elem::family_tree ( std::vector< const Elem *> &  family,
const bool  reset = true 
) const

Fills the vector family with the children of this element, recursively. Calling this method on a twice-refined element will give you the element itself, its direct children, and their children, etc... When the optional parameter reset is true, the vector will be cleared before the element and its descendants are added.

The family tree only includes ancestor and active elements. To include subactive elements as well, use total_family_tree().

Definition at line 1534 of file elem.C.

References active(), child_ref_range(), and subactive().

1536 {
1537  // The "family tree" doesn't include subactive elements
1538  libmesh_assert(!this->subactive());
1539 
1540  // Clear the vector if the flag reset tells us to.
1541  if (reset)
1542  family.clear();
1543 
1544  // Add this element to the family tree.
1545  family.push_back(this);
1546 
1547  // Recurse into the elements children, if it has them.
1548  // Do not clear the vector any more.
1549  if (!this->active())
1550  for (auto & c : this->child_ref_range())
1551  if (!c.is_remote())
1552  c.family_tree (family, false);
1553 }
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390

◆ family_tree_by_neighbor()

void libMesh::Elem::family_tree_by_neighbor ( std::vector< const Elem *> &  family,
const Elem neighbor,
const bool  reset = true 
) const

Same as the family_tree() member, but only adds elements which are next to neighbor.

Definition at line 1661 of file elem.C.

References active(), child_ref_range(), has_neighbor(), libMesh::remote_elem, and subactive().

1664 {
1665  // The "family tree" doesn't include subactive elements
1666  libmesh_assert(!this->subactive());
1667 
1668  // Clear the vector if the flag reset tells us to.
1669  if (reset)
1670  family.clear();
1671 
1672  // This only makes sense if we're already a neighbor
1673  libmesh_assert (this->has_neighbor(neighbor_in));
1674 
1675  // Add this element to the family tree.
1676  family.push_back(this);
1677 
1678  // Recurse into the elements children, if it's not active.
1679  // Do not clear the vector any more.
1680  if (!this->active())
1681  for (auto & c : this->child_ref_range())
1682  if (&c != remote_elem && c.has_neighbor(neighbor_in))
1683  c.family_tree_by_neighbor (family, neighbor_in, false);
1684 }
bool has_neighbor(const Elem *elem) const
Definition: elem.h:2093
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ family_tree_by_side()

void libMesh::Elem::family_tree_by_side ( std::vector< const Elem *> &  family,
const unsigned int  side,
const bool  reset = true 
) const

Same as the family_tree() member, but only adds elements which are next to side.

Definition at line 1601 of file elem.C.

References active(), child_ptr(), family_tree_by_side(), is_child_on_side(), is_remote(), n_children(), n_sides(), and subactive().

Referenced by family_tree_by_side(), and make_links_to_me_local().

1604 {
1605  // The "family tree" doesn't include subactive elements
1606  libmesh_assert(!this->subactive());
1607 
1608  // Clear the vector if the flag reset tells us to.
1609  if (reset)
1610  family.clear();
1611 
1612  libmesh_assert_less (s, this->n_sides());
1613 
1614  // Add this element to the family tree.
1615  family.push_back(this);
1616 
1617  // Recurse into the elements children, if it has them.
1618  // Do not clear the vector any more.
1619  if (!this->active())
1620  {
1621  const unsigned int nc = this->n_children();
1622  for (unsigned int c = 0; c != nc; c++)
1623  if (!this->child_ptr(c)->is_remote() && this->is_child_on_side(c, s))
1624  this->child_ptr(c)->family_tree_by_side (family, s, false);
1625  }
1626 }
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const =0
virtual unsigned int n_children() const =0
void family_tree_by_side(std::vector< const Elem *> &family, const unsigned int side, const bool reset=true) const
Definition: elem.C:1601
virtual bool is_remote() const
Definition: elem.h:555
virtual unsigned int n_sides() const =0
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2578

◆ family_tree_by_subneighbor()

void libMesh::Elem::family_tree_by_subneighbor ( std::vector< const Elem *> &  family,
const Elem neighbor,
const Elem subneighbor,
const bool  reset = true 
) const

Same as the family_tree() member, but only adds elements which are next to subneighbor. Only applicable when this->has_neighbor(neighbor) and neighbor->is_ancestor(subneighbor)

Definition at line 1712 of file elem.C.

References active(), child_ref_range(), has_neighbor(), is_ancestor_of(), libMesh::remote_elem, and subactive().

1716 {
1717  // The "family tree" doesn't include subactive elements
1718  libmesh_assert(!this->subactive());
1719 
1720  // Clear the vector if the flag reset tells us to.
1721  if (reset)
1722  family.clear();
1723 
1724  // To simplify this function we need an existing neighbor
1725  libmesh_assert (neighbor_in);
1726  libmesh_assert_not_equal_to (neighbor_in, remote_elem);
1727  libmesh_assert (this->has_neighbor(neighbor_in));
1728 
1729  // This only makes sense if subneighbor descends from neighbor
1730  libmesh_assert (subneighbor);
1731  libmesh_assert_not_equal_to (subneighbor, remote_elem);
1732  libmesh_assert (neighbor_in->is_ancestor_of(subneighbor));
1733 
1734  // Add this element to the family tree if applicable.
1735  if (neighbor_in == subneighbor)
1736  family.push_back(this);
1737 
1738  // Recurse into the elements children, if it's not active.
1739  // Do not clear the vector any more.
1740  if (!this->active())
1741  for (auto & c : this->child_ref_range())
1742  if (&c != remote_elem)
1743  for (auto child_neigh : c.neighbor_ptr_range())
1744  if (child_neigh &&
1745  (child_neigh == neighbor_in ||
1746  (child_neigh->parent() == neighbor_in &&
1747  child_neigh->is_ancestor_of(subneighbor))))
1748  c.family_tree_by_subneighbor (family, child_neigh,
1749  subneighbor, false);
1750 }
bool has_neighbor(const Elem *elem) const
Definition: elem.h:2093
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ find_edge_neighbors() [1/2]

void libMesh::Elem::find_edge_neighbors ( const Point p1,
const Point p2,
std::set< const Elem *> &  neighbor_set 
) const

This function finds all active elements in the same manifold as this element which touch the current active element along the whole edge defined by the two points p1 and p2.

Definition at line 637 of file elem.C.

References contains_point(), end, and find_point_neighbors().

Referenced by libMesh::MeshRefinement::enforce_mismatch_limit_prior_to_refinement().

640 {
641  // Simple but perhaps suboptimal code: find elements containing the
642  // first point, then winnow this set down by removing elements which
643  // don't also contain the second point
644 
645  libmesh_assert(this->contains_point(p2));
646  this->find_point_neighbors(p1, neighbor_set);
647 
648  std::set<const Elem *>::iterator it = neighbor_set.begin();
649  const std::set<const Elem *>::iterator end = neighbor_set.end();
650 
651  while (it != end)
652  {
653  // As of C++11, set::erase returns an iterator to the element
654  // following the erased element, or end.
655  if (!(*it)->contains_point(p2))
656  it = neighbor_set.erase(it);
657  else
658  ++it;
659  }
660 }
IterBase * end
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
Definition: elem.C:2301
void find_point_neighbors(const Point &p, std::set< const Elem *> &neighbor_set) const
Definition: elem.C:498

◆ find_edge_neighbors() [2/2]

void libMesh::Elem::find_edge_neighbors ( std::set< const Elem *> &  neighbor_set) const

This function finds all active elements in the same manifold as this element which touch the current active element along any edge (more precisely, at at least two points).

In this case, elements are included even if they do not touch a whole edge of this element.

Definition at line 664 of file elem.C.

References contains_edge_of(), and libMesh::remote_elem.

665 {
666  neighbor_set.clear();
667  neighbor_set.insert(this);
668 
669  std::set<const Elem *> untested_set, next_untested_set;
670  untested_set.insert(this);
671 
672  while (!untested_set.empty())
673  {
674  // Loop over all the elements in the patch that haven't already
675  // been tested
676  for (const auto & elem : untested_set)
677  {
678  for (auto current_neighbor : elem->neighbor_ptr_range())
679  {
680  if (current_neighbor &&
681  current_neighbor != remote_elem) // we have a real neighbor on this side
682  {
683  if (current_neighbor->active()) // ... if it is active
684  {
685  if (this->contains_edge_of(current_neighbor) // ... and touches us
686  || current_neighbor->contains_edge_of(this))
687  {
688  // Make sure we'll test it
689  if (!neighbor_set.count(current_neighbor))
690  next_untested_set.insert (current_neighbor);
691 
692  // And add it
693  neighbor_set.insert (current_neighbor);
694  }
695  }
696 #ifdef LIBMESH_ENABLE_AMR
697  else // ... the neighbor is *not* active,
698  { // ... so add *all* neighboring
699  // active children
700  std::vector<const Elem *> active_neighbor_children;
701 
702  current_neighbor->active_family_tree_by_neighbor
703  (active_neighbor_children, elem);
704 
705  for (const auto & current_child : active_neighbor_children)
706  if (this->contains_edge_of(current_child) || current_child->contains_edge_of(this))
707  {
708  // Make sure we'll test it
709  if (!neighbor_set.count(current_child))
710  next_untested_set.insert (current_child);
711 
712  neighbor_set.insert (current_child);
713  }
714  }
715 #endif // #ifdef LIBMESH_ENABLE_AMR
716  }
717  }
718  }
719  untested_set.swap(next_untested_set);
720  next_untested_set.clear();
721  }
722 }
bool contains_edge_of(const Elem *e) const
Definition: elem.C:477
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ find_interior_neighbors()

void libMesh::Elem::find_interior_neighbors ( std::set< const Elem *> &  neighbor_set) const

This function finds all active elements (not including this one) in the parent manifold of this element whose intersection with this element has non-zero measure.

Definition at line 725 of file elem.C.

References active(), child(), child_ref_range(), contains_point(), contains_vertex_of(), dim(), end, find_point_neighbors(), interior_parent(), level(), node_ref_range(), and subactive().

Referenced by libMesh::MetisPartitioner::partition_range().

726 {
727  neighbor_set.clear();
728 
729  if ((this->dim() >= LIBMESH_DIM) ||
730  !this->interior_parent())
731  return;
732 
733  const Elem * ip = this->interior_parent();
734  libmesh_assert (ip->contains_vertex_of(this) ||
735  this->contains_vertex_of(ip));
736 
737  libmesh_assert (!ip->subactive());
738 
739 #ifdef LIBMESH_ENABLE_AMR
740  while (!ip->active()) // only possible with AMR, be careful because
741  { // ip->child_ptr(c) is only good with AMR.
742  for (auto & child : ip->child_ref_range())
743  {
744  if (child.contains_vertex_of(this) ||
745  this->contains_vertex_of(&child))
746  {
747  ip = &child;
748  break;
749  }
750  }
751  }
752 #endif
753 
754  this->find_point_neighbors(neighbor_set, ip);
755 
756  // Now we have all point neighbors from the interior manifold, but
757  // we need to weed out any neighbors that *only* intersect us at one
758  // point (or at one edge, if we're a 1-D element in 3D).
759  //
760  // The refinement hierarchy helps us here: if the interior element
761  // has a lower or equal refinement level then we can discard it iff
762  // it doesn't contain all our vertices. If it has a higher
763  // refinement level then we can discard it iff we don't contain at
764  // least dim()+1 of its vertices
765  std::set<const Elem *>::iterator it = neighbor_set.begin();
766  const std::set<const Elem *>::iterator end = neighbor_set.end();
767 
768  while (it != end)
769  {
770  std::set<const Elem *>::iterator current = it++;
771  const Elem * elem = *current;
772 
773  // This won't invalidate iterator it, because it is already
774  // pointing to the next element
775  if (elem->level() > this->level())
776  {
777  unsigned int vertices_contained = 0;
778  for (auto & n : elem->node_ref_range())
779  if (this->contains_point(n))
780  vertices_contained++;
781 
782  if (vertices_contained <= this->dim())
783  {
784  neighbor_set.erase(current);
785  continue;
786  }
787  }
788  else
789  {
790  for (auto & n : this->node_ref_range())
791  {
792  if (!elem->contains_point(n))
793  {
794  neighbor_set.erase(current);
795  break;
796  }
797  }
798  }
799  }
800 }
const Elem * interior_parent() const
Definition: elem.C:804
IterBase * end
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
Definition: elem.C:2301
void find_point_neighbors(const Point &p, std::set< const Elem *> &neighbor_set) const
Definition: elem.C:498
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811
bool contains_vertex_of(const Elem *e) const
Definition: elem.C:466
Elem * child(const unsigned int i) const
Definition: elem.h:2598
SimpleRange< NodeRefIter > node_ref_range()
Definition: elem.h:2130
unsigned int level() const
Definition: elem.h:2521
virtual unsigned short dim() const =0

◆ find_point_neighbors() [1/3]

void libMesh::Elem::find_point_neighbors ( const Point p,
std::set< const Elem *> &  neighbor_set 
) const

This function finds all active elements (including this one) which are in the same manifold as this element and which touch the current active element at the specified point, which should be a point in the current element.

Elements which are not "in the same manifold" (e.g. the interior_parent of a boundary element) will not be found with this method.

Elements which overlap the specified point but which are only connected to the current element via elements which do not overlap that point (e.g. in a folded or tangled mesh) are not considered to "touch" the current element and will not be found with this method.

Definition at line 498 of file elem.C.

References active(), contains_point(), and libMesh::remote_elem.

Referenced by libMesh::MeshRefinement::enforce_mismatch_limit_prior_to_refinement(), find_edge_neighbors(), libMesh::MeshFunction::find_element(), find_interior_neighbors(), find_point_neighbors(), and is_semilocal().

500 {
501  libmesh_assert(this->contains_point(p));
502  libmesh_assert(this->active());
503 
504  neighbor_set.clear();
505  neighbor_set.insert(this);
506 
507  std::set<const Elem *> untested_set, next_untested_set;
508  untested_set.insert(this);
509 
510  while (!untested_set.empty())
511  {
512  // Loop over all the elements in the patch that haven't already
513  // been tested
514  for (const auto & elem : untested_set)
515  for (auto current_neighbor : elem->neighbor_ptr_range())
516  {
517  if (current_neighbor &&
518  current_neighbor != remote_elem) // we have a real neighbor on this side
519  {
520  if (current_neighbor->active()) // ... if it is active
521  {
522  if (current_neighbor->contains_point(p)) // ... and touches p
523  {
524  // Make sure we'll test it
525  if (!neighbor_set.count(current_neighbor))
526  next_untested_set.insert (current_neighbor);
527 
528  // And add it
529  neighbor_set.insert (current_neighbor);
530  }
531  }
532 #ifdef LIBMESH_ENABLE_AMR
533  else // ... the neighbor is *not* active,
534  { // ... so add *all* neighboring
535  // active children that touch p
536  std::vector<const Elem *> active_neighbor_children;
537 
538  current_neighbor->active_family_tree_by_neighbor
539  (active_neighbor_children, elem);
540 
541  for (const auto & current_child : active_neighbor_children)
542  if (current_child->contains_point(p))
543  {
544  // Make sure we'll test it
545  if (!neighbor_set.count(current_child))
546  next_untested_set.insert (current_child);
547 
548  neighbor_set.insert (current_child);
549  }
550  }
551 #endif // #ifdef LIBMESH_ENABLE_AMR
552  }
553  }
554  untested_set.swap(next_untested_set);
555  next_untested_set.clear();
556  }
557 }
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
Definition: elem.C:2301
bool active() const
Definition: elem.h:2390
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ find_point_neighbors() [2/3]

void libMesh::Elem::find_point_neighbors ( std::set< const Elem *> &  neighbor_set) const

This function finds all active elements (including this one) in the same manifold as this element which touch this active element at any point.

Definition at line 561 of file elem.C.

References find_point_neighbors().

562 {
563  this->find_point_neighbors(neighbor_set, this);
564 }
void find_point_neighbors(const Point &p, std::set< const Elem *> &neighbor_set) const
Definition: elem.C:498

◆ find_point_neighbors() [3/3]

void libMesh::Elem::find_point_neighbors ( std::set< const Elem *> &  neighbor_set,
const Elem start_elem 
) const

This function finds all active elements (including this one) in the same manifold as start_elem (which must be active and must touch this element) which touch this element at any point.

Definition at line 568 of file elem.C.

References active(), contains_vertex_of(), and libMesh::remote_elem.

570 {
571  libmesh_assert(start_elem);
572  libmesh_assert(start_elem->active());
573  libmesh_assert(start_elem->contains_vertex_of(this) ||
574  this->contains_vertex_of(start_elem));
575 
576  neighbor_set.clear();
577  neighbor_set.insert(start_elem);
578 
579  std::set<const Elem *> untested_set, next_untested_set;
580  untested_set.insert(start_elem);
581 
582  while (!untested_set.empty())
583  {
584  // Loop over all the elements in the patch that haven't already
585  // been tested
586  for (const auto & elem : untested_set)
587  for (auto current_neighbor : elem->neighbor_ptr_range())
588  {
589  if (current_neighbor &&
590  current_neighbor != remote_elem) // we have a real neighbor on this side
591  {
592  if (current_neighbor->active()) // ... if it is active
593  {
594  if (this->contains_vertex_of(current_neighbor) // ... and touches us
595  || current_neighbor->contains_vertex_of(this))
596  {
597  // Make sure we'll test it
598  if (!neighbor_set.count(current_neighbor))
599  next_untested_set.insert (current_neighbor);
600 
601  // And add it
602  neighbor_set.insert (current_neighbor);
603  }
604  }
605 #ifdef LIBMESH_ENABLE_AMR
606  else // ... the neighbor is *not* active,
607  { // ... so add *all* neighboring
608  // active children
609  std::vector<const Elem *> active_neighbor_children;
610 
611  current_neighbor->active_family_tree_by_neighbor
612  (active_neighbor_children, elem);
613 
614  for (const auto & current_child : active_neighbor_children)
615  {
616  if (this->contains_vertex_of(current_child) ||
617  (current_child)->contains_vertex_of(this))
618  {
619  // Make sure we'll test it
620  if (!neighbor_set.count(current_child))
621  next_untested_set.insert (current_child);
622 
623  neighbor_set.insert (current_child);
624  }
625  }
626  }
627 #endif // #ifdef LIBMESH_ENABLE_AMR
628  }
629  }
630  untested_set.swap(next_untested_set);
631  next_untested_set.clear();
632  }
633 }
bool contains_vertex_of(const Elem *e) const
Definition: elem.C:466
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ first_order_equivalent_type()

ElemType libMesh::Elem::first_order_equivalent_type ( const ElemType  et)
static
Returns
The element type of the associated first-order element, or INVALID_ELEM for first-order or other elements that cannot be converted into lower order equivalents.

For example, when this is a TET10, then TET4 is returned.

Definition at line 2584 of file elem.C.

References libMesh::EDGE2, libMesh::EDGE3, libMesh::EDGE4, libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::INFHEX16, libMesh::INFHEX18, libMesh::INFHEX8, libMesh::INFPRISM12, libMesh::INFPRISM6, libMesh::INFQUAD4, libMesh::INFQUAD6, libMesh::INVALID_ELEM, libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM6, libMesh::PYRAMID13, libMesh::PYRAMID14, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::QUADSHELL4, libMesh::QUADSHELL8, libMesh::TET10, libMesh::TET4, libMesh::TRI3, libMesh::TRI6, and libMesh::TRISHELL3.

Referenced by libMesh::UnstructuredMesh::all_first_order(), and libMesh::GMVIO::write_ascii_old_impl().

2585 {
2586  switch (et)
2587  {
2588  case EDGE2:
2589  case EDGE3:
2590  case EDGE4:
2591  return EDGE2;
2592  case TRI3:
2593  case TRI6:
2594  return TRI3;
2595  case TRISHELL3:
2596  return TRISHELL3;
2597  case QUAD4:
2598  case QUAD8:
2599  case QUAD9:
2600  return QUAD4;
2601  case QUADSHELL4:
2602  case QUADSHELL8:
2603  return QUADSHELL4;
2604  case TET4:
2605  case TET10:
2606  return TET4;
2607  case HEX8:
2608  case HEX27:
2609  case HEX20:
2610  return HEX8;
2611  case PRISM6:
2612  case PRISM15:
2613  case PRISM18:
2614  return PRISM6;
2615  case PYRAMID5:
2616  case PYRAMID13:
2617  case PYRAMID14:
2618  return PYRAMID5;
2619 
2620 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
2621 
2622  case INFQUAD4:
2623  case INFQUAD6:
2624  return INFQUAD4;
2625  case INFHEX8:
2626  case INFHEX16:
2627  case INFHEX18:
2628  return INFHEX8;
2629  case INFPRISM6:
2630  case INFPRISM12:
2631  return INFPRISM6;
2632 
2633 #endif
2634 
2635  default:
2636  // unknown element
2637  return INVALID_ELEM;
2638  }
2639 }

◆ get_info() [1/3]

std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().

Referenced by libMesh::ReferenceCounter::print_info().

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (const auto & pr : _counts)
59  {
60  const std::string name(pr.first);
61  const unsigned int creations = pr.second.first;
62  const unsigned int destructions = pr.second.second;
63 
64  oss << "| " << name << " reference count information:\n"
65  << "| Creations: " << creations << '\n'
66  << "| Destructions: " << destructions << '\n';
67  }
68 
69  oss << " ---------------------------------------------------------------------------- \n";
70 
71  return oss.str();
72 
73 #else
74 
75  return "";
76 
77 #endif
78 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42

◆ get_info() [2/3]

std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().

Referenced by libMesh::ReferenceCounter::print_info().

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (const auto & pr : _counts)
59  {
60  const std::string name(pr.first);
61  const unsigned int creations = pr.second.first;
62  const unsigned int destructions = pr.second.second;
63 
64  oss << "| " << name << " reference count information:\n"
65  << "| Creations: " << creations << '\n'
66  << "| Destructions: " << destructions << '\n';
67  }
68 
69  oss << " ---------------------------------------------------------------------------- \n";
70 
71  return oss.str();
72 
73 #else
74 
75  return "";
76 
77 #endif
78 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42

◆ get_info() [3/3]

std::string libMesh::Elem::get_info ( ) const

Prints relevant information about the element to a string.

Definition at line 2448 of file elem.C.

References active(), ancestor(), dim(), libMesh::DofObject::dof_number(), libMesh::Utility::enum_to_string(), has_children(), hmax(), hmin(), libMesh::DofObject::id(), infinite(), level(), libMesh::DofObject::n_comp(), n_nodes(), n_sides(), libMesh::DofObject::n_systems(), libMesh::DofObject::n_vars(), neighbor_ptr(), node_ref(), origin(), p_level(), p_refinement_flag(), parent(), libMesh::DofObject::processor_id(), refinement_flag(), subactive(), type(), libMesh::DofObject::unique_id(), libMesh::DofObject::valid_id(), libMesh::DofObject::valid_unique_id(), and volume().

Referenced by print_info().

2449 {
2450  std::ostringstream oss;
2451 
2452  oss << " Elem Information" << '\n'
2453  << " id()=";
2454 
2455  if (this->valid_id())
2456  oss << this->id();
2457  else
2458  oss << "invalid";
2459 
2460 #ifdef LIBMESH_ENABLE_UNIQUE_ID
2461  oss << ", unique_id()=";
2462  if (this->valid_unique_id())
2463  oss << this->unique_id();
2464  else
2465  oss << "invalid";
2466 #endif
2467 
2468  oss << ", processor_id()=" << this->processor_id() << '\n';
2469 
2470  oss << " type()=" << Utility::enum_to_string(this->type()) << '\n'
2471  << " dim()=" << this->dim() << '\n'
2472  << " n_nodes()=" << this->n_nodes() << '\n';
2473 
2474  for (unsigned int n=0; n != this->n_nodes(); ++n)
2475  oss << " " << n << this->node_ref(n);
2476 
2477  oss << " n_sides()=" << this->n_sides() << '\n';
2478 
2479  for (unsigned int s=0; s != this->n_sides(); ++s)
2480  {
2481  oss << " neighbor(" << s << ")=";
2482  if (this->neighbor_ptr(s))
2483  oss << this->neighbor_ptr(s)->id() << '\n';
2484  else
2485  oss << "nullptr\n";
2486  }
2487 
2488 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
2489  if (!this->infinite())
2490  {
2491 #endif
2492  oss << " hmin()=" << this->hmin()
2493  << ", hmax()=" << this->hmax() << '\n'
2494  << " volume()=" << this->volume() << '\n';
2495 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
2496  }
2497 #endif
2498  oss << " active()=" << this->active()
2499  << ", ancestor()=" << this->ancestor()
2500  << ", subactive()=" << this->subactive()
2501  << ", has_children()=" << this->has_children() << '\n'
2502  << " parent()=";
2503  if (this->parent())
2504  oss << this->parent()->id() << '\n';
2505  else
2506  oss << "nullptr\n";
2507  oss << " level()=" << this->level()
2508  << ", p_level()=" << this->p_level() << '\n'
2509 #ifdef LIBMESH_ENABLE_AMR
2510  << " refinement_flag()=" << Utility::enum_to_string(this->refinement_flag()) << '\n'
2511  << " p_refinement_flag()=" << Utility::enum_to_string(this->p_refinement_flag()) << '\n'
2512 #endif
2513 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
2514  << " infinite()=" << this->infinite() << '\n';
2515  if (this->infinite())
2516  oss << " origin()=" << this->origin() << '\n'
2517 #endif
2518  ;
2519 
2520  oss << " DoFs=";
2521  for (unsigned int s=0; s != this->n_systems(); ++s)
2522  for (unsigned int v=0; v != this->n_vars(s); ++v)
2523  for (unsigned int c=0; c != this->n_comp(s,v); ++c)
2524  oss << '(' << s << '/' << v << '/' << this->dof_number(s,v,c) << ") ";
2525 
2526 
2527  return oss.str();
2528 }
RefinementState refinement_flag() const
Definition: elem.h:2638
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:833
const Elem * parent() const
Definition: elem.h:2479
virtual Point origin() const
Definition: elem.h:1553
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:803
RefinementState p_refinement_flag() const
Definition: elem.h:2654
unique_id_type unique_id() const
Definition: dof_object.h:672
unsigned int p_level() const
Definition: elem.h:2555
virtual Real hmax() const
Definition: elem.C:373
bool ancestor() const
Definition: elem.C:1427
const Node & node_ref(const unsigned int i) const
Definition: elem.h:1979
dof_id_type id() const
Definition: dof_object.h:655
virtual Real hmin() const
Definition: elem.C:356
virtual unsigned int n_nodes() const =0
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:768
unsigned int n_systems() const
Definition: dof_object.h:749
bool valid_unique_id() const
Definition: dof_object.h:705
std::string enum_to_string(const T e)
virtual unsigned int n_sides() const =0
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:2050
unsigned int level() const
Definition: elem.h:2521
bool valid_id() const
Definition: dof_object.h:697
virtual unsigned short dim() const =0
bool subactive() const
Definition: elem.h:2408
virtual Real volume() const
Definition: elem.C:2826
virtual bool infinite() const =0
bool active() const
Definition: elem.h:2390
processor_id_type processor_id() const
Definition: dof_object.h:717
virtual ElemType type() const =0
bool has_children() const
Definition: elem.h:2428

◆ get_node()

Node * libMesh::Elem::get_node ( const unsigned int  i) const
inline
Returns
The pointer to local Node i.
Deprecated:
Use the less ambiguously named node_ptr() instead.

Definition at line 1996 of file elem.h.

References node_ptr().

1997 {
1998  // This const function has incorrectly returned a non-const pointer
1999  // for years. Now that it is reimplemented in terms of the new
2000  // interface which does return a const pointer, we need to use a
2001  // const_cast to mimic the old (incorrect) behavior. This function
2002  // is now deprecated and eventually will be removed entirely,
2003  // obviating the need for this ugly cast.
2004  libmesh_deprecated();
2005  return const_cast<Node *>(this->node_ptr(i));
2006 }
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:1957

◆ get_node_index()

unsigned int libMesh::Elem::get_node_index ( const Node node_ptr) const
inline
Returns
The local index for the Node pointer node_ptr, or invalid_id if node_ptr is not a local node.

Definition at line 2012 of file elem.h.

References _nodes, libMesh::invalid_uint, n_nodes(), and node_ptr().

Referenced by libMesh::ElemCutter::find_intersection_points().

2013 {
2014  for (unsigned int n=0; n != this->n_nodes(); ++n)
2015  if (this->_nodes[n] == node_ptr)
2016  return n;
2017 
2018  return libMesh::invalid_uint;
2019 }
Node ** _nodes
Definition: elem.h:1695
const unsigned int invalid_uint
Definition: libmesh.h:245
virtual unsigned int n_nodes() const =0
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:1957

◆ get_nodes()

const Node *const * libMesh::Elem::get_nodes ( ) const
inline
Returns
A pointer to an array of local node pointers.

Definition at line 1949 of file elem.h.

References _nodes.

Referenced by libMesh::DofMap::dof_indices(), and libMesh::DofMap::old_dof_indices().

1950 {
1951  return _nodes;
1952 }
Node ** _nodes
Definition: elem.h:1695

◆ hack_p_level()

void libMesh::Elem::hack_p_level ( const unsigned int  p)
inline

Sets the value of the p-refinement level for the element without altering the p-level of its ancestors

Definition at line 2739 of file elem.h.

References _p_level, JUST_REFINED, and p_refinement_flag().

Referenced by libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_serialized_connectivity(), and libMesh::Parallel::Packing< T >::unpack().

2740 {
2741  if (p == 0)
2742  libmesh_assert_not_equal_to
2744 
2745  _p_level = cast_int<unsigned char>(p);
2746 }
unsigned char _p_level
Definition: elem.h:1736
RefinementState p_refinement_flag() const
Definition: elem.h:2654

◆ has_affine_map()

virtual bool libMesh::Elem::has_affine_map ( ) const
inlinevirtual
Returns
true if the element map is definitely affine (i.e. the same at every quadrature point) within numerical tolerances.

Reimplemented in libMesh::NodeElem, libMesh::Pyramid14, libMesh::Prism15, libMesh::Prism18, libMesh::Pyramid13, libMesh::Hex20, libMesh::Hex27, libMesh::Tet10, libMesh::Tet4, libMesh::Tri6, libMesh::Hex8, libMesh::Quad8, libMesh::Quad9, libMesh::Tri3, libMesh::Edge4, libMesh::Prism6, libMesh::Pyramid5, libMesh::Edge3, libMesh::Quad4, libMesh::Edge2, and libMesh::Tri3Subdivision.

Definition at line 988 of file elem.h.

Referenced by libMesh::FEMap::compute_map().

988 { return false; }

◆ has_ancestor_children()

bool libMesh::Elem::has_ancestor_children ( ) const
inline
Returns
true if the element has any descendants other than its immediate children, false otherwise, or if AMR is disabled.

Definition at line 2442 of file elem.h.

References _children, and child_ref_range().

2443 {
2444 #ifdef LIBMESH_ENABLE_AMR
2445  if (_children == nullptr)
2446  return false;
2447  else
2448  for (auto & c : child_ref_range())
2449  if (c.has_children())
2450  return true;
2451 #endif
2452  return false;
2453 }
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
Elem ** _children
Definition: elem.h:1707

◆ has_children()

◆ has_dofs()

bool libMesh::DofObject::has_dofs ( const unsigned int  s = libMesh::invalid_uint) const
inlineinherited
Returns
true if any system has variables which have been assigned, false otherwise.

Definition at line 913 of file dof_object.h.

References libMesh::invalid_uint, libMesh::DofObject::n_systems(), and libMesh::DofObject::n_vars().

Referenced by libMesh::DofMap::old_dof_indices(), and libMesh::DofMap::reinit().

914 {
915  if (sys == libMesh::invalid_uint)
916  {
917  for (unsigned int s=0; s<this->n_systems(); s++)
918  if (this->n_vars(s))
919  return true;
920  }
921 
922  else
923  {
924  libmesh_assert_less (sys, this->n_systems());
925 
926  if (this->n_vars(sys))
927  return true;
928  }
929 
930  return false;
931 }
const unsigned int invalid_uint
Definition: libmesh.h:245
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:768
unsigned int n_systems() const
Definition: dof_object.h:749

◆ has_neighbor()

bool libMesh::Elem::has_neighbor ( const Elem elem) const
inline
Returns
true if the element elem in question is a neighbor of this element, false otherwise.

Definition at line 2093 of file elem.h.

References neighbor_ptr_range().

Referenced by active_family_tree_by_neighbor(), family_tree_by_neighbor(), family_tree_by_subneighbor(), has_topological_neighbor(), libMesh::MeshRefinement::has_topological_neighbor(), min_new_p_level_by_neighbor(), min_p_level_by_neighbor(), on_boundary(), total_family_tree_by_neighbor(), and total_family_tree_by_subneighbor().

2094 {
2095  for (auto n : this->neighbor_ptr_range())
2096  if (n == elem)
2097  return true;
2098 
2099  return false;
2100 }
SimpleRange< NeighborPtrIter > neighbor_ptr_range()
Definition: elem.h:2988

◆ has_topological_neighbor()

bool libMesh::Elem::has_topological_neighbor ( const Elem elem,
const MeshBase mesh,
const PointLocatorBase point_locator,
const PeriodicBoundaries pb 
) const
Returns
true if the element elem in question is a neighbor or topological neighbor of this element, false otherwise.

Definition at line 957 of file elem.C.

References has_neighbor(), mesh, side_index_range(), and topological_neighbor().

Referenced by active_family_tree_by_topological_neighbor(), and libMesh::MeshRefinement::has_topological_neighbor().

961 {
962  // First see if this is a normal "interior" neighbor
963  if (has_neighbor(elem))
964  return true;
965 
966  for (auto n : this->side_index_range())
967  if (this->topological_neighbor(n, mesh, point_locator, pb))
968  return true;
969 
970  return false;
971 }
bool has_neighbor(const Elem *elem) const
Definition: elem.h:2093
const Elem * topological_neighbor(const unsigned int i, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb) const
Definition: elem.C:920
IntRange< unsigned short > side_index_range() const
Definition: elem.h:2166
MeshBase & mesh

◆ hmax()

Real libMesh::Elem::hmax ( ) const
virtual
Returns
The maximum vertex separation for the element.

Definition at line 373 of file elem.C.

References std::max(), n_vertices(), libMesh::TypeVector< T >::norm_sq(), point(), and libMesh::Real.

Referenced by libMesh::DiscontinuityMeasure::boundary_side_integration(), libMesh::KellyErrorEstimator::boundary_side_integration(), libMesh::OldSolutionBase< Output, point_output >::check_old_context(), get_info(), libMesh::LaplacianErrorEstimator::internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), libMesh::KellyErrorEstimator::internal_side_integration(), and point_test().

374 {
375  Real h_max=0;
376 
377  for (unsigned int n_outer=0; n_outer<this->n_vertices(); n_outer++)
378  for (unsigned int n_inner=n_outer+1; n_inner<this->n_vertices(); n_inner++)
379  {
380  const Point diff = (this->point(n_outer) - this->point(n_inner));
381 
382  h_max = std::max(h_max, diff.norm_sq());
383  }
384 
385  return std::sqrt(h_max);
386 }
long double max(long double a, double b)
virtual unsigned int n_vertices() const =0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Point & point(const unsigned int i) const
Definition: elem.h:1892

◆ hmin()

Real libMesh::Elem::hmin ( ) const
virtual
Returns
The minimum vertex separation for the element.

Definition at line 356 of file elem.C.

References std::max(), std::min(), n_vertices(), libMesh::TypeVector< T >::norm_sq(), point(), and libMesh::Real.

Referenced by libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::MeshTools::Modification::distort(), libMesh::UnstructuredMesh::find_neighbors(), get_info(), libMesh::FEMSystem::numerical_jacobian(), and libMesh::ReplicatedMesh::stitching_helper().

357 {
359 
360  for (unsigned int n_outer=0; n_outer<this->n_vertices(); n_outer++)
361  for (unsigned int n_inner=n_outer+1; n_inner<this->n_vertices(); n_inner++)
362  {
363  const Point diff = (this->point(n_outer) - this->point(n_inner));
364 
365  h_min = std::min(h_min, diff.norm_sq());
366  }
367 
368  return std::sqrt(h_min);
369 }
long double max(long double a, double b)
virtual unsigned int n_vertices() const =0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
long double min(long double a, double b)
const Point & point(const unsigned int i) const
Definition: elem.h:1892

◆ id()

dof_id_type libMesh::DofObject::id ( ) const
inlineinherited
Returns
The id for this DofObject

Definition at line 655 of file dof_object.h.

References libMesh::DofObject::_id, and libMesh::DofObject::valid_id().

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::MeshTools::Subdivision::add_boundary_ghosts(), libMesh::ReplicatedMesh::add_elem(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::TopologyMap::add_node(), libMesh::ReplicatedMesh::add_node(), libMesh::DistributedMesh::add_node(), libMesh::DistributedMesh::add_point(), libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::Node::build(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::FEMap::compute_single_point_map(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::ReplicatedMesh::delete_elem(), libMesh::DistributedMesh::delete_elem(), libMesh::ReplicatedMesh::delete_node(), libMesh::DistributedMesh::delete_node(), libMesh::MeshBase::detect_interior_parents(), libMesh::DistributedMesh::DistributedMesh(), libMesh::UNVIO::elements_out(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshTools::find_nodal_neighbors(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshTools::Modification::flatten(), libMesh::Node::get_info(), get_info(), libMesh::DofMap::get_local_constraints(), libMesh::ParmetisPartitioner::initialize(), libMesh::TreeNode< N >::insert(), libMesh::ReplicatedMesh::insert_elem(), libMesh::DistributedMesh::insert_elem(), libMesh::ReplicatedMesh::insert_node(), libMesh::FE< Dim, LAGRANGE_VEC >::inverse_map(), libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::Tri3Subdivision::local_node_number(), node_id(), libMesh::VTKIO::nodes_to_vtk(), libMesh::CompareElemIdsByLevel::operator()(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::DistributedMesh::own_node(), libMesh::Parallel::Packing< T >::pack(), libMesh::MetisPartitioner::partition_range(), libMesh::DofObject::print_dof_info(), libMesh::DistributedMesh::query_elem_ptr(), libMesh::DistributedMesh::query_node_ptr(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::AbaqusIO::read_elements(), libMesh::DistributedMesh::renumber_elem(), libMesh::DistributedMesh::renumber_node(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::DofMap::scatter_constraints(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::MeshTools::Modification::smooth(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::sync_dofobject_data_by_id(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id_once(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::Parallel::Packing< T >::unpack(), libMesh::GmshIO::write_mesh(), and libMesh::ExodusII_IO_Helper::write_nodal_coordinates().

656 {
657  libmesh_assert (this->valid_id());
658  return _id;
659 }
dof_id_type _id
Definition: dof_object.h:442
bool valid_id() const
Definition: dof_object.h:697

◆ increment_constructor_count() [1/2]

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectedinherited

Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.

Definition at line 181 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

182 {
183  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
184  std::pair<unsigned int, unsigned int> & p = _counts[name];
185 
186  p.first++;
187 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
spin_mutex spin_mtx
Definition: threads.C:29

◆ increment_constructor_count() [2/2]

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectedinherited

Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.

Definition at line 181 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

182 {
183  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
184  std::pair<unsigned int, unsigned int> & p = _counts[name];
185 
186  p.first++;
187 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
spin_mutex spin_mtx
Definition: threads.C:29

◆ increment_destructor_count() [1/2]

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectedinherited

Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.

Definition at line 194 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

195 {
196  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
197  std::pair<unsigned int, unsigned int> & p = _counts[name];
198 
199  p.second++;
200 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
spin_mutex spin_mtx
Definition: threads.C:29

◆ increment_destructor_count() [2/2]

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectedinherited

Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.

Definition at line 194 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

195 {
196  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
197  std::pair<unsigned int, unsigned int> & p = _counts[name];
198 
199  p.second++;
200 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
spin_mutex spin_mtx
Definition: threads.C:29

◆ infinite()

◆ interior_parent() [1/2]

const Elem * libMesh::Elem::interior_parent ( ) const
Returns
The higher-dimensional Elem for which this Elem is a face.

In some cases it is desirable to extract the boundary (or a subset thereof) of a D-dimensional mesh as a (D-1)-dimensional manifold. In this case we may want to know the 'parent' element from which the manifold elements were extracted. We can easily do that for the level-0 manifold elements by storing the D-dimensional parent. This method provides access to that element.

This method is not safe to call if this->dim() == LIBMESH_DIM; in such cases no data storage for an interior parent pointer has been allocated.

Definition at line 804 of file elem.C.

References _elemlinks, dim(), level(), n_sides(), and libMesh::remote_elem.

Referenced by find_interior_neighbors(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::BoundaryInfo::get_side_and_node_maps(), libMesh::MeshTools::libmesh_assert_valid_amr_interior_parents(), libMesh::Parallel::Packing< T >::pack(), and libMesh::Parallel::Packing< T >::unpack().

805 {
806  // interior parents make no sense for full-dimensional elements.
807  libmesh_assert_less (this->dim(), LIBMESH_DIM);
808 
809  // they USED TO BE only good for level-0 elements, but we now
810  // support keeping interior_parent() valid on refined boundary
811  // elements.
812  // if (this->level() != 0)
813  // return this->parent()->interior_parent();
814 
815  // We store the interior_parent pointer after both the parent
816  // neighbor and neighbor pointers
817  Elem * interior_p = _elemlinks[1+this->n_sides()];
818 
819  // If we have an interior_parent, we USED TO assume it was a
820  // one-higher-dimensional interior element, but we now allow e.g.
821  // edge elements to have a 3D interior_parent with no
822  // intermediate 2D element.
823  // libmesh_assert (!interior_p ||
824  // interior_p->dim() == (this->dim()+1));
825  libmesh_assert (!interior_p ||
826  (interior_p == remote_elem) ||
827  (interior_p->dim() > this->dim()));
828 
829  // We require consistency between AMR of interior and of boundary
830  // elements
831  if (interior_p && (interior_p != remote_elem))
832  libmesh_assert_less_equal (interior_p->level(), this->level());
833 
834  return interior_p;
835 }
Elem ** _elemlinks
Definition: elem.h:1701
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811
virtual unsigned int n_sides() const =0
unsigned int level() const
Definition: elem.h:2521
virtual unsigned short dim() const =0
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ interior_parent() [2/2]

Elem * libMesh::Elem::interior_parent ( )

Definition at line 839 of file elem.C.

References _elemlinks, dim(), level(), n_sides(), and libMesh::remote_elem.

840 {
841  // See the const version for comments
842  libmesh_assert_less (this->dim(), LIBMESH_DIM);
843  Elem * interior_p = _elemlinks[1+this->n_sides()];
844 
845  libmesh_assert (!interior_p ||
846  (interior_p == remote_elem) ||
847  (interior_p->dim() > this->dim()));
848  if (interior_p && (interior_p != remote_elem))
849  libmesh_assert_less_equal (interior_p->level(), this->level());
850 
851  return interior_p;
852 }
Elem ** _elemlinks
Definition: elem.h:1701
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811
virtual unsigned int n_sides() const =0
unsigned int level() const
Definition: elem.h:2521
virtual unsigned short dim() const =0
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ invalidate()

void libMesh::DofObject::invalidate ( )
inlineinherited

Invalidates all the indices for this DofObject

Definition at line 611 of file dof_object.h.

References libMesh::DofObject::invalidate_dofs(), libMesh::DofObject::invalidate_id(), and libMesh::DofObject::invalidate_processor_id().

Referenced by libMesh::DofObject::DofObject().

612 {
613  this->invalidate_dofs ();
614  this->invalidate_id ();
615  this->invalidate_processor_id ();
616 }
void invalidate_processor_id()
Definition: dof_object.h:603
void invalidate_dofs(const unsigned int sys_num=libMesh::invalid_uint)
Definition: dof_object.h:575

◆ invalidate_dofs()

void libMesh::DofObject::invalidate_dofs ( const unsigned int  sys_num = libMesh::invalid_uint)
inlineinherited

Sets all degree of freedom numbers to invalid_id

Definition at line 575 of file dof_object.h.

References libMesh::DofObject::invalid_id, libMesh::DofObject::n_comp_group(), libMesh::DofObject::n_systems(), libMesh::DofObject::n_var_groups(), and libMesh::DofObject::set_vg_dof_base().

Referenced by libMesh::DofObject::invalidate().

576 {
577  // If the user does not specify the system number...
578  if (sys_num >= this->n_systems())
579  {
580  for (unsigned int s=0; s<this->n_systems(); s++)
581  for (unsigned int vg=0; vg<this->n_var_groups(s); vg++)
582  if (this->n_comp_group(s,vg))
583  this->set_vg_dof_base(s,vg,invalid_id);
584  }
585  // ...otherwise invalidate the dofs for all systems
586  else
587  for (unsigned int vg=0; vg<this->n_var_groups(sys_num); vg++)
588  if (this->n_comp_group(sys_num,vg))
589  this->set_vg_dof_base(sys_num,vg,invalid_id);
590 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:758
void set_vg_dof_base(const unsigned int s, const unsigned int vg, const dof_id_type db)
Definition: dof_object.h:960
unsigned int n_systems() const
Definition: dof_object.h:749
static const dof_id_type invalid_id
Definition: dof_object.h:347
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:816

◆ invalidate_id()

void libMesh::DofObject::invalidate_id ( )
inlineinherited

Sets the id to invalid_id

Definition at line 595 of file dof_object.h.

References libMesh::DofObject::invalid_id, and libMesh::DofObject::set_id().

Referenced by libMesh::DofObject::invalidate().

596 {
597  this->set_id (invalid_id);
598 }
dof_id_type & set_id()
Definition: dof_object.h:664
static const dof_id_type invalid_id
Definition: dof_object.h:347

◆ invalidate_processor_id()

void libMesh::DofObject::invalidate_processor_id ( )
inlineinherited

Sets the processor id to invalid_processor_id

Definition at line 603 of file dof_object.h.

References libMesh::DofObject::invalid_processor_id, and libMesh::DofObject::processor_id().

Referenced by libMesh::DofObject::invalidate(), and libMesh::Partitioner::set_parent_processor_ids().

604 {
606 }
static const processor_id_type invalid_processor_id
Definition: dof_object.h:358
processor_id_type processor_id() const
Definition: dof_object.h:717

◆ is_ancestor_of()

bool libMesh::Elem::is_ancestor_of ( const Elem descendant) const
inline
Returns
true if descendant is a child of this, or a child of a child of this, etc., false otherwise or if AMR is disabled.

Definition at line 2458 of file elem.h.

References parent().

Referenced by family_tree_by_subneighbor(), libMesh::UnstructuredMesh::find_neighbors(), make_links_to_me_local(), and total_family_tree_by_subneighbor().

2463 {
2464 #ifdef LIBMESH_ENABLE_AMR
2465  const Elem * e = descendant;
2466  while (e)
2467  {
2468  if (this == e)
2469  return true;
2470  e = e->parent();
2471  }
2472 #endif
2473  return false;
2474 }
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811

◆ is_child_on_edge()

bool libMesh::Elem::is_child_on_edge ( const unsigned int  c,
const unsigned int  e 
) const
virtual
Returns
true if the specified child is on the specified edge.

Definition at line 1518 of file elem.C.

References build_edge_ptr(), n_children(), and n_edges().

Referenced by libMesh::FEGenericBase< FEOutputType< T >::type >::coarsened_dof_values(), and libMesh::BoundaryInfo::edge_boundary_ids().

1520 {
1521  libmesh_assert_less (c, this->n_children());
1522  libmesh_assert_less (e, this->n_edges());
1523 
1524  std::unique_ptr<const Elem> my_edge = this->build_edge_ptr(e);
1525  std::unique_ptr<const Elem> child_edge = this->build_edge_ptr(e);
1526 
1527  // We're assuming that an overlapping child edge has the same
1528  // number and orientation as its parent
1529  return (child_edge->node_id(0) == my_edge->node_id(0) ||
1530  child_edge->node_id(1) == my_edge->node_id(1));
1531 }
virtual unsigned int n_children() const =0
virtual unsigned int n_edges() const =0
virtual std::unique_ptr< Elem > build_edge_ptr(const unsigned int i)=0

◆ is_child_on_side()

◆ is_edge()

◆ is_edge_on_side()

virtual bool libMesh::Elem::is_edge_on_side ( const unsigned int  e,
const unsigned int  s 
) const
pure virtual

◆ is_face()

◆ is_linear()

virtual bool libMesh::Elem::is_linear ( ) const
inlinevirtual
Returns
true if the Lagrange shape functions on this element are linear.

Reimplemented in libMesh::NodeElem, libMesh::Tet4, libMesh::Tri3, libMesh::Edge2, and libMesh::Tri3Subdivision.

Definition at line 994 of file elem.h.

Referenced by libMesh::FEMap::init_reference_to_physical_map().

994 { return false; }

◆ is_mid_infinite_edge_node()

virtual bool libMesh::Elem::is_mid_infinite_edge_node ( const unsigned int  ) const
inlinevirtual
Returns
true if the specified (local) node number is a "mid-edge" node on an infinite element edge.

This is false for all nodes on non-infinite elements, so we won't make it pure virtual, to simplify their code.

Reimplemented in libMesh::InfEdge2, libMesh::InfQuad, libMesh::InfPrism, and libMesh::InfHex.

Definition at line 1544 of file elem.h.

References infinite().

Referenced by parent_bracketing_nodes().

1545  { libmesh_assert (!this->infinite()); return false; }
virtual bool infinite() const =0

◆ is_node_on_edge()

◆ is_node_on_side()

◆ is_remote()

virtual bool libMesh::Elem::is_remote ( ) const
inlinevirtual
Returns
true if this element is remote, false otherwise.

A remote element (see RemoteElem) is a syntactic convenience – it is a placeholder for an element which exists on some other processor. Local elements are required to have valid neighbors, and these ghost elements may have remote neighbors for data structure consistency. The use of remote elements helps ensure that any element we may access has a nullptr neighbor only if it lies on the physical boundary of the domain.

Reimplemented in libMesh::RemoteElem.

Definition at line 555 of file elem.h.

Referenced by active_family_tree_by_side(), family_tree_by_side(), and make_links_to_me_local().

556  { return false; }

◆ is_semilocal()

bool libMesh::Elem::is_semilocal ( const processor_id_type  my_pid) const
Returns
true if this element is semilocal to the calling processor, which must specify its rank.

Definition at line 451 of file elem.C.

References find_point_neighbors().

452 {
453  std::set<const Elem *> point_neighbors;
454 
455  this->find_point_neighbors(point_neighbors);
456 
457  for (const auto & elem : point_neighbors)
458  if (elem->processor_id() == my_pid)
459  return true;
460 
461  return false;
462 }
void find_point_neighbors(const Point &p, std::set< const Elem *> &neighbor_set) const
Definition: elem.C:498

◆ is_vertex()

◆ is_vertex_on_child()

virtual unsigned int libMesh::Elem::is_vertex_on_child ( unsigned  int,
unsigned int  n 
) const
inlinevirtual
Returns
true if the specified child has a vertex at the specified (child-local) node number. Except in odd cases like pyramid refinement the child will have the same local structure as the parent element.

Definition at line 694 of file elem.h.

References is_vertex().

Referenced by parent_bracketing_nodes().

696  { return this->is_vertex(n); }
virtual bool is_vertex(const unsigned int i) const =0

◆ is_vertex_on_parent()

bool libMesh::Elem::is_vertex_on_parent ( unsigned int  c,
unsigned int  n 
) const
virtual
Returns
true if this element has a vertex at the specified (child-local) node number n of the specified child c.

Definition at line 2879 of file elem.C.

References child_ptr(), libMesh::libmesh_ignore(), n_vertices(), and node_ptr().

2881 {
2882 #ifdef LIBMESH_ENABLE_AMR
2883 
2884  unsigned int my_n_vertices = this->n_vertices();
2885  for (unsigned int n_parent = 0; n_parent != my_n_vertices;
2886  ++n_parent)
2887  if (this->node_ptr(n_parent) == this->child_ptr(c)->node_ptr(n))
2888  return true;
2889  return false;
2890 
2891 #else
2892 
2893  // No AMR?
2894  libmesh_ignore(c,n);
2895  libmesh_error_msg("ERROR: AMR disabled, how did we get here?");
2896  return true;
2897 
2898 #endif
2899 }
void libmesh_ignore(const Args &...)
virtual unsigned int n_vertices() const =0
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:1957
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2578

◆ key() [1/2]

◆ key() [2/2]

dof_id_type libMesh::Elem::key ( ) const
virtual
Returns
An id associated with the global node ids of this element. The id is not necessarily unique, but should be close. Uses the same hash as the key(s) function, so for example if "tri3" is side 0 of "tet4", then tri3->key()==tet4->key(0).

Reimplemented in libMesh::Tet4, libMesh::Edge3, libMesh::Edge4, libMesh::Edge2, libMesh::Quad9, libMesh::Quad, and libMesh::Tri.

Definition at line 401 of file elem.C.

References libMesh::Utility::hashword(), n_nodes(), and node_id().

Referenced by libMesh::InfQuad6::key(), libMesh::Prism18::key(), libMesh::Pyramid14::key(), and libMesh::InfHex18::key().

402 {
403  const unsigned short n_n = this->n_nodes();
404 
405  std::array<dof_id_type, Elem::max_n_nodes> node_ids;
406 
407  for (unsigned short n=0; n != n_n; ++n)
408  node_ids[n] = this->node_id(n);
409 
410  // Always sort, so that different local node numberings hash to the
411  // same value.
412  std::sort (node_ids.begin(), node_ids.begin()+n_n);
413 
414  return Utility::hashword(node_ids.data(), n_n);
415 }
uint32_t hashword(const uint32_t *k, size_t length, uint32_t initval=0)
Definition: hashword.h:153
virtual unsigned int n_nodes() const =0
dof_id_type node_id(const unsigned int i) const
Definition: elem.h:1914

◆ length()

Real libMesh::Elem::length ( const unsigned int  n1,
const unsigned int  n2 
) const
Returns
The distance between nodes n1 and n2.

Useful for computing the lengths of the sides of elements.

Definition at line 390 of file elem.C.

References n_vertices(), and point().

Referenced by libMesh::Hex::quality(), libMesh::InfHex::quality(), and libMesh::Quad::quality().

392 {
393  libmesh_assert_less ( n1, this->n_vertices() );
394  libmesh_assert_less ( n2, this->n_vertices() );
395 
396  return (this->point(n1) - this->point(n2)).norm();
397 }
virtual unsigned int n_vertices() const =0
const Point & point(const unsigned int i) const
Definition: elem.h:1892

◆ level()

unsigned int libMesh::Elem::level ( ) const
inline
Returns
The refinement level of the current element.

If the element's parent is nullptr then by convention it is at level 0, otherwise it is simply at one level greater than its parent.

Definition at line 2521 of file elem.h.

References dim(), level(), and parent().

Referenced by active_family_tree_by_neighbor(), active_family_tree_by_topological_neighbor(), libMesh::BoundaryInfo::add_edge(), libMesh::BoundaryInfo::add_shellface(), libMesh::BoundaryInfo::add_side(), libMesh::UnstructuredMesh::all_second_order(), libMesh::BoundaryInfo::boundary_ids(), libMesh::FEAbstract::compute_node_constraints(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::FEAbstract::compute_periodic_node_constraints(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_proj_constraints(), libMesh::BoundaryInfo::edge_boundary_ids(), libMesh::MeshRefinement::enforce_mismatch_limit_prior_to_refinement(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::MeshTools::find_hanging_nodes_and_parents(), find_interior_neighbors(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), get_info(), interior_parent(), level(), libMesh::MeshTools::libmesh_assert_valid_amr_interior_parents(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::MeshRefinement::make_coarsening_compatible(), make_links_to_me_local(), make_links_to_me_remote(), libMesh::MeshRefinement::make_refinement_compatible(), nullify_neighbors(), libMesh::CompareElemIdsByLevel::operator()(), libMesh::Parallel::Packing< T >::pack(), libMesh::Parallel::Packing< T >::packable_size(), libMesh::BoundaryInfo::remove_edge(), remove_links_to_me(), libMesh::BoundaryInfo::remove_shellface(), libMesh::BoundaryInfo::remove_side(), libMesh::BoundaryInfo::shellface_boundary_ids(), libMesh::BoundaryInfo::side_with_boundary_id(), libMesh::ReplicatedMesh::stitching_helper(), libMesh::MeshRefinement::test_level_one(), top_parent(), topological_neighbor(), libMesh::Parallel::Packing< T >::unpack(), and which_neighbor_am_i().

2522 {
2523 #ifdef LIBMESH_ENABLE_AMR
2524 
2525  // if I don't have a parent I was
2526  // created directly from file
2527  // or by the user, so I am a
2528  // level-0 element
2529  if (this->parent() == nullptr)
2530  return 0;
2531 
2532  // if the parent and this element are of different
2533  // dimensionality we are at the same level as
2534  // the parent (e.g. we are the 2D side of a
2535  // 3D element)
2536  if (this->dim() != this->parent()->dim())
2537  return this->parent()->level();
2538 
2539  // otherwise we are at a level one
2540  // higher than our parent
2541  return (this->parent()->level() + 1);
2542 
2543 #else
2544 
2545  // Without AMR all elements are
2546  // at level 0.
2547  return 0;
2548 
2549 #endif
2550 }
const Elem * parent() const
Definition: elem.h:2479
unsigned int level() const
Definition: elem.h:2521
virtual unsigned short dim() const =0

◆ libmesh_assert_valid_neighbors()

void libMesh::Elem::libmesh_assert_valid_neighbors ( ) const

Checks for consistent neighbor links on this element.

Definition at line 990 of file elem.C.

References dim(), n_neighbors(), neighbor_ptr(), parent(), libMesh::remote_elem, side_index_range(), subactive(), and which_neighbor_am_i().

991 {
992  for (auto n : this->side_index_range())
993  {
994  const Elem * neigh = this->neighbor_ptr(n);
995 
996  // Any element might have a remote neighbor; checking
997  // to make sure that's not inaccurate is tough.
998  if (neigh == remote_elem)
999  continue;
1000 
1001  if (neigh)
1002  {
1003  // Only subactive elements have subactive neighbors
1004  libmesh_assert (this->subactive() || !neigh->subactive());
1005 
1006  const Elem * elem = this;
1007 
1008  // If we're subactive but our neighbor isn't, its
1009  // return neighbor link will be to our first active
1010  // ancestor OR to our inactive ancestor of the same
1011  // level as neigh,
1012  if (this->subactive() && !neigh->subactive())
1013  {
1014  for (elem = this; !elem->active();
1015  elem = elem->parent())
1016  libmesh_assert(elem);
1017  }
1018  else
1019  {
1020  unsigned int rev = neigh->which_neighbor_am_i(elem);
1021  libmesh_assert_less (rev, neigh->n_neighbors());
1022 
1023  if (this->subactive() && !neigh->subactive())
1024  {
1025  while (neigh->neighbor_ptr(rev) != elem)
1026  {
1027  libmesh_assert(elem->parent());
1028  elem = elem->parent();
1029  }
1030  }
1031  else
1032  {
1033  const Elem * nn = neigh->neighbor_ptr(rev);
1034  libmesh_assert(nn);
1035 
1036  for (; elem != nn; elem = elem->parent())
1037  libmesh_assert(elem);
1038  }
1039  }
1040  }
1041  // If we don't have a neighbor and we're not subactive, our
1042  // ancestors shouldn't have any neighbors in this same
1043  // direction.
1044  else if (!this->subactive())
1045  {
1046  const Elem * my_parent = this->parent();
1047  if (my_parent &&
1048  // A parent with a different dimension isn't really one of
1049  // our ancestors, it means we're on a boundary mesh and this
1050  // is an interior mesh element for which we're on a side.
1051  // Nothing to test for in that case.
1052  (my_parent->dim() == this->dim()))
1053  libmesh_assert (!my_parent->neighbor_ptr(n));
1054  }
1055  }
1056 }
const Elem * parent() const
Definition: elem.h:2479
IntRange< unsigned short > side_index_range() const
Definition: elem.h:2166
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:2050
virtual unsigned short dim() const =0
bool subactive() const
Definition: elem.h:2408
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ libmesh_assert_valid_node_pointers()

void libMesh::Elem::libmesh_assert_valid_node_pointers ( ) const

Checks for a valid id and pointers to nodes with valid ids on this element.

Definition at line 978 of file elem.C.

References n_nodes(), node_ptr(), and libMesh::DofObject::valid_id().

979 {
980  libmesh_assert(this->valid_id());
981  for (unsigned int n=0; n != this->n_nodes(); ++n)
982  {
983  libmesh_assert(this->node_ptr(n));
984  libmesh_assert(this->node_ptr(n)->valid_id());
985  }
986 }
virtual unsigned int n_nodes() const =0
bool valid_id() const
Definition: dof_object.h:697
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:1957

◆ local_node()

unsigned int libMesh::Elem::local_node ( const dof_id_type  i) const
inline
Returns
The local id number of global Node id i, or invalid_uint if Node id i is not local.

Definition at line 1937 of file elem.h.

References libMesh::invalid_uint, n_nodes(), and node_id().

Referenced by libMesh::MeshTools::find_nodal_neighbors(), and libMesh::ReplicatedMesh::stitching_helper().

1938 {
1939  for (unsigned int n=0; n != this->n_nodes(); ++n)
1940  if (this->node_id(n) == i)
1941  return n;
1942 
1943  return libMesh::invalid_uint;
1944 }
const unsigned int invalid_uint
Definition: libmesh.h:245
virtual unsigned int n_nodes() const =0
dof_id_type node_id(const unsigned int i) const
Definition: elem.h:1914

◆ loose_bounding_box()

BoundingBox libMesh::Elem::loose_bounding_box ( ) const
virtual
Returns
A bounding box (not necessarily the minimal bounding box) containing the geometric element.

The base class implementation determines a bounding box for the element nodes, which should be sufficient for first order finite elements. Higher order geometric elements will need to override with an implementation which takes curved elements into account.

Reimplemented in libMesh::Quad9, libMesh::Tri6, libMesh::Quad8, libMesh::Hex8, libMesh::Prism6, libMesh::Tri3, libMesh::Pyramid5, libMesh::Edge3, libMesh::Quad4, libMesh::Edge4, and libMesh::Cell.

Definition at line 2857 of file elem.C.

References n_nodes(), and point().

Referenced by libMesh::TreeNode< N >::insert(), libMesh::Quad4::loose_bounding_box(), libMesh::Pyramid5::loose_bounding_box(), libMesh::Tri3::loose_bounding_box(), libMesh::Prism6::loose_bounding_box(), and libMesh::Hex8::loose_bounding_box().

2858 {
2859  Point pmin = this->point(0);
2860  Point pmax = pmin;
2861 
2862  unsigned int n_points = this->n_nodes();
2863  for (unsigned int p=0; p != n_points; ++p)
2864  for (unsigned d=0; d<LIBMESH_DIM; ++d)
2865  {
2866  const Point & pt = this->point(p);
2867  if (pmin(d) > pt(d))
2868  pmin(d) = pt(d);
2869 
2870  if (pmax(d) < pt(d))
2871  pmax(d) = pt(d);
2872  }
2873 
2874  return BoundingBox(pmin, pmax);
2875 }
virtual unsigned int n_nodes() const =0
const Point & point(const unsigned int i) const
Definition: elem.h:1892

◆ make_links_to_me_local()

void libMesh::Elem::make_links_to_me_local ( unsigned int  n)

Resets the appropriate neighbor pointers of our nth neighbor (and its descendants, if appropriate) to point to this Elem instead of to the global remote_elem. Used by the library when a formerly remote element is being added to the local processor.

Definition at line 1062 of file elem.C.

References active(), family_tree_by_side(), has_children(), is_ancestor_of(), is_remote(), JUST_REFINED, level(), n_sides(), neighbor_ptr(), parent(), refinement_flag(), libMesh::remote_elem, set_neighbor(), side_ptr(), and subactive().

Referenced by libMesh::Parallel::Packing< T >::unpack().

1063 {
1064  Elem * neigh = this->neighbor_ptr(n);
1065 
1066  // Don't bother calling this function unless it's necessary
1067  libmesh_assert(neigh);
1068  libmesh_assert(!neigh->is_remote());
1069 
1070  // We never have neighbors more refined than us
1071  libmesh_assert_less_equal (neigh->level(), this->level());
1072 
1073  // We never have subactive neighbors of non subactive elements
1074  libmesh_assert(!neigh->subactive() || this->subactive());
1075 
1076  // If we have a neighbor less refined than us then it must not
1077  // have any more refined descendants we could have pointed to
1078  // instead.
1079  libmesh_assert((neigh->level() == this->level()) ||
1080  (neigh->active() && !this->subactive()) ||
1081  (!neigh->has_children() && this->subactive()));
1082 
1083  // If neigh is at our level, then its family might have
1084  // remote_elem neighbor links which need to point to us
1085  // instead, but if not, then we're done.
1086  if (neigh->level() != this->level())
1087  return;
1088 
1089  // What side of neigh are we on? We can't use the usual Elem
1090  // method because we're in the middle of restoring topology
1091  const std::unique_ptr<Elem> my_side = this->side_ptr(n);
1092  unsigned int nn = 0;
1093  for (; nn != neigh->n_sides(); ++nn)
1094  {
1095  const std::unique_ptr<Elem> neigh_side = neigh->side_ptr(nn);
1096  if (*my_side == *neigh_side)
1097  break;
1098  }
1099 
1100  // we had better be on *some* side of neigh
1101  libmesh_assert_less (nn, neigh->n_sides());
1102 
1103  // Find any elements that ought to point to elem
1104  std::vector<const Elem *> neigh_family;
1105 #ifdef LIBMESH_ENABLE_AMR
1106  if (this->active())
1107  neigh->family_tree_by_side(neigh_family, nn);
1108  else if (neigh->subactive())
1109 #endif
1110  neigh_family.push_back(neigh);
1111 
1112  // And point them to elem
1113  for (auto & const_elem : neigh_family)
1114  {
1115  // This const_cast is necessary until we have a version of
1116  // family_tree_by_side that returns a vector of non-constant
1117  // pointers when called on a non-constant Elem.
1118  Elem * neigh_family_member = const_cast<Elem *>(const_elem);
1119 
1120  // Only subactive elements point to other subactive elements
1121  if (this->subactive() && !neigh_family_member->subactive())
1122  continue;
1123 
1124  // Ideally, the neighbor link ought to either be correct
1125  // already or ought to be to remote_elem.
1126  //
1127  // However, if we're redistributing a newly created elem,
1128  // after an AMR step but before find_neighbors has fixed up
1129  // neighbor links, we might have an out of date neighbor
1130  // link to elem's parent instead.
1131 #ifdef LIBMESH_ENABLE_AMR
1132  libmesh_assert((neigh_family_member->neighbor_ptr(nn) &&
1133  (neigh_family_member->neighbor_ptr(nn)->active() ||
1134  neigh_family_member->neighbor_ptr(nn)->is_ancestor_of(this))) ||
1135  (neigh_family_member->neighbor_ptr(nn) == remote_elem) ||
1136  ((this->refinement_flag() == JUST_REFINED) &&
1137  (this->parent() != nullptr) &&
1138  (neigh_family_member->neighbor_ptr(nn) == this->parent())));
1139 #else
1140  libmesh_assert((neigh_family_member->neighbor_ptr(nn) == this) ||
1141  (neigh_family_member->neighbor_ptr(nn) == remote_elem));
1142 #endif
1143 
1144  neigh_family_member->set_neighbor(nn, this);
1145  }
1146 }
RefinementState refinement_flag() const
Definition: elem.h:2638
const Elem * parent() const
Definition: elem.h:2479
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:2050
unsigned int level() const
Definition: elem.h:2521
virtual std::unique_ptr< Elem > side_ptr(unsigned int i)=0
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ make_links_to_me_remote()

void libMesh::Elem::make_links_to_me_remote ( )

Resets this element's neighbors' appropriate neighbor pointers and its parent's and children's appropriate pointers to point to the global remote_elem instead of this. Used by the library before an element becomes remote on the local processor.

Definition at line 1149 of file elem.C.

References child(), child_ptr(), child_ref_range(), dim(), has_children(), level(), n_neighbors(), neighbor_ptr(), neighbor_ptr_range(), parent(), libMesh::remote_elem, set_child(), set_neighbor(), subactive(), which_child_am_i(), and which_neighbor_am_i().

Referenced by libMesh::MeshCommunication::delete_remote_elements().

1150 {
1151  libmesh_assert_not_equal_to (this, remote_elem);
1152 
1153  // We need to have handled any children first
1154 #if defined(LIBMESH_ENABLE_AMR) && defined(DEBUG)
1155  if (this->has_children())
1156  for (auto & child : this->child_ref_range())
1157  libmesh_assert_equal_to (&child, remote_elem);
1158 #endif
1159 
1160  // Remotify any neighbor links
1161  for (auto neigh : this->neighbor_ptr_range())
1162  {
1163  if (neigh && neigh != remote_elem)
1164  {
1165  // My neighbor should never be more refined than me; my real
1166  // neighbor would have been its parent in that case.
1167  libmesh_assert_greater_equal (this->level(), neigh->level());
1168 
1169  if (this->level() == neigh->level() &&
1170  neigh->has_neighbor(this))
1171  {
1172 #ifdef LIBMESH_ENABLE_AMR
1173  // My neighbor may have descendants which also consider me a
1174  // neighbor
1175  std::vector<const Elem *> family;
1176  neigh->total_family_tree_by_neighbor (family, this);
1177 
1178  // FIXME - There's a lot of ugly const_casts here; we
1179  // may want to make remote_elem non-const and create
1180  // non-const versions of the family_tree methods
1181  for (auto & const_elem : family)
1182  {
1183  Elem * n = const_cast<Elem *>(const_elem);
1184  libmesh_assert (n);
1185  if (n == remote_elem)
1186  continue;
1187  unsigned int my_s = n->which_neighbor_am_i(this);
1188  libmesh_assert_less (my_s, n->n_neighbors());
1189  libmesh_assert_equal_to (n->neighbor_ptr(my_s), this);
1190  n->set_neighbor(my_s, const_cast<RemoteElem *>(remote_elem));
1191  }
1192 #else
1193  unsigned int my_s = neigh->which_neighbor_am_i(this);
1194  libmesh_assert_less (my_s, neigh->n_neighbors());
1195  libmesh_assert_equal_to (neigh->neighbor_ptr(my_s), this);
1196  neigh->set_neighbor(my_s, const_cast<RemoteElem *>(remote_elem));
1197 #endif
1198  }
1199 #ifdef LIBMESH_ENABLE_AMR
1200  // Even if my neighbor doesn't link back to me, it might
1201  // have subactive descendants which do
1202  else if (neigh->has_children())
1203  {
1204  // If my neighbor at the same level doesn't have me as a
1205  // neighbor, I must be subactive
1206  libmesh_assert(this->level() > neigh->level() ||
1207  this->subactive());
1208 
1209  // My neighbor must have some ancestor of mine as a
1210  // neighbor
1211  Elem * my_ancestor = this->parent();
1212  libmesh_assert(my_ancestor);
1213  while (!neigh->has_neighbor(my_ancestor))
1214  {
1215  my_ancestor = my_ancestor->parent();
1216  libmesh_assert(my_ancestor);
1217  }
1218 
1219  // My neighbor may have descendants which consider me a
1220  // neighbor
1221  std::vector<const Elem *> family;
1222  neigh->total_family_tree_by_subneighbor (family, my_ancestor, this);
1223 
1224  // FIXME - There's a lot of ugly const_casts here; we
1225  // may want to make remote_elem non-const and create
1226  // non-const versions of the family_tree methods
1227  for (auto & const_elem : family)
1228  {
1229  Elem * n = const_cast<Elem *>(const_elem);
1230  libmesh_assert (n);
1231  if (n == remote_elem)
1232  continue;
1233  unsigned int my_s = n->which_neighbor_am_i(this);
1234  libmesh_assert_less (my_s, n->n_neighbors());
1235  libmesh_assert_equal_to (n->neighbor_ptr(my_s), this);
1236  n->set_neighbor(my_s, const_cast<RemoteElem *>(remote_elem));
1237  }
1238  }
1239 #endif
1240  }
1241  }
1242 
1243 #ifdef LIBMESH_ENABLE_AMR
1244  // Remotify parent's child link
1245  Elem * my_parent = this->parent();
1246  if (my_parent &&
1247  // As long as it's not already remote
1248  my_parent != remote_elem &&
1249  // And it's a real parent, not an interior parent
1250  this->dim() == my_parent->dim())
1251  {
1252  unsigned int me = my_parent->which_child_am_i(this);
1253  libmesh_assert_equal_to (my_parent->child_ptr(me), this);
1254  my_parent->set_child(me, const_cast<RemoteElem *>(remote_elem));
1255  }
1256 #endif
1257 }
const Elem * parent() const
Definition: elem.h:2479
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1811
Elem * child(const unsigned int i) const
Definition: elem.h:2598
unsigned int level() const
Definition: elem.h:2521
virtual unsigned short dim() const =0
bool subactive() const
Definition: elem.h:2408
SimpleRange< NeighborPtrIter > neighbor_ptr_range()
Definition: elem.h:2988
bool has_children() const
Definition: elem.h:2428
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ master_point()

virtual Point libMesh::Elem::master_point ( const unsigned int  i) const
pure virtual

◆ max_descendant_p_level()

unsigned int libMesh::Elem::max_descendant_p_level ( ) const
inline
Returns
The maximum value of the p-refinement levels of an ancestor element's descendants.

Definition at line 2674 of file elem.h.

References _p_level, active(), child_ref_range(), std::max(), p_level(), and subactive().

Referenced by libMesh::FEGenericBase< FEOutputType< T >::type >::coarsened_dof_values().

2675 {
2676  // This is undefined for subactive elements,
2677  // which have no active descendants
2678  libmesh_assert (!this->subactive());
2679  if (this->active())
2680  return this->p_level();
2681 
2682  unsigned int max_p_level = _p_level;
2683  for (auto & c : child_ref_range())
2684  max_p_level = std::max(max_p_level,
2685  c.max_descendant_p_level());
2686  return max_p_level;
2687 }
unsigned char _p_level
Definition: elem.h:1736
unsigned int p_level() const
Definition: elem.h:2555
long double max(long double a, double b)
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390

◆ min_new_p_level_by_neighbor()

unsigned int libMesh::Elem::min_new_p_level_by_neighbor ( const Elem neighbor,
unsigned int  current_min 
) const
Returns
The minimum new p-refinement level (i.e. after refinement and coarsening is done) of elements which are descended from this element and which share a side with the active neighbor.

Definition at line 1899 of file elem.C.

References active(), child_ref_range(), COARSEN, has_neighbor(), std::min(), p_level(), p_refinement_flag(), REFINE, libMesh::remote_elem, and subactive().

1901 {
1902  libmesh_assert(!this->subactive());
1903  libmesh_assert(neighbor_in->active());
1904 
1905  // If we're an active element this is simple
1906  if (this->active())
1907  {
1908  unsigned int new_p_level = this->p_level();
1909  if (this->p_refinement_flag() == Elem::REFINE)
1910  new_p_level += 1;
1911  if (this->p_refinement_flag() == Elem::COARSEN)
1912  {
1913  libmesh_assert_greater (new_p_level, 0);
1914  new_p_level -= 1;
1915  }
1916  return std::min(current_min, new_p_level);
1917  }
1918 
1919  libmesh_assert(has_neighbor(neighbor_in));
1920 
1921  unsigned int min_p_level = current_min;
1922 
1923  for (auto & c : this->child_ref_range())
1924  if (&c != remote_elem && c.has_neighbor(neighbor_in))
1925  min_p_level =
1926  c.min_new_p_level_by_neighbor(neighbor_in, min_p_level);
1927 
1928  return min_p_level;
1929 }
bool has_neighbor(const Elem *elem) const
Definition: elem.h:2093
RefinementState p_refinement_flag() const
Definition: elem.h:2654
unsigned int p_level() const
Definition: elem.h:2555
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390
long double min(long double a, double b)
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ min_p_level_by_neighbor()

unsigned int libMesh::Elem::min_p_level_by_neighbor ( const Elem neighbor,
unsigned int  current_min 
) const
Returns
The minimum p-refinement level of elements which are descended from this element, and which share a side with the active neighbor.

Definition at line 1870 of file elem.C.

References active(), child_ref_range(), has_neighbor(), std::min(), p_level(), libMesh::remote_elem, and subactive().

Referenced by libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), and libMesh::FEGenericBase< FEOutputType< T >::type >::compute_proj_constraints().

1872 {
1873  libmesh_assert(!this->subactive());
1874  libmesh_assert(neighbor_in->active());
1875 
1876  // If we're an active element this is simple
1877  if (this->active())
1878  return std::min(current_min, this->p_level());
1879 
1880  libmesh_assert(has_neighbor(neighbor_in));
1881 
1882  // The p_level() of an ancestor element is already the minimum
1883  // p_level() of its children - so if that's high enough, we don't
1884  // need to examine any children.
1885  if (current_min <= this->p_level())
1886  return current_min;
1887 
1888  unsigned int min_p_level = current_min;
1889 
1890  for (auto & c : this->child_ref_range())
1891  if (&c != remote_elem && c.has_neighbor(neighbor_in))
1892  min_p_level =
1893  c.min_p_level_by_neighbor(neighbor_in, min_p_level);
1894 
1895  return min_p_level;
1896 }
bool has_neighbor(const Elem *elem) const
Definition: elem.h:2093
unsigned int p_level() const
Definition: elem.h:2555
SimpleRange< ChildRefIter > child_ref_range()
Definition: elem.h:1779
bool subactive() const
Definition: elem.h:2408
bool active() const
Definition: elem.h:2390
long double min(long double a, double b)
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ n_children()

◆ n_comp()

unsigned int libMesh::DofObject::n_comp ( const unsigned int  s,
const unsigned int  var 
) const
inlineinherited
Returns
The number of components for variable var of system s associated with this DofObject. For example, the HIERARCHIC shape functions may have multiple DoFs associated with one node. Another example is the MONOMIALs, where only the elements hold the DoFs. For the different spatial directions, and orders, see FE.

Definition at line 803 of file dof_object.h.

References libMesh::DofObject::n_comp_group(), libMesh::DofObject::n_systems(), libMesh::DofObject::n_vars(), and libMesh::DofObject::var_to_vg().

Referenced by libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::DofMap::constrain_p_dofs(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::DofMap::distribute_dofs(), libMesh::DofObject::dof_number(), libMesh::DofObject::DofObject(), libMesh::OldSolutionValue< Output, point_output >::eval_at_node(), libMesh::OldSolutionCoefs< Output, point_output >::eval_at_node(), libMesh::Node::get_info(), get_info(), libMesh::DofMap::local_variable_indices(), libMesh::DofObject::n_dofs(), libMesh::DofObject::operator=(), libMesh::DofObject::print_dof_info(), libMesh::DofObject::set_dof_number(), libMesh::DofObject::set_n_vars_per_group(), and libMesh::DofMap::set_nonlocal_dof_objects().

805 {
806  libmesh_assert_less (s, this->n_systems());
807  libmesh_assert_less (var, this->n_vars(s));
808 
809  return this->n_comp_group(s,this->var_to_vg(s,var));
810 }
unsigned int var_to_vg(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:1004
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:768
unsigned int n_systems() const
Definition: dof_object.h:749
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:816

◆ n_comp_group()

unsigned int libMesh::DofObject::n_comp_group ( const unsigned int  s,
const unsigned int  vg 
) const
inlineinherited
Returns
The number of components for VariableGroup vg of system s associated with this DofObject. For example, the HIERARCHIC shape functions may have multiple DoFs associated with one node. Another example is the MONOMIALs, where only the elements hold the DoFs. For the different spatial directions, and orders, see FE.

Definition at line 816 of file dof_object.h.

References libMesh::DofObject::_idx_buf, libMesh::DofObject::n_systems(), libMesh::DofObject::n_var_groups(), libMesh::DofObject::ncv_magic, and libMesh::DofObject::start_idx().

Referenced by libMesh::DofMap::_dof_indices(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::dof_indices(), libMesh::DofObject::dof_number(), libMesh::DofObject::invalidate_dofs(), libMesh::DofObject::n_comp(), libMesh::DofMap::old_dof_indices(), libMesh::BuildProjectionList::operator()(), libMesh::DofMap::reinit(), libMesh::DofObject::set_dof_number(), libMesh::DofObject::set_n_comp_group(), libMesh::DofObject::set_n_vars_per_group(), and libMesh::DofMap::set_nonlocal_dof_objects().

818 {
819  libmesh_assert_less (s, this->n_systems());
820  libmesh_assert_less (vg, this->n_var_groups(s));
821 
822  const unsigned int
823  start_idx_sys = this->start_idx(s);
824 
825  libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size());
826 
827  return (_idx_buf[start_idx_sys + 2*vg] % ncv_magic);
828 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:758
unsigned int n_systems() const
Definition: dof_object.h:749
unsigned int start_idx(const unsigned int s) const
Definition: dof_object.h:936
index_buffer_t _idx_buf
Definition: dof_object.h:508
static const index_t ncv_magic
Definition: dof_object.h:519

◆ n_dofs()

unsigned int libMesh::DofObject::n_dofs ( const unsigned int  s,
const unsigned int  var = libMesh::invalid_uint 
) const
inlineinherited
Returns
The number of degrees of freedom associated with system s for this object. Optionally only counts degrees of freedom for variable number var

Definition at line 633 of file dof_object.h.

References libMesh::invalid_uint, libMesh::DofObject::n_comp(), libMesh::DofObject::n_systems(), and libMesh::DofObject::n_vars().

Referenced by libMesh::PetscDMWrapper::add_dofs_helper().

635 {
636  libmesh_assert_less (s, this->n_systems());
637 
638  unsigned int num = 0;
639 
640  // Count all variables
641  if (var == libMesh::invalid_uint)
642  for (unsigned int v=0; v<this->n_vars(s); v++)
643  num += this->n_comp(s,v);
644 
645  // Only count specified variable
646  else
647  num = this->n_comp(s,var);
648 
649  return num;
650 }
const unsigned int invalid_uint
Definition: libmesh.h:245
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:803
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:768
unsigned int n_systems() const
Definition: dof_object.h:749

◆ n_edges()

◆ n_faces()

virtual unsigned int libMesh::Elem::n_faces ( ) const
pure virtual
Returns
The number of faces the element that has been derived from this class has.

Implemented in libMesh::RemoteElem, libMesh::InfQuad, libMesh::InfHex, libMesh::InfPrism, libMesh::Pyramid, libMesh::NodeElem, libMesh::Prism, libMesh::Tet, libMesh::Edge, libMesh::Hex, and libMesh::Face.

◆ n_neighbors()

unsigned int libMesh::Elem::n_neighbors ( ) const
inline
Returns
The number of neighbors the element that has been derived from this class has.

Only face (or edge in 2D) neighbors are stored, so this method returns n_sides(). At one point we intended to allow derived classes to override this, but too much current libMesh code assumes n_neighbors==n_sides.

Definition at line 644 of file elem.h.

References n_sides().

Referenced by _last_side(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_proj_constraints(), libMesh::MeshTools::find_hanging_nodes_and_parents(), libMesh::Tri3Subdivision::get_ordered_valence(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libmesh_assert_valid_neighbors(), make_links_to_me_remote(), neighbor_ptr(), neighbor_ptr_range(), nullify_neighbors(), remove_links_to_me(), set_neighbor(), and topological_neighbor().

645  { return this->n_sides(); }
virtual unsigned int n_sides() const =0

◆ n_nodes()

virtual unsigned int libMesh::Elem::n_nodes ( ) const
pure virtual