libMesh::RemoteElem Class Reference

Used by ParallelMesh to represent an Elem owned by another processor. More...

#include <remote_elem.h>

Inheritance diagram for libMesh::RemoteElem:

Public Types

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

Public Member Functions

virtual ~RemoteElem ()
 
virtual Point master_point (const unsigned int) const libmesh_override
 
virtual Node *& set_node (const unsigned int i) libmesh_override
 
virtual dof_id_type key (const unsigned int) const libmesh_override
 
virtual bool is_remote () const libmesh_override
 
virtual void connectivity (const unsigned int, const IOPackage, std::vector< dof_id_type > &) const libmesh_override
 
virtual ElemType type () const libmesh_override
 
virtual unsigned int dim () const libmesh_override
 
virtual unsigned int n_nodes () const libmesh_override
 
virtual unsigned int n_sides () const libmesh_override
 
virtual unsigned int n_vertices () const libmesh_override
 
virtual unsigned int n_edges () const libmesh_override
 
virtual unsigned int n_faces () const libmesh_override
 
virtual unsigned int n_children () const libmesh_override
 
virtual bool is_vertex (const unsigned int) const libmesh_override
 
virtual bool is_edge (const unsigned int) const libmesh_override
 
virtual bool is_face (const unsigned int) const libmesh_override
 
virtual bool is_node_on_side (const unsigned int, const unsigned int) const libmesh_override
 
virtual bool is_child_on_side (const unsigned int, const unsigned int) const libmesh_override
 
virtual bool is_edge_on_side (const unsigned int, const unsigned int) const libmesh_override
 
virtual bool is_node_on_edge (const unsigned int, const unsigned int) const libmesh_override
 
virtual unsigned int n_sub_elem () const libmesh_override
 
virtual UniquePtr< Elemside_ptr (const unsigned int) libmesh_override
 
virtual UniquePtr< Elembuild_side_ptr (const unsigned int, bool) libmesh_override
 
virtual UniquePtr< Elembuild_edge_ptr (const unsigned int) libmesh_override
 
virtual Order default_order () const libmesh_override
 
virtual bool infinite () const libmesh_override
 
virtual float embedding_matrix (const unsigned int, const unsigned int, const unsigned int) const libmesh_override
 
const Pointpoint (const unsigned int i) const
 
Pointpoint (const unsigned int i)
 
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
 
subdomain_id_type subdomain_id () const
 
subdomain_id_typesubdomain_id ()
 
const Elemreference_elem () const
 
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
 
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
 
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 make_links_to_me_remote ()
 
void make_links_to_me_local (unsigned int n)
 
void write_connectivity (std::ostream &out, const IOPackage iop) const
 
virtual unsigned int n_nodes_in_child (unsigned int) const
 
virtual unsigned int n_neighbors () const
 
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 unsigned int opposite_side (const unsigned int s) const
 
virtual unsigned int opposite_node (const unsigned int n, const unsigned int s) const
 
UniquePtr< const Elemside_ptr (unsigned int i) const
 
UniquePtr< Elemside (const unsigned int i) const
 
UniquePtr< const Elembuild_side_ptr (const unsigned int i, bool proxy=true) const
 
UniquePtr< Elembuild_side (const unsigned int i, bool proxy=true) const
 
UniquePtr< const Elembuild_edge_ptr (const unsigned int i) const
 
UniquePtr< Elembuild_edge (const unsigned int i) const
 
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
 
const Elemchild_ptr (unsigned int i) const
 
Elemchild_ptr (unsigned int i)
 
Elemchild (const unsigned int i) 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 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 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 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
 
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 const Elemcreate ()
 
static void print_info (std::ostream &out=libMesh::out)
 
static void print_info (std::ostream &out=libMesh::out)
 
static std::string get_info ()
 
static std::string get_info ()
 
static ElemType second_order_equivalent_type (const ElemType et, const bool full_ordered=true)
 
static ElemType first_order_equivalent_type (const ElemType et)
 
static UniquePtr< Elembuild (const ElemType type, Elem *p=libmesh_nullptr)
 
static unsigned int n_objects ()
 
static unsigned int n_objects ()
 
static void enable_print_counter_info ()
 
static void enable_print_counter_info ()
 
static void disable_print_counter_info ()
 
static void disable_print_counter_info ()
 
static unsigned int unpackable_indexing_size (std::vector< largest_id_type >::const_iterator begin)
 
static void setup ()
 
static void cleanup ()
 

Public Attributes

 LIBMESH_ENABLE_TOPOLOGY_CACHES
 
DofObjectold_dof_object
 

Static Public Attributes

static const dof_id_type remote_elem_id = static_cast<dof_id_type>(-2)
 
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 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

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_constructor_count (const std::string &name)
 
void increment_destructor_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

Elem_elemlinks_data [1]
 
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 Counts _counts
 
static Threads::atomic< unsigned int > _n_objects
 
static Threads::atomic< unsigned int > _n_objects
 
static Threads::spin_mutex _mutex
 
static Threads::spin_mutex _mutex
 
static bool _enable_print_counter = true
 
static bool _enable_print_counter = true
 

Private Member Functions

 RemoteElem ()
 

Detailed Description

Used by ParallelMesh to represent an Elem owned by another processor.

In parallel meshes where a ghost element has neighbors which do not exist on the local processor, the ghost element's neighbors are set to point to the singleton RemoteElement instead. Library code can then distinguish between such elements and boundary elements (with NULL neighbors).

Author
Roy H. Stogner
Date
2007

Definition at line 44 of file remote_elem.h.

Member Typedef Documentation

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 110 of file reference_counter.h.

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 110 of file reference_counter.h.

Useful iterator typedefs

Definition at line 1268 of file elem.h.

Member Enumeration Documentation

Enumeration of possible element refinement states.

Enumerator
COARSEN 
DO_NOTHING 
REFINE 
JUST_REFINED 
JUST_COARSENED 
INACTIVE 
COARSEN_INACTIVE 
INVALID_REFINEMENTSTATE 

Definition at line 1013 of file elem.h.

Constructor & Destructor Documentation

libMesh::RemoteElem::RemoteElem ( )
inlineprivate

Constructor. Private to force use of the create() member.

Definition at line 58 of file remote_elem.h.

References create(), libMesh::DofObject::set_id(), and ~RemoteElem().

58  : Elem(0,
59  0,
63  { this->set_id(remote_elem_id); }
static const dof_id_type remote_elem_id
Definition: remote_elem.h:52
Elem * _elemlinks_data[1]
Definition: remote_elem.h:192
const class libmesh_nullptr_t libmesh_nullptr
dof_id_type & set_id()
Definition: dof_object.h:633
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
libMesh::RemoteElem::~RemoteElem ( )
virtual

Destructor.

Definition at line 60 of file remote_elem.C.

References libmesh_nullptr.

Referenced by RemoteElem().

61 {
62  RemoteElemMutex::scoped_lock lock(remote_elem_mtx);
63 
65 }
const class libmesh_nullptr_t libmesh_nullptr
const RemoteElem * remote_elem
Definition: remote_elem.C:57

Member Function Documentation

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

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 1420 of file elem.h.

Referenced by libMesh::Elem::parent_bracketing_nodes().

1421  {
1422  static std::vector<std::vector<std::vector<std::vector<std::pair<unsigned char, unsigned char> > > > > c;
1423  libmesh_error();
1424  return c;
1425  }
virtual std::vector<std::vector<std::vector<signed char> > >& libMesh::Elem::_get_parent_indices_cache ( ) const
inlineprotectedvirtualinherited

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 1434 of file elem.h.

References libMesh::Elem::nullify_neighbors().

Referenced by libMesh::Elem::as_parent_node().

1435  {
1436  static std::vector<std::vector<std::vector<signed char> > > c;
1437  libmesh_error();
1438  return c;
1439  }
bool libMesh::Elem::active ( ) const
inlineinherited
Returns
true if the element is active (i.e. has no active descendants), false otherwise. Note that it suffices to check the first child only. Always returns true if AMR is disabled.

Definition at line 1984 of file elem.h.

References libMesh::Elem::COARSEN_INACTIVE, libMesh::Elem::INACTIVE, and libMesh::Elem::refinement_flag().

Referenced by libMesh::MeshRefinement::_coarsen_elements(), libMesh::DofMap::_dof_indices(), libMesh::MeshRefinement::_refine_elements(), libMesh::Elem::active_family_tree(), libMesh::Elem::active_family_tree_by_neighbor(), libMesh::Elem::active_family_tree_by_side(), libMesh::Elem::active_family_tree_by_topological_neighbor(), libMesh::HPCoarsenTest::add_projection(), libMesh::Elem::ancestor(), libMesh::Patch::build_around_element(), libMesh::CheckpointIO::build_elem_list(), libMesh::ParmetisPartitioner::build_graph(), libMesh::Elem::coarsen(), libMesh::MeshRefinement::coarsen_elements(), libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::FEAbstract::compute_periodic_node_constraints(), libMesh::FEGenericBase< OutputType >::compute_proj_constraints(), libMesh::UnstructuredMesh::contract(), libMesh::Elem::contract(), libMesh::DofMap::dof_indices(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::Elem::family_tree(), libMesh::Elem::family_tree_by_neighbor(), libMesh::Elem::family_tree_by_side(), libMesh::Elem::family_tree_by_subneighbor(), libMesh::Elem::find_edge_neighbors(), libMesh::Patch::find_face_neighbors(), libMesh::Elem::find_interior_neighbors(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshTools::find_nodal_neighbors(), libMesh::Elem::find_point_neighbors(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::Elem::get_info(), libMesh::ErrorVector::is_active_elem(), libMesh::Elem::is_linear(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Elem >(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_tree(), libMesh::MeshTools::libmesh_assert_valid_remote_elems(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::Elem::make_links_to_me_local(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::Elem::max_descendant_p_level(), libMesh::Elem::min_new_p_level_by_neighbor(), libMesh::Elem::min_p_level_by_neighbor(), libMesh::DofMap::old_dof_indices(), libMesh::GhostPointNeighbors::operator()(), libMesh::PointLocatorTree::operator()(), libMesh::MetisPartitioner::partition_range(), libMesh::Elem::refine(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::Elem::subactive(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::MeshRefinement::test_level_one(), and libMesh::Parallel::Packing< Elem * >::unpack().

1985 {
1986 #ifdef LIBMESH_ENABLE_AMR
1987  if ((this->refinement_flag() == INACTIVE) ||
1988  (this->refinement_flag() == COARSEN_INACTIVE))
1989  return false;
1990  else
1991  return true;
1992 #else
1993  return true;
1994 #endif
1995 }
RefinementState refinement_flag() const
Definition: elem.h:2220
void libMesh::Elem::active_family_tree ( std::vector< const Elem * > &  active_family,
const bool  reset = true 
) const
inherited

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 1621 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::active_family_tree(), libMesh::Elem::child_ptr(), libMesh::Elem::is_remote(), libMesh::libmesh_assert(), libMesh::Elem::n_children(), and libMesh::Elem::subactive().

Referenced by libMesh::Elem::active_family_tree(), libMesh::ParmetisPartitioner::build_graph(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::SiblingCoupling::operator()(), libMesh::MetisPartitioner::partition_range(), and libMesh::Partitioner::set_parent_processor_ids().

1623 {
1624  // The "family tree" doesn't include subactive elements
1625  libmesh_assert(!this->subactive());
1626 
1627  // Clear the vector if the flag reset tells us to.
1628  if (reset)
1629  active_family.clear();
1630 
1631  // Add this element to the family tree if it is active
1632  if (this->active())
1633  active_family.push_back(this);
1634 
1635  // Otherwise recurse into the element's children.
1636  // Do not clear the vector any more.
1637  else
1638  for (unsigned int c=0; c<this->n_children(); c++)
1639  if (!this->child_ptr(c)->is_remote())
1640  this->child_ptr(c)->active_family_tree (active_family, false);
1641 }
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
void active_family_tree(std::vector< const Elem * > &active_family, const bool reset=true) const
Definition: elem.C:1621
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual bool is_remote() const
Definition: elem.h:458
virtual unsigned int n_children() const =0
void libMesh::Elem::active_family_tree_by_neighbor ( std::vector< const Elem * > &  family,
const Elem neighbor,
const bool  reset = true 
) const
inherited

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

Definition at line 1821 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::active_family_tree_by_neighbor(), libMesh::Elem::child_ptr(), libMesh::Elem::has_neighbor(), libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::Elem::n_children(), libMesh::remote_elem, and libMesh::Elem::subactive().

Referenced by libMesh::Elem::active_family_tree_by_neighbor(), libMesh::Elem::find_edge_neighbors(), libMesh::Patch::find_face_neighbors(), libMesh::Elem::find_point_neighbors(), libMesh::GhostPointNeighbors::operator()(), and libMesh::DefaultCoupling::operator()().

1824 {
1825  // The "family tree" doesn't include subactive elements or
1826  // remote_elements
1827  libmesh_assert(!this->subactive());
1828  libmesh_assert(this != remote_elem);
1829 
1830  // Clear the vector if the flag reset tells us to.
1831  if (reset)
1832  family.clear();
1833 
1834  // This only makes sense if we're already a neighbor
1835 #ifndef NDEBUG
1836  if (this->level() >= neighbor_in->level())
1837  libmesh_assert (this->has_neighbor(neighbor_in));
1838 #endif
1839 
1840  // Add an active element to the family tree.
1841  if (this->active())
1842  family.push_back(this);
1843 
1844  // Or recurse into an ancestor element's children.
1845  // Do not clear the vector any more.
1846  else if (!this->active())
1847  for (unsigned int c=0; c<this->n_children(); c++)
1848  {
1849  const Elem * current_child = this->child_ptr(c);
1850  if (current_child != remote_elem && current_child->has_neighbor(neighbor_in))
1851  current_child->active_family_tree_by_neighbor (family, neighbor_in, false);
1852  }
1853 }
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_children() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
bool has_neighbor(const Elem *elem) const
Definition: elem.h:1790
unsigned int level() const
Definition: elem.h:2115
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::Elem::active_family_tree_by_side ( std::vector< const Elem * > &  family,
const unsigned int  side,
const bool  reset = true 
) const
inherited

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

Definition at line 1671 of file elem.C.

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

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

1674 {
1675  // The "family tree" doesn't include subactive or remote elements
1676  libmesh_assert(!this->subactive());
1677  libmesh_assert(this != remote_elem);
1678 
1679  // Clear the vector if the flag reset tells us to.
1680  if (reset)
1681  family.clear();
1682 
1683  libmesh_assert_less (s, this->n_sides());
1684 
1685  // Add an active element to the family tree.
1686  if (this->active())
1687  family.push_back(this);
1688 
1689  // Or recurse into an ancestor element's children.
1690  // Do not clear the vector any more.
1691  else
1692  for (unsigned int c=0; c<this->n_children(); c++)
1693  if (!this->child_ptr(c)->is_remote() && this->is_child_on_side(c, s))
1694  this->child_ptr(c)->active_family_tree_by_side (family, s, false);
1695 }
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const =0
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_sides() const =0
virtual bool is_remote() const
Definition: elem.h:458
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:1671
const RemoteElem * remote_elem
Definition: remote_elem.C:57
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
inherited

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 1778 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::active_family_tree_by_topological_neighbor(), libMesh::Elem::child_ptr(), libMesh::Elem::has_topological_neighbor(), libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::Elem::n_children(), libMesh::remote_elem, and libMesh::Elem::subactive().

Referenced by libMesh::Elem::active_family_tree_by_topological_neighbor(), libMesh::Elem::family_tree_by_subneighbor(), and libMesh::DefaultCoupling::operator()().

1784 {
1785  // The "family tree" doesn't include subactive elements or
1786  // remote_elements
1787  libmesh_assert(!this->subactive());
1788  libmesh_assert(this != remote_elem);
1789 
1790  // Clear the vector if the flag reset tells us to.
1791  if (reset)
1792  family.clear();
1793 
1794  // This only makes sense if we're already a topological neighbor
1795 #ifndef NDEBUG
1796  if (this->level() >= neighbor_in->level())
1798  (neighbor_in, mesh, point_locator, pb));
1799 #endif
1800 
1801  // Add an active element to the family tree.
1802  if (this->active())
1803  family.push_back(this);
1804 
1805  // Or recurse into an ancestor element's children.
1806  // Do not clear the vector any more.
1807  else if (!this->active())
1808  for (unsigned int c=0; c<this->n_children(); c++)
1809  {
1810  const Elem * current_child = this->child_ptr(c);
1811  if (current_child != remote_elem &&
1812  current_child->has_topological_neighbor
1813  (neighbor_in, mesh, point_locator, pb))
1814  current_child->active_family_tree_by_topological_neighbor
1815  (family, neighbor_in, mesh, point_locator, pb, false);
1816  }
1817 }
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
bool has_topological_neighbor(const Elem *elem, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb) const
Definition: elem.C:1093
MeshBase & mesh
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_children() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
unsigned int level() const
Definition: elem.h:2115
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::Elem::add_child ( Elem elem)
inherited

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 1508 of file elem.C.

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

Referenced by libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::XdrIO::read_serialized_connectivity(), and libMesh::Parallel::Packing< Elem * >::unpack().

1509 {
1510  if(_children == libmesh_nullptr)
1511  {
1512  _children = new Elem *[this->n_children()];
1513 
1514  for (unsigned int c=0; c<this->n_children(); c++)
1515  this->set_child(c, libmesh_nullptr);
1516  }
1517 
1518  for (unsigned int c=0; c<this->n_children(); c++)
1519  {
1520  if(this->_children[c] == libmesh_nullptr || this->_children[c] == remote_elem)
1521  {
1522  libmesh_assert_equal_to (this, elem->parent());
1523  this->set_child(c, elem);
1524  return;
1525  }
1526  }
1527 
1528  libmesh_error_msg("Error: Tried to add a child to an element with full children array");
1529 }
const class libmesh_nullptr_t libmesh_nullptr
Elem ** _children
Definition: elem.h:1468
virtual unsigned int n_children() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
void set_child(unsigned int c, Elem *elem)
Definition: elem.h:2193
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::Elem::add_child ( Elem elem,
unsigned int  c 
)
inherited

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 1533 of file elem.C.

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

1534 {
1535  if(!this->has_children())
1536  {
1537  _children = new Elem *[this->n_children()];
1538 
1539  for (unsigned int i=0; i<this->n_children(); i++)
1540  this->set_child(i, libmesh_nullptr);
1541  }
1542 
1543  libmesh_assert (this->_children[c] == libmesh_nullptr || this->child_ptr(c) == remote_elem);
1544  libmesh_assert (elem == remote_elem || this == elem->parent());
1545 
1546  this->set_child(c, elem);
1547 }
bool has_children() const
Definition: elem.h:2022
const Elem * parent() const
Definition: elem.h:2073
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
Elem ** _children
Definition: elem.h:1468
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_children() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
void set_child(unsigned int c, Elem *elem)
Definition: elem.h:2193
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::DofObject::add_system ( )
inherited

Adds an additional system to the DofObject

Definition at line 187 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().

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

188 {
189  // quick return?
190  if (this->n_systems() == 0)
191  {
192  this->set_n_systems(1);
193  return;
194  }
195 
196  DofObject::index_buffer_t::iterator it = _idx_buf.begin();
197 
198  std::advance(it, this->n_systems());
199 
200  // this inserts the current vector size at the position for the new system - creating the
201  // entry we need for the new system indicating there are 0 variables.
202  _idx_buf.insert(it, cast_int<dof_id_type>(_idx_buf.size()));
203 
204  // cache this value before we screw it up!
205  const unsigned int ns_orig = this->n_systems();
206 
207  // incriment the number of systems and the offsets for each of
208  // the systems including the new one we just added.
209  for (unsigned int i=0; i<ns_orig+1; i++)
210  _idx_buf[i]++;
211 
212  libmesh_assert_equal_to (this->n_systems(), (ns_orig+1));
213  libmesh_assert_equal_to (this->n_vars(ns_orig), 0);
214  libmesh_assert_equal_to (this->n_var_groups(ns_orig), 0);
215 }
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:737
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:727
void set_n_systems(const unsigned int s)
Definition: dof_object.C:157
index_buffer_t _idx_buf
Definition: dof_object.h:477
unsigned int n_systems() const
Definition: dof_object.h:718
bool libMesh::Elem::ancestor ( ) const
inherited
Returns
true if the element is an ancestor (i.e. has an active child or ancestor child), false otherwise. Always returns false if AMR is disabled.

Definition at line 1473 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::ancestor(), libMesh::Elem::child_ptr(), libMesh::Elem::has_children(), libMesh::libmesh_assert(), libMesh::Elem::n_children(), libMesh::remote_elem, and libMesh::Elem::subactive().

Referenced by libMesh::Elem::ancestor(), libMesh::UnstructuredMesh::contract(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::Elem::get_info(), libMesh::Elem::is_linear(), libMesh::MeshTools::libmesh_assert_valid_refinement_tree(), libMesh::MeshRefinement::make_coarsening_compatible(), and libMesh::Elem::refine().

1474 {
1475 #ifdef LIBMESH_ENABLE_AMR
1476 
1477  // Use a fast, DistributedMesh-safe definition
1478  const bool is_ancestor =
1479  !this->active() && !this->subactive();
1480 
1481  // But check for inconsistencies if we have time
1482 #ifdef DEBUG
1483  if (!is_ancestor && this->has_children())
1484  {
1485  for (unsigned int c=0; c != this->n_children(); ++c)
1486  {
1487  const Elem * kid = this->child_ptr(c);
1488  if (kid != remote_elem)
1489  {
1490  libmesh_assert(!kid->active());
1491  libmesh_assert(!kid->ancestor());
1492  }
1493  }
1494  }
1495 #endif // DEBUG
1496 
1497  return is_ancestor;
1498 
1499 #else
1500  return false;
1501 #endif
1502 }
bool has_children() const
Definition: elem.h:2022
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_children() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
const RemoteElem * remote_elem
Definition: remote_elem.C:57
unsigned int libMesh::Elem::as_parent_node ( unsigned int  c,
unsigned int  n 
) const
virtualinherited

Returns the local node id on the parent which corresponds to node n of child c, or returns invalid_uint if no such parent node exists.

Definition at line 1929 of file elem.C.

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

Referenced by libMesh::MeshRefinement::add_node(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::Elem::origin(), and libMesh::Elem::parent_bracketing_nodes().

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

Iterator accessor functions

Definition at line 2787 of file elem.C.

References libMesh::Elem::_first_side(), and libMesh::Elem::_last_side().

2788 {
2789  Predicates::BoundarySide<SideIter> bsp;
2790  return side_iterator(this->_first_side(), this->_last_side(), bsp);
2791 }
SideIter _last_side()
Definition: elem.h:2545
SideIter _first_side()
Definition: elem.h:2537
Elem::side_iterator libMesh::Elem::boundary_sides_end ( )
inherited

Definition at line 2796 of file elem.C.

References libMesh::Elem::_last_side().

2797 {
2798  Predicates::BoundarySide<SideIter> bsp;
2799  return side_iterator(this->_last_side(), this->_last_side(), bsp);
2800 }
SideIter _last_side()
Definition: elem.h:2545
const std::vector< std::pair< dof_id_type, dof_id_type > > libMesh::Elem::bracketing_nodes ( unsigned int  c,
unsigned int  n 
) const
virtualinherited

Returns all the pairs of nodes (indexed by global node id) which should bracket node n of child c.

Definition at line 2201 of file elem.C.

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

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

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

Build an element of type type. Since this method allocates memory, the new Elem is returned in a UniquePtr<>.

Definition at line 234 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_nullptr, libMesh::NODEELEM, libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM6, libMesh::PYRAMID13, libMesh::PYRAMID14, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::QUADSHELL4, libMesh::TET10, libMesh::TET4, libMesh::TRI3, libMesh::TRI3SUBDIVISION, libMesh::TRI6, and libMesh::TRISHELL3.

Referenced by libMesh::GMVIO::_read_one_cell(), libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::all_second_order(), libMesh::Elem::bracketing_nodes(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::MeshTools::Generation::build_sphere(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTools::Modification::flatten(), libMesh::Elem::origin(), libMesh::Elem::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(), libMesh::Elem::refine(), libMesh::Parallel::Packing< Elem * >::unpack(), and libMesh::GMVIO::write_ascii_old_impl().

236 {
237  Elem * elem = libmesh_nullptr;
238 
239  switch (type)
240  {
241  // 0D elements
242  case NODEELEM:
243  {
244  elem = new NodeElem(p);
245  break;
246  }
247 
248  // 1D elements
249  case EDGE2:
250  {
251  elem = new Edge2(p);
252  break;
253  }
254  case EDGE3:
255  {
256  elem = new Edge3(p);
257  break;
258  }
259  case EDGE4:
260  {
261  elem = new Edge4(p);
262  break;
263  }
264 
265 
266 
267  // 2D elements
268  case TRI3:
269  {
270  elem = new Tri3(p);
271  break;
272  }
273  case TRISHELL3:
274  {
275  elem = new TriShell3(p);
276  break;
277  }
278  case TRI3SUBDIVISION:
279  {
280  elem = new Tri3Subdivision(p);
281  break;
282  }
283  case TRI6:
284  {
285  elem = new Tri6(p);
286  break;
287  }
288  case QUAD4:
289  {
290  elem = new Quad4(p);
291  break;
292  }
293  case QUADSHELL4:
294  {
295  elem = new QuadShell4(p);
296  break;
297  }
298  case QUAD8:
299  {
300  elem = new Quad8(p);
301  break;
302  }
303  case QUAD9:
304  {
305  elem = new Quad9(p);
306  break;
307  }
308 
309 
310  // 3D elements
311  case TET4:
312  {
313  elem = new Tet4(p);
314  break;
315  }
316  case TET10:
317  {
318  elem = new Tet10(p);
319  break;
320  }
321  case HEX8:
322  {
323  elem = new Hex8(p);
324  break;
325  }
326  case HEX20:
327  {
328  elem = new Hex20(p);
329  break;
330  }
331  case HEX27:
332  {
333  elem = new Hex27(p);
334  break;
335  }
336  case PRISM6:
337  {
338  elem = new Prism6(p);
339  break;
340  }
341  case PRISM15:
342  {
343  elem = new Prism15(p);
344  break;
345  }
346  case PRISM18:
347  {
348  elem = new Prism18(p);
349  break;
350  }
351  case PYRAMID5:
352  {
353  elem = new Pyramid5(p);
354  break;
355  }
356  case PYRAMID13:
357  {
358  elem = new Pyramid13(p);
359  break;
360  }
361  case PYRAMID14:
362  {
363  elem = new Pyramid14(p);
364  break;
365  }
366 
367 
368 
369 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
370 
371  // 1D infinite elements
372  case INFEDGE2:
373  {
374  elem = new InfEdge2(p);
375  break;
376  }
377 
378 
379  // 2D infinite elements
380  case INFQUAD4:
381  {
382  elem = new InfQuad4(p);
383  break;
384  }
385  case INFQUAD6:
386  {
387  elem = new InfQuad6(p);
388  break;
389  }
390 
391 
392  // 3D infinite elements
393  case INFHEX8:
394  {
395  elem = new InfHex8(p);
396  break;
397  }
398  case INFHEX16:
399  {
400  elem = new InfHex16(p);
401  break;
402  }
403  case INFHEX18:
404  {
405  elem = new InfHex18(p);
406  break;
407  }
408  case INFPRISM6:
409  {
410  elem = new InfPrism6(p);
411  break;
412  }
413  case INFPRISM12:
414  {
415  elem = new InfPrism12(p);
416  break;
417  }
418 
419 #endif
420 
421  default:
422  libmesh_error_msg("ERROR: Undefined element type!");
423  }
424 
425  return UniquePtr<Elem>(elem);
426 }
virtual ElemType type() const =0
const class libmesh_nullptr_t libmesh_nullptr
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
UniquePtr< Elem > libMesh::Elem::build_edge ( const unsigned int  i) const
inlineinherited

Creates an element coincident with edge i.

This is deprecated and will be removed, since it returns a non-const pointer to an edge that could be used to indirectly modify this. Please use the the const-correct build_edge_ptr() function instead.

Definition at line 1890 of file elem.h.

References libMesh::Elem::build_edge_ptr().

Referenced by libMesh::Elem::is_vertex_on_child().

1891 {
1892  // Call the const version of build_edge_ptr(), and const_cast the result.
1893  libmesh_deprecated();
1894  Elem * e = const_cast<Elem *>(this->build_edge_ptr(i).release());
1895  return UniquePtr<Elem>(e);
1896 }
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
virtual UniquePtr< Elem > build_edge_ptr(const unsigned int i)=0
virtual UniquePtr<Elem> libMesh::RemoteElem::build_edge_ptr ( const unsigned  i)
inlinevirtual

Creates an element coincident with edge i. 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 UniquePtr<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.

Implements libMesh::Elem.

Definition at line 158 of file remote_elem.h.

159  { libmesh_not_implemented(); return UniquePtr<Elem>(); }
UniquePtr< const Elem > libMesh::Elem::build_edge_ptr ( const unsigned int  i) const
inlineinherited

Definition at line 1877 of file elem.h.

References libMesh::Elem::build_edge_ptr().

1878 {
1879  // Call the non-const version of this function, return the result as
1880  // a UniquePtr<const Elem>.
1881  Elem * me = const_cast<Elem *>(this);
1882  const Elem * e = const_cast<const Elem *>(me->build_edge_ptr(i).release());
1883  return UniquePtr<const Elem>(e);
1884 }
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
UniquePtr< Elem > libMesh::Elem::build_side ( const unsigned int  i,
bool  proxy = true 
) const
inlineinherited
Returns
a proxy element coincident with side i.

This method is deprecated and will be removed, since it returns 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 1865 of file elem.h.

References libMesh::Elem::build_side_ptr().

Referenced by libMesh::Elem::is_vertex_on_child().

1866 {
1867  // Call the const version of build_side_ptr(), and const_cast the result.
1868  libmesh_deprecated();
1869  Elem * s = const_cast<Elem *>(this->build_side_ptr(i, proxy).release());
1870  return UniquePtr<Elem>(s);
1871 }
virtual UniquePtr< 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:1517
virtual UniquePtr<Elem> libMesh::RemoteElem::build_side_ptr ( const unsigned  i,
bool  proxy 
)
inlinevirtual

Creates an element coincident with side i. 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 UniquePtr<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 return 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.

Implements libMesh::Elem.

Definition at line 154 of file remote_elem.h.

156  { libmesh_not_implemented(); return UniquePtr<Elem>(); }
UniquePtr< const Elem > libMesh::Elem::build_side_ptr ( const unsigned int  i,
bool  proxy = true 
) const
inlineinherited

Definition at line 1852 of file elem.h.

References libMesh::Elem::build_side_ptr().

1853 {
1854  // Call the non-const version of this function, return the result as
1855  // a UniquePtr<const Elem>.
1856  Elem * me = const_cast<Elem *>(this);
1857  const Elem * s = const_cast<const Elem *>(me->build_side_ptr(i, proxy).release());
1858  return UniquePtr<const Elem>(s);
1859 }
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
Point libMesh::Elem::centroid ( ) const
virtualinherited
Returns
the centriod of the element. The centroid is computed as the average of all the element vertices. This method is overloadable since some derived elements might want to use shortcuts to compute their centroid.

Definition at line 437 of file elem.C.

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

Referenced by libMesh::CentroidPartitioner::compute_centroids(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::BoundaryInfo::get_side_and_node_maps(), libMesh::Elem::is_vertex_on_child(), libMesh::SFCPartitioner::partition_range(), libMesh::LocationMap< T >::point_of(), libMesh::FE< Dim, T >::shape(), libMesh::FE< Dim, T >::shape_deriv(), and libMesh::FE< Dim, T >::shape_second_deriv().

438 {
439  Point cp;
440 
441  for (unsigned int n=0; n<this->n_vertices(); n++)
442  cp.add (this->point(n));
443 
444  return (cp /= static_cast<Real>(this->n_vertices()));
445 }
virtual unsigned int n_vertices() const =0
Elem * libMesh::Elem::child ( const unsigned int  i) const
inlineinherited

This function is now deprecated, use the more accurately-named and const correct child_ptr() function instead.

Definition at line 2182 of file elem.h.

References libMesh::Elem::child_ptr().

Referenced by libMesh::Elem::as_parent_node(), libMesh::Elem::bracketing_nodes(), libMesh::Elem::find_interior_neighbors(), and libMesh::Elem::parent_bracketing_nodes().

2183 {
2184  // Support the deprecated interface by calling the new,
2185  // const-correct interface and casting the result to an Elem *.
2186  libmesh_deprecated();
2187  return const_cast<Elem *>(this->child_ptr(i));
2188 }
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
Elem * libMesh::Elem::child_neighbor ( Elem elem)
inlineinherited

If the element elem in question is a neighbor of a child of this element, this returns a pointer to that child. Otherwise it returns NULL.

Definition at line 1802 of file elem.h.

References libmesh_nullptr, libMesh::Elem::n_neighbors(), libMesh::Elem::neighbor_ptr(), and libMesh::Elem::parent().

1803 {
1804  for (unsigned int n=0; n<elem->n_neighbors(); n++)
1805  if (elem->neighbor_ptr(n) &&
1806  elem->neighbor_ptr(n)->parent() == this)
1807  return elem->neighbor_ptr(n);
1808 
1809  return libmesh_nullptr;
1810 }
const class libmesh_nullptr_t libmesh_nullptr
const Elem * libMesh::Elem::child_neighbor ( const Elem elem) const
inlineinherited

If the element elem in question is a neighbor of a child of this element, this returns a pointer to that child. Otherwise it returns NULL.

Definition at line 1815 of file elem.h.

References libmesh_nullptr, libMesh::Elem::n_neighbors(), libMesh::Elem::neighbor_ptr(), and libMesh::Elem::parent().

1816 {
1817  for (unsigned int n=0; n<elem->n_neighbors(); n++)
1818  if (elem->neighbor_ptr(n) &&
1819  elem->neighbor_ptr(n)->parent() == this)
1820  return elem->neighbor_ptr(n);
1821 
1822  return libmesh_nullptr;
1823 }
const class libmesh_nullptr_t libmesh_nullptr
const Elem * libMesh::Elem::child_ptr ( unsigned int  i) const
inlineinherited
Returns
a 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 2163 of file elem.h.

References libMesh::Elem::_children, and libMesh::libmesh_assert().

Referenced by libMesh::Elem::active_family_tree(), libMesh::Elem::active_family_tree_by_neighbor(), libMesh::Elem::active_family_tree_by_side(), libMesh::Elem::active_family_tree_by_topological_neighbor(), libMesh::Elem::add_child(), libMesh::HPCoarsenTest::add_projection(), libMesh::UnstructuredMesh::all_first_order(), libMesh::Elem::ancestor(), libMesh::Elem::bracketing_nodes(), libMesh::OldSolutionValue< Output, point_output >::check_old_context(), libMesh::Elem::child(), libMesh::Elem::coarsen(), libMesh::FEGenericBase< OutputType >::coarsened_dof_values(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::Elem::family_tree(), libMesh::Elem::family_tree_by_neighbor(), libMesh::Elem::family_tree_by_side(), libMesh::Elem::family_tree_by_subneighbor(), libMesh::TopologyMap::fill(), libMesh::Elem::find_interior_neighbors(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::Elem::has_ancestor_children(), libMesh::Elem::is_vertex_on_parent(), libMesh::MeshTools::libmesh_assert_no_links_to_elem(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_refinement_tree(), libMesh::MeshTools::libmesh_assert_valid_remote_elems(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::Elem::make_links_to_me_remote(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::Elem::max_descendant_p_level(), libMesh::Elem::min_new_p_level_by_neighbor(), libMesh::Elem::min_p_level_by_neighbor(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::operator()(), libMesh::BuildProjectionList::operator()(), libMesh::Elem::refine(), libMesh::Elem::replace_child(), libMesh::Elem::set_p_level(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::MeshTools::Modification::smooth(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Elem::total_family_tree(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::Elem::which_child_am_i(), and libMesh::XdrIO::write_serialized_connectivity().

2164 {
2167 
2168  return _children[i];
2169 }
libmesh_assert(j)
Elem ** _children
Definition: elem.h:1468
Elem * libMesh::Elem::child_ptr ( unsigned int  i)
inlineinherited
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 2172 of file elem.h.

References libMesh::Elem::_children, and libMesh::libmesh_assert().

2173 {
2176 
2177  return _children[i];
2178 }
libmesh_assert(j)
Elem ** _children
Definition: elem.h:1468
void libMesh::Singleton::cleanup ( )
staticinherited

Cleanup function. Removes all dynamically created Singleton objects.

Definition at line 96 of file libmesh_singleton.C.

References libMesh::libmesh_assert(), and libmesh_nullptr.

Referenced by libMesh::LibMeshInit::LibMeshInit(), and libMesh::Singleton::Setup::~Setup().

97 {
98  SingletonMutex::scoped_lock lock(singleton_mtx);
99 
100  SingletonList & singleton_cache = get_singleton_cache();
101 
102  for (SingletonList::reverse_iterator it = singleton_cache.rbegin();
103  it!=singleton_cache.rend(); ++it)
104  {
106  delete *it;
107  *it = libmesh_nullptr;
108  }
109 
110  singleton_cache.clear();
111 }
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
void libMesh::DofObject::clear_dofs ( )
inlineinherited

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

Definition at line 590 of file dof_object.h.

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

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

591 {
592  // vector swap trick to force deallocation
593  index_buffer_t().swap(_idx_buf);
594 
595  libmesh_assert_equal_to (this->n_systems(), 0);
596  libmesh_assert (_idx_buf.empty());
597 }
libmesh_assert(j)
std::vector< index_t > index_buffer_t
Definition: dof_object.h:476
index_buffer_t _idx_buf
Definition: dof_object.h:477
unsigned int n_systems() const
Definition: dof_object.h:718
void libMesh::DofObject::clear_old_dof_object ( )
inherited

Sets the old_dof_object to libmesh_nullptr

Definition at line 134 of file dof_object.C.

References libmesh_nullptr, and libMesh::DofObject::old_dof_object.

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

135 {
136  delete this->old_dof_object;
138 }
const class libmesh_nullptr_t libmesh_nullptr
DofObject * old_dof_object
Definition: dof_object.h:89
bool libMesh::Elem::close_to_point ( const Point p,
Real  tol 
) const
virtualinherited
Returns
true if this element is "close" to the point p, where "close" is determined by the tolerance tol.

Definition at line 2321 of file elem.C.

References libMesh::Elem::point_test().

Referenced by libMesh::OldSolutionValue< Output, point_output >::check_old_context(), and libMesh::Elem::qual_bounds().

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

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

Definition at line 104 of file elem_refinement.C.

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

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

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

Compute a hash key from the specified nodes.

Definition at line 2344 of file elem.h.

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

2346 {
2347  // Order the two so that n0 < n1
2348  if (n0 > n1) std::swap (n0, n1);
2349 
2350  return Utility::hashword2(n0, n1);
2351 }
void swap(Iterator &lhs, Iterator &rhs)
uint32_t hashword2(const uint32_t &first, const uint32_t &second, uint32_t initval=0)
Definition: hashword.h:189
dof_id_type libMesh::Elem::compute_key ( dof_id_type  n0,
dof_id_type  n1,
dof_id_type  n2 
)
inlinestaticprotectedinherited

Compute a hash key from the specified nodes.

Definition at line 2356 of file elem.h.

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

2359 {
2360  // Order the numbers such that n0 < n1 < n2.
2361  // We'll do it in 3 steps like this:
2362  //
2363  // n0 n1 n2
2364  // min(n0,n1) max(n0,n1) n2
2365  // min(n0,n1) min(n2,max(n0,n1) max(n2,max(n0,n1)
2366  // |\ /| |
2367  // | \ / | |
2368  // | / | |
2369  // | / \| |
2370  // gb min= min max gb max
2371 
2372  // Step 1
2373  if (n0 > n1) std::swap (n0, n1);
2374 
2375  // Step 2
2376  if (n1 > n2) std::swap (n1, n2);
2377 
2378  // Step 3
2379  if (n0 > n1) std::swap (n0, n1);
2380 
2381  libmesh_assert ((n0 < n1) && (n1 < n2));
2382 
2383  dof_id_type array[3] = {n0, n1, n2};
2384  return Utility::hashword(array, 3);
2385 }
libmesh_assert(j)
uint32_t hashword(const uint32_t *k, size_t length, uint32_t initval=0)
Definition: hashword.h:141
void swap(Iterator &lhs, Iterator &rhs)
uint8_t dof_id_type
Definition: id_types.h:64
dof_id_type libMesh::Elem::compute_key ( dof_id_type  n0,
dof_id_type  n1,
dof_id_type  n2,
dof_id_type  n3 
)
inlinestaticprotectedinherited

Compute a hash key from the specified nodes.

Definition at line 2390 of file elem.h.

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

2394 {
2395  // Sort first
2396  // Step 1
2397  if (n0 > n1) std::swap (n0, n1);
2398 
2399  // Step 2
2400  if (n2 > n3) std::swap (n2, n3);
2401 
2402  // Step 3
2403  if (n0 > n2) std::swap (n0, n2);
2404 
2405  // Step 4
2406  if (n1 > n3) std::swap (n1, n3);
2407 
2408  // Finally sort step 5
2409  if (n1 > n2) std::swap (n1, n2);
2410 
2411  libmesh_assert ((n0 < n1) && (n1 < n2) && (n2 < n3));
2412 
2413  dof_id_type array[4] = {n0, n1, n2, n3};
2414  return Utility::hashword(array, 4);
2415 }
libmesh_assert(j)
uint32_t hashword(const uint32_t *k, size_t length, uint32_t initval=0)
Definition: hashword.h:141
void swap(Iterator &lhs, Iterator &rhs)
uint8_t dof_id_type
Definition: id_types.h:64
virtual void libMesh::RemoteElem::connectivity ( const unsigned  sc,
const IOPackage  iop,
std::vector< dof_id_type > &  conn 
) const
inlinevirtual

Returns the connectivity for this element in a specific format, which is specified by the IOPackage tag. This method supercedes the tecplot_connectivity(...) and vtk_connectivity(...) routines.

Implements libMesh::Elem.

Definition at line 94 of file remote_elem.h.

97  { libmesh_not_implemented(); }
bool libMesh::Elem::contains_edge_of ( const Elem e) const
inherited

This function 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 570 of file elem.C.

References libMesh::Elem::contains_point(), libMesh::Elem::n_vertices(), and libMesh::Elem::point().

Referenced by libMesh::Elem::find_edge_neighbors().

571 {
572  unsigned int num_contained_edges = 0;
573 
574  // Our vertices are the first numbered nodes
575  for (unsigned int n = 0; n != e->n_vertices(); ++n)
576  {
577  if (this->contains_point(e->point(n)))
578  {
579  num_contained_edges++;
580  if(num_contained_edges>=2)
581  {
582  return true;
583  }
584  }
585  }
586  return false;
587 }
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
Definition: elem.C:2296
bool libMesh::Elem::contains_point ( const Point p,
Real  tol = TOLERANCE 
) const
virtualinherited
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 that 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::Tri3, libMesh::InfHex8, libMesh::InfPrism6, and libMesh::InfQuad4.

Definition at line 2296 of file elem.C.

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

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

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

This function returns true if a vertex of e is contained in this element.

Definition at line 559 of file elem.C.

References libMesh::Elem::contains_point(), libMesh::Elem::n_vertices(), and libMesh::Elem::point().

Referenced by libMesh::Elem::find_interior_neighbors(), and libMesh::Elem::find_point_neighbors().

560 {
561  // Our vertices are the first numbered nodes
562  for (unsigned int n = 0; n != e->n_vertices(); ++n)
563  if (this->contains_point(e->point(n)))
564  return true;
565  return false;
566 }
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
Definition: elem.C:2296
void libMesh::Elem::contract ( )
inherited

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 170 of file elem_refinement.C.

References libMesh::Elem::_children, libMesh::Elem::active(), libMesh::Elem::DO_NOTHING, libMesh::Elem::JUST_COARSENED, libMesh::libmesh_assert(), libmesh_nullptr, libMesh::Elem::refinement_flag(), and libMesh::Elem::set_refinement_flag().

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

171 {
172  // Subactive elements get deleted entirely, not contracted
173  libmesh_assert (this->active());
174 
175  // Active contracted elements no longer can have children
176  delete [] _children;
178 
179  if (this->refinement_flag() == Elem::JUST_COARSENED)
181 }
bool active() const
Definition: elem.h:1984
const class libmesh_nullptr_t libmesh_nullptr
void set_refinement_flag(const RefinementState rflag)
Definition: elem.h:2228
libmesh_assert(j)
Elem ** _children
Definition: elem.h:1468
RefinementState refinement_flag() const
Definition: elem.h:2220
const Elem & libMesh::RemoteElem::create ( )
static

Return a reference to the global RemoteElem sigleton object.

Definition at line 69 of file remote_elem.C.

References libmesh_nullptr, and libMesh::remote_elem.

Referenced by RemoteElem().

70 {
72  return *remote_elem;
73 
74  RemoteElemMutex::scoped_lock lock(remote_elem_mtx);
75 
76  // check again - object could have been created while waiting
77  // for the lock to acquire!
79  remote_elem = new RemoteElem;
80 
81  return *remote_elem;
82 }
const class libmesh_nullptr_t libmesh_nullptr
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::DofObject::debug_buffer ( ) const
inherited

Print our buffer for debugging.

Definition at line 542 of file dof_object.C.

References libMesh::DofObject::_idx_buf, and libMesh::out.

543 {
544  libMesh::out << " [ ";
545  for (std::size_t i=0; i<_idx_buf.size(); i++)
546  libMesh::out << _idx_buf[i] << " ";
547  libMesh::out << "]\n";
548 }
index_buffer_t _idx_buf
Definition: dof_object.h:477
OStreamProxy out(std::cout)
virtual Order libMesh::RemoteElem::default_order ( ) const
inlinevirtual
Returns
the default approximation order for this element type. This is the order that will be used to compute the map to the reference element.

Implements libMesh::Elem.

Definition at line 161 of file remote_elem.h.

References libMesh::FIRST.

162  { libmesh_not_implemented(); return FIRST; }
virtual unsigned int libMesh::RemoteElem::dim ( ) const
inlinevirtual
Returns
the dimensionality of the object.

Implements libMesh::Elem.

Definition at line 102 of file remote_elem.h.

103  { libmesh_not_implemented(); return 0; }
void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited
void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited
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 802 of file dof_object.h.

References libMesh::DofObject::_idx_buf, libMesh::DofObject::invalid_id, libMesh::DofObject::n_comp(), libMesh::DofObject::n_comp_group(), libMesh::DofObject::n_systems(), libMesh::DofObject::n_vars(), libMesh::DofObject::start_idx(), libMesh::DofObject::system_var_to_vg_var(), and libMesh::DofObject::var_to_vg().

Referenced by libMesh::DofMap::_dof_indices(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEGenericBase< OutputType >::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::Node::get_info(), libMesh::Elem::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(), libMesh::DofObject::set_id(), libMesh::DofMap::set_nonlocal_dof_objects(), and libMesh::System::zero_variable().

805 {
806  libmesh_assert_less (s, this->n_systems());
807  libmesh_assert_less (var, this->n_vars(s));
808  libmesh_assert_less (comp, this->n_comp(s,var));
809 
810  const unsigned int
811  vg = this->var_to_vg(s,var),
812  start_idx_sys = this->start_idx(s);
813 
814  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
815 
816  const dof_id_type
817  base_idx = _idx_buf[start_idx_sys + 2*vg + 1];
818 
819  // if the first component is invalid, they
820  // are all invalid
821  if (base_idx == invalid_id)
822  return invalid_id;
823 
824  // otherwise the index is the first component
825  // index augemented by the component number
826  else
827  {
828  const unsigned int
829  ncg = this->n_comp_group(s,vg),
830  vig = this->system_var_to_vg_var(s,vg,var);
831 
832  // std::cout << "base_idx, var, vg, vig, ncg, comp="
833  // << base_idx << " "
834  // << var << " "
835  // << vg << " "
836  // << vig << " "
837  // << ncg << " "
838  // << comp << '\n';
839 
840  return cast_int<dof_id_type>(base_idx + vig*ncg + comp);
841  }
842 }
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:785
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:737
unsigned int system_var_to_vg_var(const unsigned int s, const unsigned int vg, const unsigned int var) const
Definition: dof_object.h:957
static const dof_id_type invalid_id
Definition: dof_object.h:335
unsigned int start_idx(const unsigned int s) const
Definition: dof_object.h:870
unsigned int var_to_vg(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:938
index_buffer_t _idx_buf
Definition: dof_object.h:477
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:772
unsigned int n_systems() const
Definition: dof_object.h:718
uint8_t dof_id_type
Definition: id_types.h:64
virtual float libMesh::RemoteElem::embedding_matrix ( const unsigned int  ,
const unsigned int  ,
const unsigned int   
) const
inlinevirtual

Matrix that transforms the parents nodes into the children's nodes.

Implements libMesh::Elem.

Definition at line 177 of file remote_elem.h.

180  { libmesh_not_implemented(); return 0.; }
virtual unsigned int libMesh::Elem::embedding_matrix_version ( ) const
inlinevirtualinherited

Some element types may use a different embedding matrix for different elements. But we may want to cache data based on that matrix. So we return a "version number" that can be used to identify which matrix is in use.

Reimplemented in libMesh::Tet.

Definition at line 1377 of file elem.h.

References libMesh::Elem::compute_key().

Referenced by libMesh::Elem::as_parent_node(), and libMesh::Elem::parent_bracketing_nodes().

1377 { return 0; }
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.

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

101 {
102  _enable_print_counter = true;
103  return;
104 }
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.

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

101 {
102  _enable_print_counter = true;
103  return;
104 }
void libMesh::Elem::family_tree ( std::vector< const Elem * > &  family,
const bool  reset = true 
) const
inherited

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 1578 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::child_ptr(), libMesh::Elem::family_tree(), libMesh::Elem::is_remote(), libMesh::libmesh_assert(), libMesh::Elem::n_children(), and libMesh::Elem::subactive().

Referenced by libMesh::Elem::family_tree(), and libMesh::MeshCommunication::gather_neighboring_elements().

1580 {
1581  // The "family tree" doesn't include subactive elements
1582  libmesh_assert(!this->subactive());
1583 
1584  // Clear the vector if the flag reset tells us to.
1585  if (reset)
1586  family.clear();
1587 
1588  // Add this element to the family tree.
1589  family.push_back(this);
1590 
1591  // Recurse into the elements children, if it has them.
1592  // Do not clear the vector any more.
1593  if (!this->active())
1594  for (unsigned int c=0; c<this->n_children(); c++)
1595  if (!this->child_ptr(c)->is_remote())
1596  this->child_ptr(c)->family_tree (family, false);
1597 }
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual bool is_remote() const
Definition: elem.h:458
virtual unsigned int n_children() const =0
void family_tree(std::vector< const Elem * > &family, const bool reset=true) const
Definition: elem.C:1578
void libMesh::Elem::family_tree_by_neighbor ( std::vector< const Elem * > &  family,
const Elem neighbor,
const bool  reset = true 
) const
inherited

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

Definition at line 1699 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::child_ptr(), libMesh::Elem::family_tree_by_neighbor(), libMesh::Elem::has_neighbor(), libMesh::libmesh_assert(), libMesh::Elem::n_children(), libMesh::remote_elem, and libMesh::Elem::subactive().

Referenced by libMesh::Elem::family_tree_by_neighbor(), and libMesh::Elem::make_links_to_me_remote().

1702 {
1703  // The "family tree" doesn't include subactive elements
1704  libmesh_assert(!this->subactive());
1705 
1706  // Clear the vector if the flag reset tells us to.
1707  if (reset)
1708  family.clear();
1709 
1710  // This only makes sense if we're already a neighbor
1711  libmesh_assert (this->has_neighbor(neighbor_in));
1712 
1713  // Add this element to the family tree.
1714  family.push_back(this);
1715 
1716  // Recurse into the elements children, if it's not active.
1717  // Do not clear the vector any more.
1718  if (!this->active())
1719  for (unsigned int c=0; c<this->n_children(); c++)
1720  {
1721  const Elem * current_child = this->child_ptr(c);
1722  if (current_child != remote_elem && current_child->has_neighbor(neighbor_in))
1723  current_child->family_tree_by_neighbor (family, neighbor_in, false);
1724  }
1725 }
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_children() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
bool has_neighbor(const Elem *elem) const
Definition: elem.h:1790
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::Elem::family_tree_by_side ( std::vector< const Elem * > &  family,
const unsigned int  side,
const bool  reset = true 
) const
inherited

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

Definition at line 1645 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::child_ptr(), libMesh::Elem::family_tree_by_side(), libMesh::Elem::is_child_on_side(), libMesh::Elem::is_remote(), libMesh::libmesh_assert(), libMesh::Elem::n_children(), libMesh::Elem::n_sides(), and libMesh::Elem::subactive().

Referenced by libMesh::Elem::family_tree_by_side(), and libMesh::Elem::make_links_to_me_local().

1648 {
1649  // The "family tree" doesn't include subactive elements
1650  libmesh_assert(!this->subactive());
1651 
1652  // Clear the vector if the flag reset tells us to.
1653  if (reset)
1654  family.clear();
1655 
1656  libmesh_assert_less (s, this->n_sides());
1657 
1658  // Add this element to the family tree.
1659  family.push_back(this);
1660 
1661  // Recurse into the elements children, if it has them.
1662  // Do not clear the vector any more.
1663  if (!this->active())
1664  for (unsigned int c=0; c<this->n_children(); c++)
1665  if (!this->child_ptr(c)->is_remote() && this->is_child_on_side(c, s))
1666  this->child_ptr(c)->family_tree_by_side (family, s, false);
1667 }
void family_tree_by_side(std::vector< const Elem * > &family, const unsigned int side, const bool reset=true) const
Definition: elem.C:1645
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const =0
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_sides() const =0
virtual bool is_remote() const
Definition: elem.h:458
virtual unsigned int n_children() const =0
void libMesh::Elem::family_tree_by_subneighbor ( std::vector< const Elem * > &  family,
const Elem neighbor,
const Elem subneighbor,
const bool  reset = true 
) const
inherited

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 1729 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::active_family_tree_by_topological_neighbor(), libMesh::Elem::child_ptr(), libMesh::Elem::family_tree_by_subneighbor(), libMesh::Elem::has_neighbor(), libMesh::Elem::is_ancestor_of(), libMesh::libmesh_assert(), libMesh::Elem::n_children(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), libMesh::remote_elem, and libMesh::Elem::subactive().

Referenced by libMesh::Elem::family_tree_by_subneighbor(), and libMesh::Elem::make_links_to_me_remote().

1733 {
1734  // The "family tree" doesn't include subactive elements
1735  libmesh_assert(!this->subactive());
1736 
1737  // Clear the vector if the flag reset tells us to.
1738  if (reset)
1739  family.clear();
1740 
1741  // To simplifly this function we need an existing neighbor
1742  libmesh_assert (neighbor_in);
1743  libmesh_assert_not_equal_to (neighbor_in, remote_elem);
1744  libmesh_assert (this->has_neighbor(neighbor_in));
1745 
1746  // This only makes sense if subneighbor descends from neighbor
1747  libmesh_assert (subneighbor);
1748  libmesh_assert_not_equal_to (subneighbor, remote_elem);
1749  libmesh_assert (neighbor_in->is_ancestor_of(subneighbor));
1750 
1751  // Add this element to the family tree if applicable.
1752  if (neighbor_in == subneighbor)
1753  family.push_back(this);
1754 
1755  // Recurse into the elements children, if it's not active.
1756  // Do not clear the vector any more.
1757  if (!this->active())
1758  for (unsigned int c=0; c != this->n_children(); ++c)
1759  {
1760  const Elem * current_child = this->child_ptr(c);
1761  if (current_child != remote_elem)
1762  for (unsigned int s=0; s != current_child->n_sides(); ++s)
1763  {
1764  const Elem * child_neigh = current_child->neighbor_ptr(s);
1765  if (child_neigh &&
1766  (child_neigh == neighbor_in ||
1767  (child_neigh->parent() == neighbor_in &&
1768  child_neigh->is_ancestor_of(subneighbor))))
1769  current_child->family_tree_by_subneighbor (family, child_neigh,
1770  subneighbor, false);
1771  }
1772  }
1773 }
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_children() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
bool has_neighbor(const Elem *elem) const
Definition: elem.h:1790
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::Elem::find_edge_neighbors ( const Point p1,
const Point p2,
std::set< const Elem * > &  neighbor_set 
) const
inherited

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 758 of file elem.C.

References libMesh::Elem::contains_point(), end, libMesh::Elem::find_point_neighbors(), and libMesh::libmesh_assert().

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

761 {
762  // Simple but perhaps suboptimal code: find elements containing the
763  // first point, then winnow this set down by removing elements which
764  // don't also contain the second point
765 
766  libmesh_assert(this->contains_point(p2));
767  this->find_point_neighbors(p1, neighbor_set);
768 
769  std::set<const Elem *>::iterator it = neighbor_set.begin();
770  const std::set<const Elem *>::iterator end = neighbor_set.end();
771 
772  while(it != end) {
773  std::set<const Elem *>::iterator current = it++;
774 
775  const Elem * elem = *current;
776  // This won't invalidate iterator it, because it is already
777  // pointing to the next element
778  if (!elem->contains_point(p2))
779  neighbor_set.erase(current);
780  }
781 }
IterBase * end
void find_point_neighbors(const Point &p, std::set< const Elem * > &neighbor_set) const
Definition: elem.C:591
libmesh_assert(j)
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
Definition: elem.C:2296
void libMesh::Elem::find_edge_neighbors ( std::set< const Elem * > &  neighbor_set) const
inherited

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 785 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::active_family_tree_by_neighbor(), libMesh::Elem::contains_edge_of(), end, libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), and libMesh::remote_elem.

786 {
787  neighbor_set.clear();
788  neighbor_set.insert(this);
789 
790  std::set<const Elem *> untested_set, next_untested_set;
791  untested_set.insert(this);
792 
793  while (!untested_set.empty())
794  {
795  // Loop over all the elements in the patch that haven't already
796  // been tested
797  std::set<const Elem *>::const_iterator it = untested_set.begin();
798  const std::set<const Elem *>::const_iterator end = untested_set.end();
799 
800  for (; it != end; ++it)
801  {
802  const Elem * elem = *it;
803 
804  for (unsigned int s=0; s<elem->n_sides(); s++)
805  {
806  const Elem * current_neighbor = elem->neighbor_ptr(s);
807  if (current_neighbor &&
808  current_neighbor != remote_elem) // we have a real neighbor on this side
809  {
810  if (current_neighbor->active()) // ... if it is active
811  {
812  if (this->contains_edge_of(current_neighbor) // ... and touches us
813  || current_neighbor->contains_edge_of(this))
814  {
815  // Make sure we'll test it
816  if (!neighbor_set.count(current_neighbor))
817  next_untested_set.insert (current_neighbor);
818 
819  // And add it
820  neighbor_set.insert (current_neighbor);
821  }
822  }
823 #ifdef LIBMESH_ENABLE_AMR
824  else // ... the neighbor is *not* active,
825  { // ... so add *all* neighboring
826  // active children
827  std::vector<const Elem *> active_neighbor_children;
828 
829  current_neighbor->active_family_tree_by_neighbor
830  (active_neighbor_children, elem);
831 
832  std::vector<const Elem *>::const_iterator
833  child_it = active_neighbor_children.begin();
834  const std::vector<const Elem *>::const_iterator
835  child_end = active_neighbor_children.end();
836  for (; child_it != child_end; ++child_it)
837  {
838  const Elem * current_child = *child_it;
839  if (this->contains_edge_of(*child_it) ||
840  (*child_it)->contains_edge_of(this))
841  {
842  // Make sure we'll test it
843  if (!neighbor_set.count(current_child))
844  next_untested_set.insert (current_child);
845 
846  neighbor_set.insert (current_child);
847  }
848  }
849  }
850 #endif // #ifdef LIBMESH_ENABLE_AMR
851  }
852  }
853  }
854  untested_set.swap(next_untested_set);
855  next_untested_set.clear();
856  }
857 }
IterBase * end
bool contains_edge_of(const Elem *e) const
Definition: elem.C:570
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::Elem::find_interior_neighbors ( std::set< const Elem * > &  neighbor_set) const
inherited

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 860 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::child(), libMesh::Elem::child_ptr(), libMesh::Elem::contains_point(), libMesh::Elem::contains_vertex_of(), libMesh::Elem::dim(), end, libMesh::Elem::find_point_neighbors(), libMesh::Elem::interior_parent(), libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::Elem::n_children(), libMesh::Elem::n_nodes(), libMesh::Elem::point(), and libMesh::Elem::subactive().

Referenced by libMesh::ParmetisPartitioner::build_graph(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), and libMesh::MetisPartitioner::partition_range().

861 {
862  neighbor_set.clear();
863 
864  if ((this->dim() >= LIBMESH_DIM) ||
865  !this->interior_parent())
866  return;
867 
868  const Elem * ip = this->interior_parent();
869  libmesh_assert (ip->contains_vertex_of(this) ||
870  this->contains_vertex_of(ip));
871 
872  libmesh_assert (!ip->subactive());
873 
874 #ifdef LIBMESH_ENABLE_AMR
875  while (!ip->active()) // only possible with AMR, be careful because
876  { // ip->child_ptr(c) is only good with AMR.
877  for (unsigned int c = 0; c != ip->n_children(); ++c)
878  {
879  const Elem * child = ip->child_ptr(c);
880  if (child->contains_vertex_of(this) ||
881  this->contains_vertex_of(child))
882  {
883  ip = child;
884  break;
885  }
886  }
887  }
888 #endif
889 
890  this->find_point_neighbors(neighbor_set, ip);
891 
892  // Now we have all point neighbors from the interior manifold, but
893  // we need to weed out any neighbors that *only* intersect us at one
894  // point (or at one edge, if we're a 1-D element in 3D).
895  //
896  // The refinement hierarchy helps us here: if the interior element
897  // has a lower or equal refinement level then we can discard it iff
898  // it doesn't contain all our vertices. If it has a higher
899  // refinement level then we can discard it iff we don't contain at
900  // least dim()+1 of its vertices
901  std::set<const Elem *>::iterator it = neighbor_set.begin();
902  const std::set<const Elem *>::iterator end = neighbor_set.end();
903 
904  while(it != end)
905  {
906  std::set<const Elem *>::iterator current = it++;
907  const Elem * elem = *current;
908 
909  // This won't invalidate iterator it, because it is already
910  // pointing to the next element
911  if (elem->level() > this->level())
912  {
913  unsigned int vertices_contained = 0;
914  for (unsigned int p=0; p < elem->n_nodes(); ++p)
915  if (this->contains_point(elem->point(p)))
916  vertices_contained++;
917 
918  if (vertices_contained <= this->dim())
919  {
920  neighbor_set.erase(current);
921  continue;
922  }
923  }
924  else
925  {
926  for (unsigned int p=0; p < this->n_nodes(); ++p)
927  {
928  if (!elem->contains_point(this->point(p)))
929  {
930  neighbor_set.erase(current);
931  break;
932  }
933  }
934  }
935  }
936 }
const Elem * interior_parent() const
Definition: elem.C:940
IterBase * end
Elem * child(const unsigned int i) const
Definition: elem.h:2182
void find_point_neighbors(const Point &p, std::set< const Elem * > &neighbor_set) const
Definition: elem.C:591
bool contains_vertex_of(const Elem *e) const
Definition: elem.C:559
libmesh_assert(j)
virtual unsigned int n_nodes() const =0
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
virtual unsigned int dim() const =0
unsigned int level() const
Definition: elem.h:2115
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
Definition: elem.C:2296
void libMesh::Elem::find_point_neighbors ( const Point p,
std::set< const Elem * > &  neighbor_set 
) const
inherited

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 591 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::active_family_tree_by_neighbor(), libMesh::Elem::contains_point(), end, libMesh::libmesh_assert(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), and libMesh::remote_elem.

Referenced by libMesh::CheckpointIO::build_elem_list(), libMesh::MeshRefinement::enforce_mismatch_limit_prior_to_refinement(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::Elem::find_edge_neighbors(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::Elem::find_interior_neighbors(), libMesh::Patch::find_point_neighbors(), libMesh::Elem::find_point_neighbors(), libMesh::Elem::is_semilocal(), and libMesh::PointNeighborCoupling::operator()().

593 {
594  libmesh_assert(this->contains_point(p));
595  libmesh_assert(this->active());
596 
597  neighbor_set.clear();
598  neighbor_set.insert(this);
599 
600  std::set<const Elem *> untested_set, next_untested_set;
601  untested_set.insert(this);
602 
603  while (!untested_set.empty())
604  {
605  // Loop over all the elements in the patch that haven't already
606  // been tested
607  std::set<const Elem *>::const_iterator it = untested_set.begin();
608  const std::set<const Elem *>::const_iterator end = untested_set.end();
609 
610  for (; it != end; ++it)
611  {
612  const Elem * elem = *it;
613 
614  for (unsigned int s=0; s<elem->n_sides(); s++)
615  {
616  const Elem * current_neighbor = elem->neighbor_ptr(s);
617  if (current_neighbor &&
618  current_neighbor != remote_elem) // we have a real neighbor on this side
619  {
620  if (current_neighbor->active()) // ... if it is active
621  {
622  if (current_neighbor->contains_point(p)) // ... and touches p
623  {
624  // Make sure we'll test it
625  if (!neighbor_set.count(current_neighbor))
626  next_untested_set.insert (current_neighbor);
627 
628  // And add it
629  neighbor_set.insert (current_neighbor);
630  }
631  }
632 #ifdef LIBMESH_ENABLE_AMR
633  else // ... the neighbor is *not* active,
634  { // ... so add *all* neighboring
635  // active children that touch p
636  std::vector<const Elem *> active_neighbor_children;
637 
638  current_neighbor->active_family_tree_by_neighbor
639  (active_neighbor_children, elem);
640 
641  std::vector<const Elem *>::const_iterator
642  child_it = active_neighbor_children.begin();
643  const std::vector<const Elem *>::const_iterator
644  child_end = active_neighbor_children.end();
645  for (; child_it != child_end; ++child_it)
646  {
647  const Elem * current_child = *child_it;
648  if (current_child->contains_point(p))
649  {
650  // Make sure we'll test it
651  if (!neighbor_set.count(current_child))
652  next_untested_set.insert (current_child);
653 
654  neighbor_set.insert (current_child);
655  }
656  }
657  }
658 #endif // #ifdef LIBMESH_ENABLE_AMR
659  }
660  }
661  }
662  untested_set.swap(next_untested_set);
663  next_untested_set.clear();
664  }
665 }
bool active() const
Definition: elem.h:1984
IterBase * end
libmesh_assert(j)
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
Definition: elem.C:2296
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::Elem::find_point_neighbors ( std::set< const Elem * > &  neighbor_set) const
inherited

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 669 of file elem.C.

References libMesh::Elem::find_point_neighbors().

670 {
671  this->find_point_neighbors(neighbor_set, this);
672 }
void find_point_neighbors(const Point &p, std::set< const Elem * > &neighbor_set) const
Definition: elem.C:591
void libMesh::Elem::find_point_neighbors ( std::set< const Elem * > &  neighbor_set,
const Elem start_elem 
) const
inherited

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 676 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::active_family_tree_by_neighbor(), libMesh::Elem::contains_vertex_of(), end, libMesh::libmesh_assert(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), and libMesh::remote_elem.

678 {
679  libmesh_assert(start_elem);
680  libmesh_assert(start_elem->active());
681  libmesh_assert(start_elem->contains_vertex_of(this) ||
682  this->contains_vertex_of(start_elem));
683 
684  neighbor_set.clear();
685  neighbor_set.insert(start_elem);
686 
687  std::set<const Elem *> untested_set, next_untested_set;
688  untested_set.insert(start_elem);
689 
690  while (!untested_set.empty())
691  {
692  // Loop over all the elements in the patch that haven't already
693  // been tested
694  std::set<const Elem *>::const_iterator it = untested_set.begin();
695  const std::set<const Elem *>::const_iterator end = untested_set.end();
696 
697  for (; it != end; ++it)
698  {
699  const Elem * elem = *it;
700 
701  for (unsigned int s=0; s<elem->n_sides(); s++)
702  {
703  const Elem * current_neighbor = elem->neighbor_ptr(s);
704  if (current_neighbor &&
705  current_neighbor != remote_elem) // we have a real neighbor on this side
706  {
707  if (current_neighbor->active()) // ... if it is active
708  {
709  if (this->contains_vertex_of(current_neighbor) // ... and touches us
710  || current_neighbor->contains_vertex_of(this))
711  {
712  // Make sure we'll test it
713  if (!neighbor_set.count(current_neighbor))
714  next_untested_set.insert (current_neighbor);
715 
716  // And add it
717  neighbor_set.insert (current_neighbor);
718  }
719  }
720 #ifdef LIBMESH_ENABLE_AMR
721  else // ... the neighbor is *not* active,
722  { // ... so add *all* neighboring
723  // active children
724  std::vector<const Elem *> active_neighbor_children;
725 
726  current_neighbor->active_family_tree_by_neighbor
727  (active_neighbor_children, elem);
728 
729  std::vector<const Elem *>::const_iterator
730  child_it = active_neighbor_children.begin();
731  const std::vector<const Elem *>::const_iterator
732  child_end = active_neighbor_children.end();
733  for (; child_it != child_end; ++child_it)
734  {
735  const Elem * current_child = *child_it;
736  if (this->contains_vertex_of(current_child) ||
737  (current_child)->contains_vertex_of(this))
738  {
739  // Make sure we'll test it
740  if (!neighbor_set.count(current_child))
741  next_untested_set.insert (current_child);
742 
743  neighbor_set.insert (current_child);
744  }
745  }
746  }
747 #endif // #ifdef LIBMESH_ENABLE_AMR
748  }
749  }
750  }
751  untested_set.swap(next_untested_set);
752  next_untested_set.clear();
753  }
754 }
IterBase * end
bool contains_vertex_of(const Elem *e) const
Definition: elem.C:559
libmesh_assert(j)
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
const RemoteElem * remote_elem
Definition: remote_elem.C:57
ElemType libMesh::Elem::first_order_equivalent_type ( const ElemType  et)
staticinherited
Returns
the element type of the associated first-order element, e.g. when this is a TET10, then TET4 is returned. Returns INVALID_ELEM for first-order or other elements that cannot be converted into lower order equivalents.

Definition at line 2573 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::TET10, libMesh::TET4, libMesh::TRI3, libMesh::TRI6, and libMesh::TRISHELL3.

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

2574 {
2575  switch (et)
2576  {
2577  case EDGE2:
2578  case EDGE3:
2579  case EDGE4:
2580  return EDGE2;
2581  case TRI3:
2582  case TRI6:
2583  return TRI3;
2584  case TRISHELL3:
2585  return TRISHELL3;
2586  case QUAD4:
2587  case QUAD8:
2588  case QUAD9:
2589  return QUAD4;
2590  case QUADSHELL4:
2591  return QUADSHELL4;
2592  case TET4:
2593  case TET10:
2594  return TET4;
2595  case HEX8:
2596  case HEX27:
2597  case HEX20:
2598  return HEX8;
2599  case PRISM6:
2600  case PRISM15:
2601  case PRISM18:
2602  return PRISM6;
2603  case PYRAMID5:
2604  case PYRAMID13:
2605  case PYRAMID14:
2606  return PYRAMID5;
2607 
2608 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
2609 
2610  case INFQUAD4:
2611  case INFQUAD6:
2612  return INFQUAD4;
2613  case INFHEX8:
2614  case INFHEX16:
2615  case INFHEX18:
2616  return INFHEX8;
2617  case INFPRISM6:
2618  case INFPRISM12:
2619  return INFPRISM6;
2620 
2621 #endif
2622 
2623  default:
2624  // unknown element
2625  return INVALID_ELEM;
2626  }
2627 }
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 (Counts::iterator it = _counts.begin();
59  it != _counts.end(); ++it)
60  {
61  const std::string name(it->first);
62  const unsigned int creations = it->second.first;
63  const unsigned int destructions = it->second.second;
64 
65  oss << "| " << name << " reference count information:\n"
66  << "| Creations: " << creations << '\n'
67  << "| Destructions: " << destructions << '\n';
68  }
69 
70  oss << " ---------------------------------------------------------------------------- \n";
71 
72  return oss.str();
73 
74 #else
75 
76  return "";
77 
78 #endif
79 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:39
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 (Counts::iterator it = _counts.begin();
59  it != _counts.end(); ++it)
60  {
61  const std::string name(it->first);
62  const unsigned int creations = it->second.first;
63  const unsigned int destructions = it->second.second;
64 
65  oss << "| " << name << " reference count information:\n"
66  << "| Creations: " << creations << '\n'
67  << "| Destructions: " << destructions << '\n';
68  }
69 
70  oss << " ---------------------------------------------------------------------------- \n";
71 
72  return oss.str();
73 
74 #else
75 
76  return "";
77 
78 #endif
79 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:39
std::string libMesh::Elem::get_info ( ) const
inherited

Prints relevant information about the element to a string.

Definition at line 2444 of file elem.C.

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

Referenced by libMesh::Elem::is_linear(), and libMesh::Elem::print_info().

2445 {
2446  std::ostringstream oss;
2447 
2448  oss << " Elem Information" << '\n'
2449  << " id()=";
2450 
2451  if (this->valid_id())
2452  oss << this->id();
2453  else
2454  oss << "invalid";
2455 
2456 #ifdef LIBMESH_ENABLE_UNIQUE_ID
2457  oss << ", unique_id()=";
2458  if (this->valid_unique_id())
2459  oss << this->unique_id();
2460  else
2461  oss << "invalid";
2462 #endif
2463 
2464  oss << ", processor_id()=" << this->processor_id() << '\n';
2465 
2466  oss << " type()=" << Utility::enum_to_string(this->type()) << '\n'
2467  << " dim()=" << this->dim() << '\n'
2468  << " n_nodes()=" << this->n_nodes() << '\n';
2469 
2470  for (unsigned int n=0; n != this->n_nodes(); ++n)
2471  oss << " " << n << this->node_ref(n);
2472 
2473  oss << " n_sides()=" << this->n_sides() << '\n';
2474 
2475  for (unsigned int s=0; s != this->n_sides(); ++s)
2476  {
2477  oss << " neighbor(" << s << ")=";
2478  if (this->neighbor_ptr(s))
2479  oss << this->neighbor_ptr(s)->id() << '\n';
2480  else
2481  oss << "NULL\n";
2482  }
2483 
2484  oss << " hmin()=" << this->hmin()
2485  << ", hmax()=" << this->hmax() << '\n'
2486  << " volume()=" << this->volume() << '\n'
2487  << " active()=" << this->active()
2488  << ", ancestor()=" << this->ancestor()
2489  << ", subactive()=" << this->subactive()
2490  << ", has_children()=" << this->has_children() << '\n'
2491  << " parent()=";
2492  if (this->parent())
2493  oss << this->parent()->id() << '\n';
2494  else
2495  oss << "NULL\n";
2496  oss << " level()=" << this->level()
2497  << ", p_level()=" << this->p_level() << '\n'
2498 #ifdef LIBMESH_ENABLE_AMR
2499  << " refinement_flag()=" << Utility::enum_to_string(this->refinement_flag()) << '\n'
2500  << " p_refinement_flag()=" << Utility::enum_to_string(this->p_refinement_flag()) << '\n'
2501 #endif
2502 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
2503  << " infinite()=" << this->infinite() << '\n';
2504  if (this->infinite())
2505  oss << " origin()=" << this->origin() << '\n'
2506 #endif
2507  ;
2508 
2509  oss << " DoFs=";
2510  for (unsigned int s=0; s != this->n_systems(); ++s)
2511  for (unsigned int v=0; v != this->n_vars(s); ++v)
2512  for (unsigned int c=0; c != this->n_comp(s,v); ++c)
2513  oss << '(' << s << '/' << v << '/' << this->dof_number(s,v,c) << ") ";
2514 
2515 
2516  return oss.str();
2517 }
bool ancestor() const
Definition: elem.C:1473
bool has_children() const
Definition: elem.h:2022
bool valid_id() const
Definition: dof_object.h:666
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
virtual ElemType type() const =0
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:737
unsigned int p_level() const
Definition: elem.h:2149
const Elem * parent() const
Definition: elem.h:2073
virtual Real hmin() const
Definition: elem.C:449
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:802
virtual Real volume() const
Definition: elem.C:2805
bool valid_unique_id() const
Definition: dof_object.h:674
virtual bool infinite() const =0
virtual unsigned int n_nodes() const =0
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:1749
const Node & node_ref(const unsigned int i) const
Definition: elem.h:1680
RefinementState p_refinement_flag() const
Definition: elem.h:2236
virtual unsigned int n_sides() const =0
virtual Point origin() const
Definition: elem.h:1320
std::string enum_to_string(const T e)
virtual Real hmax() const
Definition: elem.C:466
virtual unsigned int dim() const =0
unsigned int level() const
Definition: elem.h:2115
RefinementState refinement_flag() const
Definition: elem.h:2220
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:772
dof_id_type id() const
Definition: dof_object.h:624
unsigned int n_systems() const
Definition: dof_object.h:718
unique_id_type unique_id() const
Definition: dof_object.h:641
processor_id_type processor_id() const
Definition: dof_object.h:686
Node * libMesh::Elem::get_node ( const unsigned int  i) const
inlineinherited
Returns
the pointer to local Node i.

This method is deprecated. Use the more consistently and less confusingly named node_ptr() instead.

Definition at line 1696 of file elem.h.

References libMesh::Elem::node_ptr().

1697 {
1698  // This const function has incorrectly returned a non-const pointer
1699  // for years. Now that it is reimplemented in terms of the new
1700  // interface which does return a const pointer, we need to use a
1701  // const_cast to mimic the old (incorrect) behavior. This function
1702  // is now deprecated and eventually will be removed entirely,
1703  // obviating the need for this ugly cast.
1704  libmesh_deprecated();
1705  return const_cast<Node *>(this->node_ptr(i));
1706 }
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:1658
unsigned int libMesh::Elem::get_node_index ( const Node node_ptr) const
inlineinherited
Returns
the local index for the Node pointer node_ptr, or invalid_id if node_ptr is not a local node.

Definition at line 1711 of file elem.h.

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

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

1712 {
1713  for (unsigned int n=0; n != this->n_nodes(); ++n)
1714  if (this->_nodes[n] == node_ptr)
1715  return n;
1716 
1717  return libMesh::invalid_uint;
1718 }
Node ** _nodes
Definition: elem.h:1456
const unsigned int invalid_uint
Definition: libmesh.h:184
virtual unsigned int n_nodes() const =0
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:1658
const Node *const * libMesh::Elem::get_nodes ( ) const
inlineinherited
Returns
a pointer to an array of local node pointers.

Definition at line 1650 of file elem.h.

References libMesh::Elem::_nodes.

Referenced by libMesh::DofMap::dof_indices().

1651 {
1652  return _nodes;
1653 }
Node ** _nodes
Definition: elem.h:1456
void libMesh::Elem::hack_p_level ( const unsigned int  p)
inlineinherited

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

Definition at line 2321 of file elem.h.

References libMesh::Elem::_p_level, libMesh::Elem::JUST_REFINED, and libMesh::Elem::p_refinement_flag().

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

2322 {
2323  if (p == 0)
2324  libmesh_assert_not_equal_to
2326 
2327  _p_level = cast_int<unsigned char>(p);
2328 }
unsigned char _p_level
Definition: elem.h:1497
RefinementState p_refinement_flag() const
Definition: elem.h:2236
virtual bool libMesh::Elem::has_affine_map ( ) const
inlinevirtualinherited
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::Hex8, libMesh::Edge4, libMesh::Edge3, libMesh::Quad8, libMesh::Quad9, libMesh::Tri3, libMesh::Tri6, libMesh::Prism6, libMesh::Pyramid5, libMesh::Quad4, libMesh::Edge2, and libMesh::Tri3Subdivision.

Definition at line 813 of file elem.h.

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

813 { return false; }
bool libMesh::Elem::has_ancestor_children ( ) const
inlineinherited
Returns
true if the element has any descendants other than its immediate children, false otherwise. Always returns false if AMR is disabled.

Definition at line 2036 of file elem.h.

References libMesh::Elem::_children, libMesh::Elem::child_ptr(), libMesh::Elem::has_children(), libmesh_nullptr, and libMesh::Elem::n_children().

Referenced by libMesh::Elem::is_linear().

2037 {
2038 #ifdef LIBMESH_ENABLE_AMR
2039  if (_children == libmesh_nullptr)
2040  return false;
2041  else
2042  for (unsigned int c=0; c != this->n_children(); c++)
2043  if (this->child_ptr(c)->has_children())
2044  return true;
2045 #endif
2046  return false;
2047 }
bool has_children() const
Definition: elem.h:2022
const class libmesh_nullptr_t libmesh_nullptr
Elem ** _children
Definition: elem.h:1468
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_children() const =0
bool libMesh::Elem::has_children ( ) const
inlineinherited
Returns
true if the element has any children (active or not), false otherwise. Always returns false if AMR is disabled.

Definition at line 2022 of file elem.h.

References libMesh::Elem::_children, and libmesh_nullptr.

Referenced by libMesh::Elem::add_child(), libMesh::UnstructuredMesh::all_first_order(), libMesh::Elem::ancestor(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::TopologyMap::fill(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::Elem::get_info(), libMesh::Elem::has_ancestor_children(), libMesh::Elem::is_linear(), libMesh::MeshTools::libmesh_assert_no_links_to_elem(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_refinement_tree(), libMesh::MeshTools::libmesh_assert_valid_remote_elems(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::Elem::make_links_to_me_remote(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::FEMSystem::mesh_position_set(), libMesh::Parallel::Packing< const Elem * >::pack(), libMesh::Elem::replace_child(), libMesh::Elem::set_child(), libMesh::Elem::subactive(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Elem::total_family_tree(), libMesh::Parallel::Packing< Elem * >::unpack(), and libMesh::Elem::which_child_am_i().

2023 {
2024 #ifdef LIBMESH_ENABLE_AMR
2025  if (_children == libmesh_nullptr)
2026  return false;
2027  else
2028  return true;
2029 #else
2030  return false;
2031 #endif
2032 }
const class libmesh_nullptr_t libmesh_nullptr
Elem ** _children
Definition: elem.h:1468
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 847 of file dof_object.h.

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

Referenced by libMesh::MeshTools::libmesh_assert_old_dof_objects(), libMesh::DofMap::old_dof_indices(), libMesh::DofMap::reinit(), and libMesh::DofObject::set_id().

848 {
849  if (sys == libMesh::invalid_uint)
850  {
851  for (unsigned int s=0; s<this->n_systems(); s++)
852  if (this->n_vars(s))
853  return true;
854  }
855 
856  else
857  {
858  libmesh_assert_less (sys, this->n_systems());
859 
860  if (this->n_vars(sys))
861  return true;
862  }
863 
864  return false;
865 }
const unsigned int invalid_uint
Definition: libmesh.h:184
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:737
ImplicitSystem & sys
unsigned int n_systems() const
Definition: dof_object.h:718
bool libMesh::Elem::has_neighbor ( const Elem elem) const
inlineinherited
Returns
true if the element elem in question is a neighbor of this element, false otherwise.

Definition at line 1790 of file elem.h.

References libMesh::Elem::n_neighbors(), and libMesh::Elem::neighbor_ptr().

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

1791 {
1792  for (unsigned int n=0; n<this->n_neighbors(); n++)
1793  if (this->neighbor_ptr(n) == elem)
1794  return true;
1795 
1796  return false;
1797 }
virtual unsigned int n_neighbors() const
Definition: elem.h:530
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:1749
bool libMesh::Elem::has_topological_neighbor ( const Elem elem,
const MeshBase mesh,
const PointLocatorBase point_locator,
const PeriodicBoundaries pb 
) const
inherited
Returns
true if the element elem in question is a neighbor or topological neighbor of this element, false otherwise.

Definition at line 1093 of file elem.C.

References libMesh::Elem::has_neighbor(), libMesh::Elem::n_neighbors(), and libMesh::Elem::topological_neighbor().

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

1097 {
1098  // First see if this is a normal "interior" neighbor
1099  if (has_neighbor(elem))
1100  return true;
1101 
1102  for (unsigned int n=0; n<this->n_neighbors(); n++)
1103  if (this->topological_neighbor(n, mesh, point_locator, pb))
1104  return true;
1105 
1106  return false;
1107 }
virtual unsigned int n_neighbors() const
Definition: elem.h:530
MeshBase & mesh
const Elem * topological_neighbor(const unsigned int i, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb) const
Definition: elem.C:1056
bool has_neighbor(const Elem *elem) const
Definition: elem.h:1790
Real libMesh::Elem::hmax ( ) const
virtualinherited
Returns
the maximum vertex separation for the element.

Definition at line 466 of file elem.C.

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

Referenced by libMesh::DiscontinuityMeasure::boundary_side_integration(), libMesh::KellyErrorEstimator::boundary_side_integration(), libMesh::OldSolutionValue< Output, point_output >::check_old_context(), libMesh::Elem::get_info(), libMesh::LaplacianErrorEstimator::internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), libMesh::KellyErrorEstimator::internal_side_integration(), libMesh::Elem::is_vertex_on_child(), libMesh::PointLocatorBase::locate_node(), and libMesh::Elem::point_test().

467 {
468  Real h_max=0;
469 
470  for (unsigned int n_outer=0; n_outer<this->n_vertices(); n_outer++)
471  for (unsigned int n_inner=n_outer+1; n_inner<this->n_vertices(); n_inner++)
472  {
473  const Point diff = (this->point(n_outer) - this->point(n_inner));
474 
475  h_max = std::max(h_max, diff.norm_sq());
476  }
477 
478  return std::sqrt(h_max);
479 }
long double max(long double a, double b)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Point & point(const unsigned int i) const
Definition: elem.h:1595
virtual unsigned int n_vertices() const =0
Real libMesh::Elem::hmin ( ) const
virtualinherited
Returns
the minimum vertex separation for the element.

Definition at line 449 of file elem.C.

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

Referenced by libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::Elem::get_info(), libMesh::BoundaryInfo::get_side_and_node_maps(), libMesh::Elem::is_vertex_on_child(), libMesh::FEMSystem::numerical_jacobian(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::operator()(), and libMesh::ReplicatedMesh::stitching_helper().

450 {
452 
453  for (unsigned int n_outer=0; n_outer<this->n_vertices(); n_outer++)
454  for (unsigned int n_inner=n_outer+1; n_inner<this->n_vertices(); n_inner++)
455  {
456  const Point diff = (this->point(n_outer) - this->point(n_inner));
457 
458  h_min = std::min(h_min, diff.norm_sq());
459  }
460 
461  return std::sqrt(h_min);
462 }
long double max(long double a, double b)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Point & point(const unsigned int i) const
Definition: elem.h:1595
virtual unsigned int n_vertices() const =0
long double min(long double a, double b)
dof_id_type libMesh::DofObject::id ( ) const
inlineinherited
Returns
the id for this DofObject

Definition at line 624 of file dof_object.h.

References libMesh::DofObject::_id, libMesh::libmesh_assert(), 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::Subdivision::all_subdivision(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::CheckpointIO::build_elem_list(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::VTKIO::cells_to_vtk(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::FEMap::compute_single_point_map(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::UnstructuredMesh::create_submesh(), libMesh::ReplicatedMesh::delete_elem(), libMesh::DistributedMesh::delete_elem(), libMesh::ReplicatedMesh::delete_node(), libMesh::DistributedMesh::delete_node(), libMesh::MeshBase::detect_interior_parents(), 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::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshTools::Modification::flatten(), libMesh::Node::get_info(), libMesh::Elem::get_info(), libMesh::DofMap::get_local_constraints(), libMesh::BoundaryInfo::get_side_and_node_maps(), libMesh::EquationSystems::get_solution(), libMesh::LaplaceMeshSmoother::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::TreeNode< N >::insert(), libMesh::ReplicatedMesh::insert_elem(), libMesh::DistributedMesh::insert_elem(), libMesh::ReplicatedMesh::insert_node(), libMesh::FE< Dim, T >::inverse_map(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids(), libMesh::MeshTools::libmesh_assert_valid_elem_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::Tri3Subdivision::local_node_number(), libMesh::Elem::node_id(), libMesh::UNVIO::nodes_out(), libMesh::VTKIO::nodes_to_vtk(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::BoundaryInfo::operator=(), libMesh::Parallel::Packing< const Node * >::pack(), libMesh::Parallel::Packing< const Elem * >::pack(), libMesh::MetisPartitioner::partition_range(), libMesh::SFCPartitioner::partition_range(), libMesh::ErrorVector::plot_error(), 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::HPCoarsenTest::select_refinement(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshTools::Modification::smooth(), libMesh::ReplicatedMesh::stitching_helper(), 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(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::CheckpointIO::write_connectivity(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::GmshIO::write_mesh(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::CheckpointIO::write_nodes(), and libMesh::XdrIO::write_serialized_connectivity().

625 {
626  libmesh_assert (this->valid_id());
627  return _id;
628 }
bool valid_id() const
Definition: dof_object.h:666
dof_id_type _id
Definition: dof_object.h:412
libmesh_assert(j)
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 160 of file reference_counter.h.

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

Referenced by libMesh::ReferenceCounter::n_objects(), and libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

161 {
162  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
163  std::pair<unsigned int, unsigned int> & p = _counts[name];
164 
165  p.first++;
166 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:39
spin_mutex spin_mtx
Definition: threads.C:29
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 160 of file reference_counter.h.

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

Referenced by libMesh::ReferenceCounter::n_objects(), and libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

161 {
162  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
163  std::pair<unsigned int, unsigned int> & p = _counts[name];
164 
165  p.first++;
166 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:39
spin_mutex spin_mtx
Definition: threads.C:29
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 173 of file reference_counter.h.

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

Referenced by libMesh::ReferenceCounter::n_objects(), and libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

174 {
175  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
176  std::pair<unsigned int, unsigned int> & p = _counts[name];
177 
178  p.second++;
179 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:39
spin_mutex spin_mtx
Definition: threads.C:29
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 173 of file reference_counter.h.

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

Referenced by libMesh::ReferenceCounter::n_objects(), and libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

174 {
175  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
176  std::pair<unsigned int, unsigned int> & p = _counts[name];
177 
178  p.second++;
179 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:39
spin_mutex spin_mtx
Definition: threads.C:29
virtual bool libMesh::RemoteElem::infinite ( ) const
inlinevirtual
Returns
true if the element is an infinite element, false otherwise.

Implements libMesh::Elem.

Definition at line 166 of file remote_elem.h.

167  { libmesh_not_implemented(); return false; }
const Elem * libMesh::Elem::interior_parent ( ) const
inherited

In some cases it is desireable 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 940 of file elem.C.

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

Referenced by libMesh::ParmetisPartitioner::build_graph(), libMesh::MeshBase::detect_interior_parents(), libMesh::Elem::find_interior_neighbors(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::BoundaryInfo::get_side_and_node_maps(), libMesh::Elem::is_linear(), libMesh::MeshTools::libmesh_assert_valid_amr_interior_parents(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::GhostPointNeighbors::operator()(), libMesh::Parallel::Packing< const Elem * >::pack(), libMesh::MetisPartitioner::partition_range(), and libMesh::Parallel::Packing< Elem * >::unpack().

941 {
942  // interior parents make no sense for full-dimensional elements.
943  libmesh_assert_less (this->dim(), LIBMESH_DIM);
944 
945  // they USED TO BE only good for level-0 elements, but we now
946  // support keeping interior_parent() valid on refined boundary
947  // elements.
948  // if (this->level() != 0)
949  // return this->parent()->interior_parent();
950 
951  // We store the interior_parent pointer after both the parent
952  // neighbor and neighbor pointers
953  Elem * interior_p = _elemlinks[1+this->n_sides()];
954 
955  // If we have an interior_parent, we USED TO assume it was a
956  // one-higher-dimensional interior element, but we now allow e.g.
957  // edge elements to have a 3D interior_parent with no
958  // intermediate 2D element.
959  // libmesh_assert (!interior_p ||
960  // interior_p->dim() == (this->dim()+1));
961  libmesh_assert (!interior_p ||
962  (interior_p == remote_elem) ||
963  (interior_p->dim() > this->dim()));
964 
965  // We require consistency between AMR of interior and of boundary
966  // elements
967  if (interior_p && (interior_p != remote_elem))
968  libmesh_assert_less_equal (interior_p->level(), this->level());
969 
970  return interior_p;
971 }
libmesh_assert(j)
Elem ** _elemlinks
Definition: elem.h:1462
virtual unsigned int n_sides() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
virtual unsigned int dim() const =0
unsigned int level() const
Definition: elem.h:2115
const RemoteElem * remote_elem
Definition: remote_elem.C:57
Elem * libMesh::Elem::interior_parent ( )
inherited

Definition at line 975 of file elem.C.

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

976 {
977  // See the const version for comments
978  libmesh_assert_less (this->dim(), LIBMESH_DIM);
979  Elem * interior_p = _elemlinks[1+this->n_sides()];
980 
981  libmesh_assert (!interior_p ||
982  (interior_p == remote_elem) ||
983  (interior_p->dim() > this->dim()));
984  if (interior_p && (interior_p != remote_elem))
985  libmesh_assert_less_equal (interior_p->level(), this->level());
986 
987  return interior_p;
988 }
libmesh_assert(j)
Elem ** _elemlinks
Definition: elem.h:1462
virtual unsigned int n_sides() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
virtual unsigned int dim() const =0
unsigned int level() const
Definition: elem.h:2115
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::DofObject::invalidate ( )
inlineinherited

Invalidates all the indices for this DofObject

Definition at line 580 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().

581 {
582  this->invalidate_dofs ();
583  this->invalidate_id ();
584  this->invalidate_processor_id ();
585 }
void invalidate_processor_id()
Definition: dof_object.h:572
void invalidate_dofs(const unsigned int sys_num=libMesh::invalid_uint)
Definition: dof_object.h:544
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 544 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().

545 {
546  // If the user does not specify the system number...
547  if (sys_num >= this->n_systems())
548  {
549  for (unsigned int s=0; s<this->n_systems(); s++)
550  for (unsigned int vg=0; vg<this->n_var_groups(s); vg++)
551  if (this->n_comp_group(s,vg))
552  this->set_vg_dof_base(s,vg,invalid_id);
553  }
554  // ...otherwise invalidate the dofs for all systems
555  else
556  for (unsigned int vg=0; vg<this->n_var_groups(sys_num); vg++)
557  if (this->n_comp_group(sys_num,vg))
558  this->set_vg_dof_base(sys_num,vg,invalid_id);
559 }
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:785
void set_vg_dof_base(const unsigned int s, const unsigned int vg, const dof_id_type db)
Definition: dof_object.h:894
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:727
static const dof_id_type invalid_id
Definition: dof_object.h:335
unsigned int n_systems() const
Definition: dof_object.h:718
void libMesh::DofObject::invalidate_id ( )
inlineinherited

Sets the id to invalid_id

Definition at line 564 of file dof_object.h.

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

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

565 {
566  this->set_id (invalid_id);
567 }
dof_id_type & set_id()
Definition: dof_object.h:633
static const dof_id_type invalid_id
Definition: dof_object.h:335
void libMesh::DofObject::invalidate_processor_id ( )
inlineinherited

Sets the processor id to invalid_processor_id

Definition at line 572 of file dof_object.h.

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

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

573 {
575 }
static const processor_id_type invalid_processor_id
Definition: dof_object.h:346
processor_id_type processor_id() const
Definition: dof_object.h:686
bool libMesh::Elem::is_ancestor_of ( const Elem descendant) const
inlineinherited
Returns
true if descendant is a child of this, or a child of a child of this, etc. Always returns false if AMR is disabled.

Definition at line 2052 of file elem.h.

References libMesh::Elem::parent().

Referenced by libMesh::Elem::family_tree_by_subneighbor(), libMesh::Elem::is_linear(), and libMesh::Elem::make_links_to_me_local().

2057 {
2058 #ifdef LIBMESH_ENABLE_AMR
2059  const Elem * e = descendant;
2060  while (e)
2061  {
2062  if (this == e)
2063  return true;
2064  e = e->parent();
2065  }
2066 #endif
2067  return false;
2068 }
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
bool libMesh::Elem::is_child_on_edge ( const unsigned int  c,
const unsigned int  e 
) const
virtualinherited
Returns
true if the specified child is on the specified edge.

Definition at line 1562 of file elem.C.

References libMesh::Elem::build_edge_ptr(), libMesh::Elem::n_children(), and libMesh::Elem::n_edges().

Referenced by libMesh::FEGenericBase< OutputType >::coarsened_dof_values(), libMesh::BoundaryInfo::edge_boundary_ids(), and libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::operator()().

1564 {
1565  libmesh_assert_less (c, this->n_children());
1566  libmesh_assert_less (e, this->n_edges());
1567 
1568  UniquePtr<const Elem> my_edge = this->build_edge_ptr(e);
1569  UniquePtr<const Elem> child_edge = this->build_edge_ptr(e);
1570 
1571  // We're assuming that an overlapping child edge has the same
1572  // number and orientation as its parent
1573  return (child_edge->node_id(0) == my_edge->node_id(0) ||
1574  child_edge->node_id(1) == my_edge->node_id(1));
1575 }
virtual unsigned int n_edges() const =0
virtual unsigned int n_children() const =0
virtual UniquePtr< Elem > build_edge_ptr(const unsigned int i)=0
virtual bool libMesh::RemoteElem::is_child_on_side ( const unsigned  c,
const unsigned  s 
) const
inlinevirtual
Returns
true if the specified child is on the specified side.

Implements libMesh::Elem.

Definition at line 136 of file remote_elem.h.

138  { libmesh_not_implemented(); return false; }
virtual bool libMesh::RemoteElem::is_edge ( const unsigned  i) const
inlinevirtual
Returns
true if the specified (local) node number is an edge.

Implements libMesh::Elem.

Definition at line 126 of file remote_elem.h.

127  { libmesh_not_implemented(); return false; }
virtual bool libMesh::RemoteElem::is_edge_on_side ( const unsigned  e,
const unsigned  s 
) const
inlinevirtual
Returns
true if the specified edge is on the specified side.

Implements libMesh::Elem.

Definition at line 140 of file remote_elem.h.

142  { libmesh_not_implemented(); return false; }
virtual bool libMesh::RemoteElem::is_face ( const unsigned  i) const
inlinevirtual
Returns
true if the specified (local) node number is a face.

Implements libMesh::Elem.

Definition at line 129 of file remote_elem.h.

130  { libmesh_not_implemented(); return false; }
virtual bool libMesh::Elem::is_mid_infinite_edge_node ( const unsigned int  ) const
inlinevirtualinherited
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 1312 of file elem.h.

References libMesh::Elem::infinite(), and libMesh::libmesh_assert().

Referenced by libMesh::Elem::parent_bracketing_nodes().

1313  { libmesh_assert (!this->infinite()); return false; }
libmesh_assert(j)
virtual bool infinite() const =0
virtual bool libMesh::RemoteElem::is_node_on_edge ( const unsigned  n,
const unsigned  e 
) const
inlinevirtual
Returns
true if the specified (local) node number is on the specified edge.

Implements libMesh::Elem.

Definition at line 144 of file remote_elem.h.

146  { libmesh_not_implemented(); return false; }
virtual bool libMesh::RemoteElem::is_node_on_side ( const unsigned  n,
const unsigned  s 
) const
inlinevirtual
Returns
true if the specified (local) node number is on the specified side.

Implements libMesh::Elem.

Definition at line 132 of file remote_elem.h.

134  { libmesh_not_implemented(); return false; }
virtual bool libMesh::RemoteElem::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 NULL neighbor only if it lies on the physical boundary of the domain.

Reimplemented from libMesh::Elem.

Definition at line 91 of file remote_elem.h.

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

Definition at line 538 of file elem.C.

References end, libMesh::Elem::find_point_neighbors(), and libMesh::DofObject::processor_id().

Referenced by libMesh::Patch::add_semilocal_face_neighbors(), and libMesh::Patch::add_semilocal_point_neighbors().

539 {
540  std::set<const Elem *> point_neighbors;
541 
542  this->find_point_neighbors(point_neighbors);
543 
544  std::set<const Elem *>::const_iterator it = point_neighbors.begin();
545  const std::set<const Elem *>::const_iterator end = point_neighbors.end();
546 
547  for (; it != end; ++it)
548  {
549  const Elem * elem = *it;
550  if (elem->processor_id() == my_pid)
551  return true;
552  }
553 
554  return false;
555 }
IterBase * end
void find_point_neighbors(const Point &p, std::set< const Elem * > &neighbor_set) const
Definition: elem.C:591
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
virtual bool libMesh::RemoteElem::is_vertex ( const unsigned  i) const
inlinevirtual
Returns
true if the specified (local) node number is a vertex.

Implements libMesh::Elem.

Definition at line 123 of file remote_elem.h.

124  { libmesh_not_implemented(); return false; }
virtual unsigned int libMesh::Elem::is_vertex_on_child ( unsigned  int,
unsigned int  n 
) const
inlinevirtualinherited
bool libMesh::Elem::is_vertex_on_parent ( unsigned int  c,
unsigned int  n 
) const
virtualinherited
Returns
true if this element has a vertex at the specified (child-local) node number n of the specified child c.

Definition at line 2858 of file elem.C.

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

Referenced by libMesh::Elem::is_vertex_on_child(), and libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::operator()().

2860 {
2861 #ifdef LIBMESH_ENABLE_AMR
2862 
2863  unsigned int my_n_vertices = this->n_vertices();
2864  for (unsigned int n_parent = 0; n_parent != my_n_vertices;
2865  ++n_parent)
2866  if (this->node_ptr(n_parent) == this->child_ptr(c)->node_ptr(n))
2867  return true;
2868  return false;
2869 
2870 #else
2871 
2872  // No AMR?
2873  libmesh_error_msg("ERROR: AMR disabled, how did we get here?");
2874  return true;
2875 
2876 #endif
2877 }
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:1658
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_vertices() const =0
virtual dof_id_type libMesh::RemoteElem::key ( const unsigned  s) const
inlinevirtual
Returns
an id associated with the s side of this element. The id is not necessarily unique, but should be close. This is particularly useful in the MeshBase::find_neighbors() routine.

Implements libMesh::Elem.

Definition at line 88 of file remote_elem.h.

89  { libmesh_not_implemented(); return 0; }
dof_id_type libMesh::Elem::key ( ) const
virtualinherited
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::Quad, libMesh::Quad9, and libMesh::Tri.

Definition at line 494 of file elem.C.

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

Referenced by libMesh::InfHex18::default_order(), libMesh::InfQuad6::default_order(), libMesh::Tri6::default_order(), libMesh::Quad8::default_order(), libMesh::Quad9::default_order(), libMesh::Hex27::default_order(), libMesh::Prism18::default_order(), libMesh::Pyramid14::default_order(), libMesh::Edge2::infinite(), libMesh::Edge4::infinite(), libMesh::Edge3::infinite(), libMesh::Edge::is_edge_on_side(), libMesh::InfPrism::is_mid_infinite_edge_node(), libMesh::InfQuad::is_mid_infinite_edge_node(), libMesh::InfQuad6::key(), libMesh::Prism18::key(), libMesh::Pyramid14::key(), libMesh::InfHex18::key(), libMesh::Hex::n_children(), libMesh::Tet::n_children(), libMesh::Prism::n_children(), libMesh::NodeElem::n_children(), libMesh::Pyramid::n_children(), libMesh::Quad::n_children(), libMesh::Tri::n_children(), libMesh::InfHex::n_children(), and set_node().

495 {
496  std::vector<dof_id_type> node_ids(this->n_nodes());
497 
498  for (unsigned n=0; n<this->n_nodes(); n++)
499  node_ids[n] = this->node_id(n);
500 
501  // Always sort, so that different local node numberings hash to the
502  // same value.
503  std::sort (node_ids.begin(), node_ids.end());
504 
505  return Utility::hashword(node_ids);
506 }
virtual unsigned int n_nodes() const =0
uint32_t hashword(const uint32_t *k, size_t length, uint32_t initval=0)
Definition: hashword.h:141
dof_id_type node_id(const unsigned int i) const
Definition: elem.h:1617
Real libMesh::Elem::length ( const unsigned int  n1,
const unsigned int  n2 
) const
inherited
Returns
the distance between nodes n1 and n2. Useful for computing the lengths of the sides of elements.

Definition at line 483 of file elem.C.

References libMesh::Elem::n_vertices(), and libMesh::Elem::point().

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

485 {
486  libmesh_assert_less ( n1, this->n_vertices() );
487  libmesh_assert_less ( n2, this->n_vertices() );
488 
489  return (this->point(n1) - this->point(n2)).norm();
490 }
const Point & point(const unsigned int i) const
Definition: elem.h:1595
virtual unsigned int n_vertices() const =0
unsigned int libMesh::Elem::level ( ) const
inlineinherited
Returns
the refinement level of the current element. If the element's parent is NULL then by convention it is at level 0, otherwise it is simply at one level greater than its parent.

Definition at line 2115 of file elem.h.

References libMesh::Elem::dim(), libMesh::Elem::level(), libmesh_nullptr, and libMesh::Elem::parent().

Referenced by libMesh::MeshRefinement::_coarsen_elements(), libMesh::Elem::active_family_tree_by_neighbor(), libMesh::Elem::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< OutputType >::compute_periodic_constraints(), libMesh::FEAbstract::compute_periodic_node_constraints(), libMesh::FEGenericBase< OutputType >::compute_proj_constraints(), libMesh::BoundaryInfo::edge_boundary_ids(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::MeshRefinement::enforce_mismatch_limit_prior_to_refinement(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::MeshTools::find_hanging_nodes_and_parents(), libMesh::Elem::find_interior_neighbors(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::Elem::get_info(), libMesh::Elem::interior_parent(), libMesh::Elem::is_linear(), libMesh::Elem::level(), libMesh::MeshTools::libmesh_assert_valid_amr_interior_parents(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::Elem::make_links_to_me_local(), libMesh::Elem::make_links_to_me_remote(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::CheckpointIO::n_active_levels_on_processor(), libMesh::Elem::nullify_neighbors(), libMesh::Parallel::Packing< const Elem * >::pack(), libMesh::Parallel::Packing< const Elem * >::packable_size(), libMesh::BoundaryInfo::remove_edge(), 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(), libMesh::Elem::top_parent(), libMesh::Elem::topological_neighbor(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::Elem::which_neighbor_am_i(), and libMesh::CheckpointIO::write_connectivity().

2116 {
2117 #ifdef LIBMESH_ENABLE_AMR
2118 
2119  // if I don't have a parent I was
2120  // created directly from file
2121  // or by the user, so I am a
2122  // level-0 element
2123  if (this->parent() == libmesh_nullptr)
2124  return 0;
2125 
2126  // if the parent and this element are of different
2127  // dimensionality we are at the same level as
2128  // the parent (e.g. we are the 2D side of a
2129  // 3D element)
2130  if (this->dim() != this->parent()->dim())
2131  return this->parent()->level();
2132 
2133  // otherwise we are at a level one
2134  // higher than our parent
2135  return (this->parent()->level() + 1);
2136 
2137 #else
2138 
2139  // Without AMR all elements are
2140  // at level 0.
2141  return 0;
2142 
2143 #endif
2144 }
const Elem * parent() const
Definition: elem.h:2073
const class libmesh_nullptr_t libmesh_nullptr
virtual unsigned int dim() const =0
unsigned int level() const
Definition: elem.h:2115
void libMesh::Elem::libmesh_assert_valid_neighbors ( ) const
inherited

Checks for consistent neighbor links on this element.

Definition at line 1126 of file elem.C.

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

Referenced by libMesh::MeshTools::libmesh_assert_valid_neighbors().

1127 {
1128  for (unsigned int s=0; s<this->n_neighbors(); s++)
1129  {
1130  const Elem * neigh = this->neighbor_ptr(s);
1131 
1132  // Any element might have a remote neighbor; checking
1133  // to make sure that's not inaccurate is tough.
1134  if (neigh == remote_elem)
1135  continue;
1136 
1137  if (neigh)
1138  {
1139  // Only subactive elements have subactive neighbors
1140  libmesh_assert (this->subactive() || !neigh->subactive());
1141 
1142  const Elem * elem = this;
1143 
1144  // If we're subactive but our neighbor isn't, its
1145  // return neighbor link will be to our first active
1146  // ancestor OR to our inactive ancestor of the same
1147  // level as neigh,
1148  if (this->subactive() && !neigh->subactive())
1149  {
1150  for (elem = this; !elem->active();
1151  elem = elem->parent())
1152  libmesh_assert(elem);
1153  }
1154  else
1155  {
1156  unsigned int rev = neigh->which_neighbor_am_i(elem);
1157  libmesh_assert_less (rev, neigh->n_neighbors());
1158 
1159  if (this->subactive() && !neigh->subactive())
1160  {
1161  while (neigh->neighbor_ptr(rev) != elem)
1162  {
1163  libmesh_assert(elem->parent());
1164  elem = elem->parent();
1165  }
1166  }
1167  else
1168  {
1169  const Elem * nn = neigh->neighbor_ptr(rev);
1170  libmesh_assert(nn);
1171 
1172  for (; elem != nn; elem = elem->parent())
1173  libmesh_assert(elem);
1174  }
1175  }
1176  }
1177  // If we don't have a neighbor and we're not subactive, our
1178  // ancestors shouldn't have any neighbors in this same
1179  // direction.
1180  else if (!this->subactive())
1181  {
1182  const Elem * my_parent = this->parent();
1183  if (my_parent &&
1184  // A parent with a different dimension isn't really one of
1185  // our ancestors, it means we're on a boundary mesh and this
1186  // is an interior mesh element for which we're on a side.
1187  // Nothing to test for in that case.
1188  (my_parent->dim() == this->dim()))
1189  libmesh_assert (!my_parent->neighbor_ptr(s));
1190  }
1191  }
1192 }
bool subactive() const
Definition: elem.h:2002
virtual unsigned int n_neighbors() const
Definition: elem.h:530
const Elem * parent() const
Definition: elem.h:2073
libmesh_assert(j)
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:1749
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
virtual unsigned int dim() const =0
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::Elem::libmesh_assert_valid_node_pointers ( ) const
inherited

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

Definition at line 1114 of file elem.C.

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

Referenced by libMesh::MeshTools::libmesh_assert_valid_node_pointers().

1115 {
1116  libmesh_assert(this->valid_id());
1117  for (unsigned int n=0; n != this->n_nodes(); ++n)
1118  {
1119  libmesh_assert(this->node_ptr(n));
1120  libmesh_assert(this->node_ptr(n)->valid_id());
1121  }
1122 }
bool valid_id() const
Definition: dof_object.h:666
libmesh_assert(j)
virtual unsigned int n_nodes() const =0
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:1658
unsigned int libMesh::Elem::local_node ( const dof_id_type  i) const
inlineinherited
Returns
the local id number of global Node id i, or invalid_uint if Node id i is not local.

Definition at line 1638 of file elem.h.

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

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

1639 {
1640  for (unsigned int n=0; n != this->n_nodes(); ++n)
1641  if (this->node_id(n) == i)
1642  return n;
1643 
1644  return libMesh::invalid_uint;
1645 }
const unsigned int invalid_uint
Definition: libmesh.h:184
virtual unsigned int n_nodes() const =0
dof_id_type node_id(const unsigned int i) const
Definition: elem.h:1617
BoundingBox libMesh::Elem::loose_bounding_box ( ) const
virtualinherited
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::Quad8, libMesh::Tri6, libMesh::Edge3, libMesh::Edge4, and libMesh::Cell.

Definition at line 2836 of file elem.C.

References libMesh::Elem::n_nodes(), and libMesh::Elem::point().

Referenced by libMesh::TreeNode< N >::insert(), and libMesh::Elem::is_vertex_on_child().

2837 {
2838  Point pmin = this->point(0);
2839  Point pmax = pmin;
2840 
2841  unsigned int n_points = this->n_nodes();
2842  for (unsigned int p=0; p != n_points; ++p)
2843  for (unsigned d=0; d<LIBMESH_DIM; ++d)
2844  {
2845  const Point &pt = this->point(p);
2846  if (pmin(d) > pt(d))
2847  pmin(d) = pt(d);
2848 
2849  if (pmax(d) < pt(d))
2850  pmax(d) = pt(d);
2851  }
2852 
2853  return BoundingBox(pmin, pmax);
2854 }
virtual unsigned int n_nodes() const =0
const Point & point(const unsigned int i) const
Definition: elem.h:1595
void libMesh::Elem::make_links_to_me_local ( unsigned int  n)
inherited

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 1198 of file elem.C.

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

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

1199 {
1200  Elem * neigh = this->neighbor_ptr(n);
1201 
1202  // Don't bother calling this function unless it's necessary
1203  libmesh_assert(neigh);
1204  libmesh_assert(!neigh->is_remote());
1205 
1206  // We never have neighbors more refined than us
1207  libmesh_assert_less_equal (neigh->level(), this->level());
1208 
1209  // We never have subactive neighbors of non subactive elements
1210  libmesh_assert(!neigh->subactive() || this->subactive());
1211 
1212  // If we have a neighbor less refined than us then it must not
1213  // have any more refined active descendants we could have
1214  // pointed to instead.
1215  libmesh_assert(neigh->level() == this->level() ||
1216  neigh->active());
1217 
1218  // If neigh is at our level, then its family might have
1219  // remote_elem neighbor links which need to point to us
1220  // instead, but if not, then we're done.
1221  if (neigh->level() != this->level())
1222  return;
1223 
1224  // If neigh is subactive then we're not updating its neighbor links
1225  // FIXME - this needs to change when we start using subactive
1226  // elements for more than just the two-phase
1227  // restriction/prolongation projections.
1228  if (neigh->subactive())
1229  return;
1230 
1231  // What side of neigh are we on? We can't use the usual Elem
1232  // method because we're in the middle of restoring topology
1233  const UniquePtr<Elem> my_side = this->side_ptr(n);
1234  unsigned int nn = 0;
1235  for (; nn != neigh->n_sides(); ++nn)
1236  {
1237  const UniquePtr<Elem> neigh_side = neigh->side_ptr(nn);
1238  if (*my_side == *neigh_side)
1239  break;
1240  }
1241 
1242  // we had better be on *some* side of neigh
1243  libmesh_assert_less (nn, neigh->n_sides());
1244 
1245  // Find any elements that ought to point to elem
1246  std::vector<const Elem *> neigh_family;
1247 #ifdef LIBMESH_ENABLE_AMR
1248  if (this->active())
1249  neigh->family_tree_by_side(neigh_family, nn);
1250  else if (neigh->subactive())
1251 #endif
1252  neigh_family.push_back(neigh);
1253 
1254  // And point them to elem
1255  for (std::size_t i = 0; i != neigh_family.size(); ++i)
1256  {
1257  Elem * neigh_family_member = const_cast<Elem *>(neigh_family[i]);
1258 
1259  // Ideally, the neighbor link ought to either be correct
1260  // already or ought to be to remote_elem.
1261  //
1262  // However, if we're redistributing a newly created elem,
1263  // after an AMR step but before find_neighbors has fixed up
1264  // neighbor links, we might have an out of date neighbor
1265  // link to elem's parent instead.
1266 #ifdef LIBMESH_ENABLE_AMR
1267  libmesh_assert((neigh_family_member->neighbor_ptr(nn) &&
1268  (neigh_family_member->neighbor_ptr(nn)->active() ||
1269  neigh_family_member->neighbor_ptr(nn)->is_ancestor_of(this))) ||
1270  (neigh_family_member->neighbor_ptr(nn) == remote_elem) ||
1271  ((this->refinement_flag() == JUST_REFINED) &&
1272  (this->parent() != libmesh_nullptr) &&
1273  (neigh_family_member->neighbor_ptr(nn) == this->parent())));
1274 #else
1275  libmesh_assert((neigh_family_member->neighbor_ptr(nn) == this) ||
1276  (neigh_family_member->neighbor_ptr(nn) == remote_elem));
1277 #endif
1278 
1279  neigh_family_member->set_neighbor(nn, this);
1280  }
1281 }
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
const Elem * parent() const
Definition: elem.h:2073
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:1749
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
unsigned int level() const
Definition: elem.h:2115
RefinementState refinement_flag() const
Definition: elem.h:2220
virtual UniquePtr< Elem > side_ptr(unsigned int i)=0
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::Elem::make_links_to_me_remote ( )
inherited

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 a remote element is deleted on the local processor.

Definition at line 1284 of file elem.C.

References libMesh::Elem::child_ptr(), libMesh::Elem::dim(), libMesh::Elem::family_tree_by_neighbor(), libMesh::Elem::family_tree_by_subneighbor(), libMesh::Elem::has_children(), libMesh::Elem::has_neighbor(), libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::Elem::n_children(), libMesh::Elem::n_neighbors(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), libMesh::remote_elem, libMesh::Elem::set_child(), libMesh::Elem::set_neighbor(), libMesh::Elem::subactive(), libMesh::Elem::which_child_am_i(), and libMesh::Elem::which_neighbor_am_i().

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

1285 {
1286  libmesh_assert_not_equal_to (this, remote_elem);
1287 
1288  // We need to have handled any children first
1289 #if defined(LIBMESH_ENABLE_AMR) && defined(DEBUG)
1290  if (this->has_children())
1291  for (unsigned int c = 0; c != this->n_children(); ++c)
1292  {
1293  Elem * current_child = this->child_ptr(c);
1294  libmesh_assert_equal_to (current_child, remote_elem);
1295  }
1296 #endif
1297 
1298  // Remotify any neighbor links to non-subactive elements
1299  if (!this->subactive())
1300  {
1301  for (unsigned int s = 0; s != this->n_sides(); ++s)
1302  {
1303  Elem * neigh = this->neighbor_ptr(s);
1304  if (neigh && neigh != remote_elem && !neigh->subactive())
1305  {
1306  // My neighbor should never be more refined than me; my real
1307  // neighbor would have been its parent in that case.
1308  libmesh_assert_greater_equal (this->level(), neigh->level());
1309 
1310  if (this->level() == neigh->level() &&
1311  neigh->has_neighbor(this))
1312  {
1313 #ifdef LIBMESH_ENABLE_AMR
1314  // My neighbor may have descendants which also consider me a
1315  // neighbor
1316  std::vector<const Elem *> family;
1317  neigh->family_tree_by_neighbor (family, this);
1318 
1319  // FIXME - There's a lot of ugly const_casts here; we
1320  // may want to make remote_elem non-const and create
1321  // non-const versions of the family_tree methods
1322  for (std::size_t i=0; i != family.size(); ++i)
1323  {
1324  Elem * n = const_cast<Elem *>(family[i]);
1325  libmesh_assert (n);
1326  if (n == remote_elem)
1327  continue;
1328  unsigned int my_s = n->which_neighbor_am_i(this);
1329  libmesh_assert_less (my_s, n->n_neighbors());
1330  libmesh_assert_equal_to (n->neighbor_ptr(my_s), this);
1331  n->set_neighbor(my_s, const_cast<RemoteElem *>(remote_elem));
1332  }
1333 #else
1334  unsigned int my_s = neigh->which_neighbor_am_i(this);
1335  libmesh_assert_less (my_s, neigh->n_neighbors());
1336  libmesh_assert_equal_to (neigh->neighbor(my_s), this);
1337  neigh->set_neighbor(my_s, const_cast<RemoteElem *>(remote_elem));
1338 #endif
1339  }
1340 #ifdef LIBMESH_ENABLE_AMR
1341  // Even if my neighbor doesn't link back to me, it might
1342  // have subactive descendants which do
1343  else if (neigh->has_children())
1344  {
1345  // If my neighbor at the same level doesn't have me as a
1346  // neighbor, I must be subactive
1347  libmesh_assert(this->level() > neigh->level() ||
1348  this->subactive());
1349 
1350  // My neighbor must have some ancestor of mine as a
1351  // neighbor
1352  Elem * my_ancestor = this->parent();
1353  libmesh_assert(my_ancestor);
1354  while (!neigh->has_neighbor(my_ancestor))
1355  {
1356  my_ancestor = my_ancestor->parent();
1357  libmesh_assert(my_ancestor);
1358  }
1359 
1360  // My neighbor may have descendants which consider me a
1361  // neighbor
1362  std::vector<const Elem *> family;
1363  neigh->family_tree_by_subneighbor (family, my_ancestor, this);
1364 
1365  // FIXME - There's a lot of ugly const_casts here; we
1366  // may want to make remote_elem non-const and create
1367  // non-const versions of the family_tree methods
1368  for (std::size_t i=0; i != family.size(); ++i)
1369  {
1370  Elem * n = const_cast<Elem *>(family[i]);
1371  libmesh_assert (n);
1372  if (n == remote_elem)
1373  continue;
1374  unsigned int my_s = n->which_neighbor_am_i(this);
1375  libmesh_assert_less (my_s, n->n_neighbors());
1376  libmesh_assert_equal_to (n->neighbor_ptr(my_s), this);
1377  n->set_neighbor(my_s, const_cast<RemoteElem *>(remote_elem));
1378  }
1379  }
1380 #endif
1381  }
1382  }
1383  }
1384 
1385 #ifdef LIBMESH_ENABLE_AMR
1386  // Remotify parent's child link
1387  Elem * my_parent = this->parent();
1388  if (my_parent &&
1389  // As long as it's not already remote
1390  my_parent != remote_elem &&
1391  // And it's a real parent, not an interior parent
1392  this->dim() == my_parent->dim())
1393  {
1394  unsigned int me = my_parent->which_child_am_i(this);
1395  libmesh_assert_equal_to (my_parent->child_ptr(me), this);
1396  my_parent->set_child(me, const_cast<RemoteElem *>(remote_elem));
1397  }
1398 #endif
1399 }
bool has_children() const
Definition: elem.h:2022
bool subactive() const
Definition: elem.h:2002
const Elem * parent() const
Definition: elem.h:2073
libmesh_assert(j)
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:1749
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_sides() const =0
virtual unsigned int n_children() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
virtual unsigned int dim() const =0
unsigned int level() const
Definition: elem.h:2115
const RemoteElem * remote_elem
Definition: remote_elem.C:57
virtual Point libMesh::RemoteElem::master_point ( const unsigned  i) const
inlinevirtual
Returns
the Point associated with local Node i, in master element rather than physical coordinates.

Implements libMesh::Elem.

Definition at line 77 of file remote_elem.h.

78  { libmesh_not_implemented(); return Point(); }
unsigned int libMesh::Elem::max_descendant_p_level ( ) const
inlineinherited

Returns the maximum value of the p-refinement levels of an ancestor element's descendants.

Definition at line 2256 of file elem.h.

References libMesh::Elem::_p_level, libMesh::Elem::active(), libMesh::Elem::child_ptr(), libMesh::libmesh_assert(), std::max(), libMesh::Elem::max_descendant_p_level(), libMesh::Elem::n_children(), libMesh::Elem::p_level(), and libMesh::Elem::subactive().

Referenced by libMesh::FEGenericBase< OutputType >::coarsened_dof_values(), and libMesh::Elem::max_descendant_p_level().

2257 {
2258  // This is undefined for subactive elements,
2259  // which have no active descendants
2260  libmesh_assert (!this->subactive());
2261  if (this->active())
2262  return this->p_level();
2263 
2264  unsigned int max_p_level = _p_level;
2265  for (unsigned int c=0; c != this->n_children(); c++)
2266  max_p_level = std::max(max_p_level,
2267  this->child_ptr(c)->max_descendant_p_level());
2268  return max_p_level;
2269 }
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
unsigned char _p_level
Definition: elem.h:1497
unsigned int p_level() const
Definition: elem.h:2149
unsigned int max_descendant_p_level() const
Definition: elem.h:2256
long double max(long double a, double b)
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_children() const =0
unsigned int libMesh::Elem::min_new_p_level_by_neighbor ( const Elem neighbor,
unsigned int  current_min 
) const
inherited

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 1890 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::child_ptr(), libMesh::Elem::COARSEN, libMesh::Elem::has_neighbor(), libMesh::libmesh_assert(), std::min(), libMesh::Elem::min_new_p_level_by_neighbor(), libMesh::Elem::n_children(), libMesh::Elem::p_level(), libMesh::Elem::p_refinement_flag(), libMesh::Elem::REFINE, libMesh::remote_elem, and libMesh::Elem::subactive().

Referenced by libMesh::MeshRefinement::eliminate_unrefined_patches(), and libMesh::Elem::min_new_p_level_by_neighbor().

1892 {
1893  libmesh_assert(!this->subactive());
1894  libmesh_assert(neighbor_in->active());
1895 
1896  // If we're an active element this is simple
1897  if (this->active())
1898  {
1899  unsigned int new_p_level = this->p_level();
1900  if (this->p_refinement_flag() == Elem::REFINE)
1901  new_p_level += 1;
1902  if (this->p_refinement_flag() == Elem::COARSEN)
1903  {
1904  libmesh_assert_greater (new_p_level, 0);
1905  new_p_level -= 1;
1906  }
1907  return std::min(current_min, new_p_level);
1908  }
1909 
1910  libmesh_assert(has_neighbor(neighbor_in));
1911 
1912  unsigned int min_p_level = current_min;
1913 
1914  for (unsigned int c=0; c<this->n_children(); c++)
1915  {
1916  const Elem * const current_child = this->child_ptr(c);
1917  if (current_child && current_child != remote_elem)
1918  if (current_child->has_neighbor(neighbor_in))
1919  min_p_level =
1920  current_child->min_new_p_level_by_neighbor(neighbor_in,
1921  min_p_level);
1922  }
1923 
1924  return min_p_level;
1925 }
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
unsigned int p_level() const
Definition: elem.h:2149
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
RefinementState p_refinement_flag() const
Definition: elem.h:2236
virtual unsigned int n_children() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
bool has_neighbor(const Elem *elem) const
Definition: elem.h:1790
long double min(long double a, double b)
const RemoteElem * remote_elem
Definition: remote_elem.C:57
unsigned int libMesh::Elem::min_p_level_by_neighbor ( const Elem neighbor,
unsigned int  current_min 
) const
inherited

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 1857 of file elem.C.

References libMesh::Elem::active(), libMesh::Elem::child_ptr(), libMesh::Elem::has_neighbor(), libMesh::libmesh_assert(), std::min(), libMesh::Elem::min_p_level_by_neighbor(), libMesh::Elem::n_children(), libMesh::Elem::p_level(), libMesh::remote_elem, and libMesh::Elem::subactive().

Referenced by libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::FEGenericBase< OutputType >::compute_proj_constraints(), and libMesh::Elem::min_p_level_by_neighbor().

1859 {
1860  libmesh_assert(!this->subactive());
1861  libmesh_assert(neighbor_in->active());
1862 
1863  // If we're an active element this is simple
1864  if (this->active())
1865  return std::min(current_min, this->p_level());
1866 
1867  libmesh_assert(has_neighbor(neighbor_in));
1868 
1869  // The p_level() of an ancestor element is already the minimum
1870  // p_level() of its children - so if that's high enough, we don't
1871  // need to examine any children.
1872  if (current_min <= this->p_level())
1873  return current_min;
1874 
1875  unsigned int min_p_level = current_min;
1876 
1877  for (unsigned int c=0; c<this->n_children(); c++)
1878  {
1879  const Elem * const current_child = this->child_ptr(c);
1880  if (current_child != remote_elem && current_child->has_neighbor(neighbor_in))
1881  min_p_level =
1882  current_child->min_p_level_by_neighbor(neighbor_in,
1883  min_p_level);
1884  }
1885 
1886  return min_p_level;
1887 }
bool subactive() const
Definition: elem.h:2002
bool active() const
Definition: elem.h:1984
unsigned int p_level() const
Definition: elem.h:2149
libmesh_assert(j)
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2163
virtual unsigned int n_children() const =0
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Definition: elem.h:1517
bool has_neighbor(const Elem *elem) const
Definition: elem.h:1790
long double min(long double a, double b)
const RemoteElem * remote_elem
Definition: remote_elem.C:57
virtual unsigned int libMesh::RemoteElem::n_children ( ) const
inlinevirtual
Returns
the number of children the element that has been derived from this class may have.

Implements libMesh::Elem.

Definition at line 120 of file remote_elem.h.

121  { libmesh_not_implemented(); return 0; }
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 772 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::_dof_indices(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEGenericBase< OutputType >::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::distribute_local_dofs_node_major(), libMesh::DofMap::dof_indices(), libMesh::DofObject::dof_number(), libMesh::DofObject::DofObject(), libMesh::OldSolutionValue< Output, point_output >::eval_at_node(), libMesh::Node::get_info(), libMesh::Elem::get_info(), libMesh::DofMap::local_variable_indices(), libMesh::DofObject::n_dofs(), libMesh::DofMap::old_dof_indices(), libMesh::BuildProjectionList::operator()(), libMesh::DofObject::operator=(), libMesh::DofObject::print_dof_info(), libMesh::DofObject::set_dof_number(), libMesh::DofObject::set_id(), libMesh::DofObject::set_n_vars_per_group(), libMesh::DofMap::set_nonlocal_dof_objects(), and libMesh::System::zero_variable().

774 {
775  libmesh_assert_less (s, this->n_systems());
776  libmesh_assert_less (var, this->n_vars(s));
777 
778  return this->n_comp_group(s,this->var_to_vg(s,var));
779 }
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:785
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:737
unsigned int var_to_vg(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:938
unsigned int n_systems() const
Definition: dof_object.h:718
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 785 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::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofObject::dof_number(), libMesh::DofObject::invalidate_dofs(), libMesh::DofObject::n_comp(), libMesh::DofMap::reinit(), libMesh::DofObject::set_dof_number(), libMesh::DofObject::set_id(), libMesh::DofObject::set_n_comp_group(), libMesh::DofObject::set_n_vars_per_group(), and libMesh::DofMap::set_nonlocal_dof_objects().

787 {
788  libmesh_assert_less (s, this->n_systems());
789  libmesh_assert_less (vg, this->n_var_groups(s));
790 
791  const unsigned int
792  start_idx_sys = this->start_idx(s);
793 
794  libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size());
795 
796  return (_idx_buf[start_idx_sys + 2*vg] % ncv_magic);
797 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:727
unsigned int start_idx(const unsigned int s) const
Definition: dof_object.h:870
index_buffer_t _idx_buf
Definition: dof_object.h:477
unsigned int n_systems() const
Definition: dof_object.h:718
static const index_t ncv_magic
Definition: dof_object.h:488
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 602 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::EquationSystems::build_parallel_solution_vector().

604 {
605  libmesh_assert_less (s, this->n_systems());
606 
607  unsigned int num = 0;
608 
609  // Count all variables
610  if (var == libMesh::invalid_uint)
611  for (unsigned int v=0; v<this->n_vars(s); v++)
612  num += this->n_comp(s,v);
613 
614  // Only count specified variable
615  else
616  num = this->n_comp(s,var);
617 
618  return num;
619 }
const unsigned int invalid_uint
Definition: libmesh.h:184
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:737
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:772
unsigned int n_systems() const
Definition: dof_object.h:718
virtual unsigned int libMesh::RemoteElem::n_edges ( ) const
inlinevirtual
Returns
the number of edges the element that has been derived from this class has.

Implements libMesh::Elem.

Definition at line 114 of file remote_elem.h.

115  { libmesh_not_implemented(); return 0; }
virtual unsigned int libMesh::RemoteElem::n_faces ( ) const
inlinevirtual
Returns
the number of faces the element that has been derived from this class has.

Implements libMesh::Elem.

Definition at line 117 of file remote_elem.h.

118  { libmesh_not_implemented(); return 0; }
virtual unsigned int libMesh::Elem::n_neighbors ( ) const
inlinevirtualinherited
Returns
the number of neighbors the element that has been derived from this class has. By default only face (or edge in 2D) neighbors are stored, so this method returns n_sides(), however it may be overloaded in a derived class.

Definition at line 530 of file elem.h.

References libMesh::Elem::n_edges(), libMesh::Elem::n_sides(), and libMesh::Elem::n_vertices().

Referenced by libMesh::Elem::_last_side(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::TetGenMeshInterface::check_hull_integrity(), libMesh::Elem::child_neighbor(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::FEGenericBase< OutputType >::compute_proj_constraints(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::MeshTools::find_boundary_nodes(), libMesh::MeshTools::find_hanging_nodes_and_parents(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::Tri3Subdivision::get_ordered_valence(), libMesh::Elem::has_neighbor(), libMesh::Elem::has_topological_neighbor(), libMesh::LaplaceMeshSmoother::init(), libMesh::MeshTools::libmesh_assert_no_links_to_elem(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::Elem::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_node_pointers(), libMesh::MeshTools::libmesh_assert_valid_remote_elems(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::Elem::make_links_to_me_remote(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::nullify_neighbors(), libMesh::Parallel::Packing< const Elem * >::pack(), libMesh::Parallel::Packing< const Elem * >::packable_size(), libMesh::MetisPartitioner::partition_range(), libMesh::Elem::set_neighbor(), libMesh::MeshTools::Modification::smooth(), libMesh::ReplicatedMesh::stitching_helper(), libMesh::MeshRefinement::test_level_one(), libMesh::Elem::topological_neighbor(), libMesh::Parallel::Packing< Elem * >::unpack(), and libMesh::Elem::which_neighbor_am_i().

531  { return this->n_sides(); }
virtual unsigned int n_sides() const =0
virtual unsigned int libMesh::RemoteElem::n_nodes ( ) const
inlinevirtual
Returns
the number of nodes this element contains.

Implements libMesh::Elem.

Definition at line 105 of file remote_elem.h.

106  { libmesh_not_implemented(); return 0; }
virtual unsigned int libMesh::Elem::n_nodes_in_child ( unsigned  int) const
inlinevirtualinherited
Returns
the number of nodes the given child of this element contains. Except in odd cases like pyramid refinement this will be the same as the number of nodes in the parent element.

Definition at line 508 of file elem.h.

References libMesh::Elem::n_nodes().

Referenced by libMesh::Elem::as_parent_node(), libMesh::Elem::bracketing_nodes(), libMesh::TopologyMap::fill(), and libMesh::Elem::parent_bracketing_nodes().

509  { return this->n_nodes(); }
virtual unsigned int n_nodes() const =0
static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited
static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited
unsigned int libMesh::Elem::n_second_order_adjacent_vertices ( const unsigned int  n) const
virtualinherited
Returns
the number of adjacent vertices that uniquely define the location of the $ n^{th} $ second-order node. For linear elements (default_order()==FIRST), this returns 0. This method is useful when converting linear elements to quadratic elements. Note that n has to be greater than or equal to this->n_vertices().

Reimplemented in libMesh::Pyramid14, libMesh::InfHex18, libMesh::Hex27, libMesh::Prism18, libMesh::InfHex16, libMesh::Pyramid13, libMesh::Hex20, libMesh::Prism15, libMesh::Tet10, libMesh::Quad9, libMesh::InfPrism12, libMesh::InfQuad6, libMesh::Quad8, libMesh::Tri6, libMesh::Edge4, and libMesh::Edge3.

Definition at line 2547 of file elem.C.

Referenced by libMesh::Elem::is_linear(), libMesh::LaplaceMeshSmoother::smooth(), and libMesh::MeshTools::Modification::smooth().

2548 {
2549  // for linear elements, always return 0
2550  return 0;
2551 }
virtual unsigned int libMesh::RemoteElem::n_sides ( ) const
inlinevirtual
Returns
the number of sides the element that has been derived from this class has. In 2D the number of sides is the number of edges, in 3D the number of sides is the number of faces.

Implements libMesh::Elem.

Definition at line 108 of file remote_elem.h.

109  { libmesh_not_implemented(); return 0; }
virtual unsigned int libMesh::RemoteElem::n_sub_elem ( ) const
inlinevirtual
Returns
the number of sub-elements this element may be broken down into for visualization purposes. For example, this returns 1 for a linear triangle, 4 for a quadratic (6-noded) triangle, etc...

Implements libMesh::Elem.

Definition at line 148 of file remote_elem.h.

149  { libmesh_not_implemented(); return 0; }
unsigned int libMesh::DofObject::n_vars ( const unsigned int  s,
const unsigned int  vg 
) const
inlineinherited
Returns
the number of Variable variables associated with VariableGroup vg in system s for this DofObject

Definition at line 737 of file dof_object.h.

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

Referenced by libMesh::DofObject::add_system(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::DofMap::distribute_dofs(), libMesh::DofObject::dof_number(), libMesh::DofObject::DofObject(), libMesh::OldSolutionValue< Output, point_output >::eval_at_node(), libMesh::Node::get_info(), libMesh::Elem::get_info(), libMesh::DofObject::has_dofs(), libMesh::DofObject::n_comp(), libMesh::DofObject::n_dofs(), libMesh::DofObject::n_vars(), libMesh::BuildProjectionList::operator()(), libMesh::DofObject::operator=(), libMesh::DofObject::print_dof_info(), libMesh::DofObject::set_dof_number(), libMesh::DofObject::set_id(), libMesh::DofObject::set_n_comp(), libMesh::DofObject::set_n_comp_group(), libMesh::DofObject::set_n_systems(), libMesh::DofObject::set_n_vars_per_group(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::DofObject::system_var_to_vg_var(), and libMesh::DofObject::var_to_vg().

739 {
740  libmesh_assert_less (s, this->n_systems());
741  libmesh_assert_less (vg, this->n_var_groups(s));
742 
743  const unsigned int start_idx_sys = this->start_idx(s);
744 
745  libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size());
746 
747  return (cast_int<unsigned int>
748  (_idx_buf[start_idx_sys + 2*vg]) >> ncv_magic_exp);
749 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:727
unsigned int start_idx(const unsigned int s) const
Definition: dof_object.h:870
index_buffer_t _idx_buf
Definition: dof_object.h:477
unsigned int n_systems() const
Definition: dof_object.h:718
static const index_t ncv_magi