20 #ifndef LIBMESH_ELEM_H 21 #define LIBMESH_ELEM_H 24 #include "libmesh/libmesh_common.h" 25 #include "libmesh/bounding_box.h" 26 #include "libmesh/dof_object.h" 27 #include "libmesh/id_types.h" 28 #include "libmesh/reference_counted_object.h" 29 #include "libmesh/node.h" 30 #include "libmesh/enum_elem_type.h" 31 #include "libmesh/multi_predicates.h" 32 #include "libmesh/pointer_to_pointer_iter.h" 33 #include "libmesh/int_range.h" 34 #include "libmesh/simple_range.h" 35 #include "libmesh/variant_filter_iterator.h" 36 #include "libmesh/hashword.h" 56 #ifdef LIBMESH_ENABLE_PERIODIC 57 class PeriodicBoundaries;
58 class PointLocatorBase;
60 template <
class S
ideType,
class ParentType>
108 Elem ** elemlinkdata,
109 Node ** nodelinkdata);
130 virtual ~Elem() =
default;
135 const Point &
point (
const unsigned int i)
const;
191 #ifdef LIBMESH_ENABLE_DEPRECATED 201 #endif // LIBMESH_ENABLE_DEPRECATED 206 virtual void set_node (
const unsigned int i,
246 = std::numeric_limits<subdomain_id_type>::max();
343 #ifdef LIBMESH_ENABLE_PERIODIC 453 unsigned int side_node)
const = 0;
463 unsigned int edge_node)
const = 0;
465 #ifdef LIBMESH_ENABLE_DEPRECATED 470 unsigned int side_node)
const;
471 #endif // LIBMESH_ENABLE_DEPRECATED 506 std::set<const Elem *> & neighbor_set)
const;
521 const Elem * start_elem)
const;
536 std::set<const Elem *> & neighbor_set)
const;
607 std::vector<dof_id_type> & conn)
const = 0;
635 virtual unsigned short dim ()
const = 0;
650 virtual unsigned int n_nodes ()
const = 0;
687 virtual unsigned int n_sides ()
const = 0;
728 virtual unsigned int n_edges ()
const = 0;
750 virtual unsigned int n_faces ()
const = 0;
767 virtual bool is_vertex(
const unsigned int i)
const = 0;
776 unsigned int n)
const 784 unsigned int n)
const;
790 virtual bool is_edge(
const unsigned int i)
const = 0;
797 virtual bool is_face(
const unsigned int i)
const = 0;
809 const unsigned int s)
const = 0;
814 virtual std::vector<unsigned int>
nodes_on_side(
const unsigned int )
const = 0;
819 virtual std::vector<unsigned int>
nodes_on_edge(
const unsigned int )
const = 0;
824 virtual std::vector<unsigned int>
sides_on_edge(
const unsigned int )
const = 0;
836 const unsigned int e)
const = 0;
842 const unsigned int s)
const = 0;
848 virtual unsigned int opposite_side(
const unsigned int s)
const;
856 const unsigned int s)
const;
881 virtual std::unique_ptr<Elem>
side_ptr (
unsigned int i) = 0;
882 std::unique_ptr<const Elem>
side_ptr (
unsigned int i)
const;
898 virtual void side_ptr (std::unique_ptr<Elem> & side,
const unsigned int i) = 0;
899 void side_ptr (std::unique_ptr<const Elem> & side,
const unsigned int i)
const;
921 virtual std::unique_ptr<Elem>
build_side_ptr (
const unsigned int i) = 0;
922 std::unique_ptr<const Elem>
build_side_ptr (
const unsigned int i)
const;
924 #ifdef LIBMESH_ENABLE_DEPRECATED 929 {
if (proxy) libmesh_error(); libmesh_deprecated();
return this->
build_side_ptr(i); }
931 std::unique_ptr<const Elem>
build_side_ptr (
const unsigned int i,
bool proxy)
const 932 {
if (proxy) libmesh_error(); libmesh_deprecated();
return this->
build_side_ptr(i); }
949 virtual void build_side_ptr (std::unique_ptr<Elem> & side,
const unsigned int i) = 0;
950 void build_side_ptr (std::unique_ptr<const Elem> & side,
const unsigned int i)
const;
965 virtual std::unique_ptr<Elem>
build_edge_ptr (
const unsigned int i) = 0;
966 std::unique_ptr<const Elem>
build_edge_ptr (
const unsigned int i)
const;
982 virtual void build_edge_ptr (std::unique_ptr<Elem> & edge,
const unsigned int i) = 0;
983 void build_edge_ptr (std::unique_ptr<const Elem> & edge,
const unsigned int i)
const;
1015 #ifdef LIBMESH_ENABLE_DEPRECATED 1026 #endif // LIBMESH_ENABLE_DEPRECATED 1062 { libmesh_not_implemented(); }
1122 { libmesh_not_implemented();
return std::make_pair(0.,0.); }
1323 const unsigned int n2)
const;
1346 const unsigned int v)
const;
1363 virtual std::pair<unsigned short int, unsigned short int>
1380 const bool full_ordered=
true);
1412 unsigned int level ()
const;
1419 unsigned int p_level ()
const;
1425 const unsigned int s)
const = 0;
1448 #ifdef LIBMESH_ENABLE_AMR 1485 class ConstChildRefIter;
1518 const unsigned int e)
const;
1552 void family_tree (std::vector<const Elem *> & family,
1553 bool reset =
true)
const;
1566 bool reset =
true)
const;
1581 bool reset =
true)
const;
1595 bool reset =
true)
const;
1610 bool reset =
true)
const;
1624 const Elem * neighbor,
1625 bool reset =
true)
const;
1639 const Elem * neighbor,
1640 bool reset =
true)
const;
1656 const Elem * neighbor,
1657 const Elem * subneighbor,
1658 bool reset =
true)
const;
1673 const Elem * neighbor,
1674 const Elem * subneighbor,
1675 bool reset =
true)
const;
1690 const Elem * neighbor,
1691 bool reset =
true)
const;
1706 const Elem * neighbor,
1710 bool reset =
true)
const;
1754 unsigned int current_min)
const;
1762 unsigned int current_min)
const;
1891 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1897 virtual bool infinite ()
const = 0;
1974 virtual void permute(
unsigned int perm_num) = 0;
2009 #ifdef LIBMESH_ENABLE_AMR 2017 unsigned int n)
const;
2024 const std::vector<std::pair<unsigned char, unsigned char>> &
2026 unsigned int n)
const;
2033 const std::vector<std::pair<dof_id_type, dof_id_type>>
2035 unsigned int n)
const;
2042 const unsigned int child_node_num,
2043 const unsigned int parent_node_num)
const = 0;
2054 #endif // LIBMESH_ENABLE_AMR 2125 void swap3nodes(
unsigned int n1,
unsigned int n2,
unsigned int n3)
2144 void swap4nodes(
unsigned int n1,
unsigned int n2,
unsigned int n3,
2155 unsigned int n3,
unsigned int n4)
2165 template <
typename S
ide
class,
typename Sub
class>
2166 std::unique_ptr<Elem>
2172 template <
typename Sub
class>
2174 const unsigned int i,
2180 template <
typename Sub
class,
typename Map
class>
2182 const unsigned int i,
2188 template <
typename Edge
class,
typename Sub
class>
2189 std::unique_ptr<Elem>
2195 template <
typename Sub
class>
2197 const unsigned int i,
2201 #ifdef LIBMESH_ENABLE_AMR 2209 std::vector<std::vector<std::vector<std::vector<std::pair<unsigned char, unsigned char>>>>> &
2212 static std::vector<std::vector<std::vector<std::vector<std::pair<unsigned char, unsigned char>>>>> c;
2223 std::vector<std::vector<std::vector<signed char>>> &
2226 static std::vector<std::vector<std::vector<signed char>>> c;
2231 #endif // LIBMESH_ENABLE_AMR 2254 #ifdef LIBMESH_ENABLE_AMR 2270 #ifdef LIBMESH_ENABLE_AMR 2328 #ifdef LIBMESH_ENABLE_AMR 2360 #endif // LIBMESH_ENABLE_AMR 2380 const unsigned int ns,
2382 Elem ** elemlinkdata,
2383 Node ** nodelinkdata) :
2384 _nodes(nodelinkdata),
2385 _elemlinks(elemlinkdata),
2387 #ifdef LIBMESH_ENABLE_AMR
2388 _rflag(
Elem::DO_NOTHING),
2389 _pflag(
Elem::DO_NOTHING),
2392 _map_type(p ? p->mapping_type() : 0),
2393 _map_data(p ? p->mapping_data() : 0)
2408 libmesh_assert_equal_to(nn, p->
n_nodes());
2409 libmesh_assert_equal_to(ns, p->
n_sides());
2417 for (
unsigned int n=0; n<nn; n++)
2433 for (
unsigned int n=1; n<ns+1; n++)
2444 #ifdef LIBMESH_ENABLE_AMR 2456 libmesh_assert_less (i, this->
n_nodes());
2468 libmesh_assert_less (i, this->
n_nodes());
2478 libmesh_assert_less (i, this->
n_nodes());
2510 libmesh_assert_less (i, this->
n_nodes());
2521 libmesh_assert_less (i, this->
n_nodes());
2557 #ifdef LIBMESH_ENABLE_DEPRECATED 2561 libmesh_assert_less (i, this->
n_nodes());
2563 libmesh_deprecated();
2567 #endif // LIBMESH_ENABLE_DEPRECATED 2575 libmesh_assert_less (i, this->
n_nodes());
2644 if (n && n->parent() ==
this)
2656 if (n && n->parent() ==
this)
2686 return {0, cast_int<unsigned short>(this->
n_nodes())};
2695 return {0, cast_int<unsigned short>(this->
n_edges())};
2704 return {0, cast_int<unsigned short>(this->
n_faces())};
2713 return {0, cast_int<unsigned short>(this->
n_sides())};
2724 Elem * me =
const_cast<Elem *
>(
this);
2733 const unsigned int i)
const 2736 Elem * me =
const_cast<Elem *
>(
this);
2737 std::unique_ptr<Elem> e {
const_cast<Elem *
>(elem.release())};
2739 elem = std::move(e);
2745 std::unique_ptr<const Elem>
2750 Elem * me =
const_cast<Elem *
>(
this);
2759 const unsigned int i)
const 2762 Elem * me =
const_cast<Elem *
>(
this);
2763 std::unique_ptr<Elem> e {
const_cast<Elem *
>(elem.release())};
2765 elem = std::move(e);
2770 template <
typename S
ide
class,
typename Sub
class>
2772 std::unique_ptr<Elem>
2775 libmesh_assert_less (i, this->
n_sides());
2777 std::unique_ptr<Elem> face = std::make_unique<Sideclass>();
2778 for (
auto n : face->node_index_range())
2779 face->set_node(n, this->node_ptr(Subclass::side_nodes_map[i][n]));
2781 face->set_interior_parent(
this);
2782 face->inherit_data_from(*
this);
2789 template <
typename Sub
class>
2793 const unsigned int i,
2796 libmesh_assert_less (i, this->
n_sides());
2798 if (!side.get() || side->type() != sidetype)
2800 Subclass & real_me = cast_ref<Subclass&>(*this);
2801 side = real_me.Subclass::build_side_ptr(i);
2805 side->set_interior_parent(
this);
2806 side->inherit_data_from(*
this);
2807 for (
auto n : side->node_index_range())
2808 side->set_node(n, this->node_ptr(Subclass::side_nodes_map[i][n]));
2814 template <
typename Sub
class,
typename Map
class>
2818 const unsigned int i,
2821 libmesh_assert_less (i, this->
n_sides());
2823 if (!side.get() || side->type() != sidetype)
2825 Subclass & real_me = cast_ref<Subclass&>(*this);
2826 side = real_me.Subclass::side_ptr(i);
2832 for (
auto n : side->node_index_range())
2833 side->set_node(n, this->node_ptr(Mapclass::side_nodes_map[i][n]));
2840 std::unique_ptr<const Elem>
2845 Elem * me =
const_cast<Elem *
>(
this);
2854 const unsigned int i)
const 2857 Elem * me =
const_cast<Elem *
>(
this);
2858 std::unique_ptr<Elem> e {
const_cast<Elem *
>(elem.release())};
2860 elem = std::move(e);
2864 template <
typename Edge
class,
typename Sub
class>
2866 std::unique_ptr<Elem>
2869 libmesh_assert_less (i, this->
n_edges());
2871 std::unique_ptr<Elem> edge = std::make_unique<Edgeclass>();
2873 for (
auto n : edge->node_index_range())
2874 edge->set_node(n, this->node_ptr(Subclass::edge_nodes_map[i][n]));
2876 edge->set_interior_parent(
this);
2877 edge->inherit_data_from(*
this);
2885 template <
typename Sub
class>
2889 const unsigned int i,
2892 libmesh_assert_less (i, this->
n_edges());
2894 if (!edge.get() || edge->type() != edgetype)
2896 Subclass & real_me = cast_ref<Subclass&>(*this);
2897 edge = real_me.Subclass::build_edge_ptr(i);
2901 edge->inherit_data_from(*
this);
2902 for (
auto n : edge->node_index_range())
2903 edge->set_node(n, this->node_ptr(Subclass::edge_nodes_map[i][n]));
2924 const Elem * eparent = e;
2928 eparent = eparent->
parent();
2944 #ifdef LIBMESH_ENABLE_AMR 2962 #ifdef LIBMESH_ENABLE_AMR 2967 for (
const Elem * my_ancestor = this->
parent();
2968 my_ancestor !=
nullptr;
2969 my_ancestor = my_ancestor->
parent())
2970 if (my_ancestor->active())
2982 #ifdef LIBMESH_ENABLE_AMR 2996 #ifdef LIBMESH_ENABLE_AMR 3001 if (c.has_children())
3011 #ifdef LIBMESH_ENABLE_AMR
3016 #ifdef LIBMESH_ENABLE_AMR 3017 const Elem * e = descendant;
3050 libmesh_assert_equal_to(this->
dim(), p ? p->
dim() : this->
dim());
3059 const Elem * tp =
this;
3063 while (tp->
parent() !=
nullptr)
3067 libmesh_assert_equal_to (tp->
level(), 0);
3077 #ifdef LIBMESH_ENABLE_AMR 3083 if (this->
parent() ==
nullptr)
3111 #ifdef LIBMESH_ENABLE_AMR 3152 #ifdef LIBMESH_ENABLE_AMR 3199 for (
unsigned int c=0; c != nc; c++)
3203 libmesh_error_msg(
"ERROR: which_child_am_i() was called with a non-child!");
3221 _rflag = cast_int<unsigned char>(rflag);
3238 libmesh_assert_not_equal_to
3241 _pflag = cast_int<unsigned char>(pflag);
3255 unsigned int max_p_level =
_p_level;
3257 max_p_level = std::max(max_p_level,
3258 c.max_descendant_p_level());
3268 libmesh_assert_not_equal_to
3271 _p_level = cast_int<unsigned char>(p);
3279 _pflag = cast_int<unsigned char>(pflag);
3283 #endif // ifdef LIBMESH_ENABLE_AMR 3290 this->
flip(boundary_info);
3307 if (n0 > n1) std::swap (n0, n1);
3319 std::array<dof_id_type, 3> array = {{n0, n1, n2}};
3320 std::sort(array.begin(), array.end());
3332 std::array<dof_id_type, 4> array = {{n0, n1, n2, n3}};
3333 std::sort(array.begin(), array.end());
3346 #ifdef LIBMESH_ENABLE_AMR 3417 this->_parent == other.
_parent);
3494 template <
typename PredType,
typename IterType>
3497 const PredType & p ) :
3521 #define LIBMESH_ENABLE_TOPOLOGY_CACHES \ 3523 std::vector<std::vector<std::vector<std::vector<std::pair<unsigned char, unsigned char>>>>> & \ 3524 _get_bracketing_node_cache() const override \ 3526 static std::vector<std::vector<std::vector<std::vector<std::pair<unsigned char, unsigned char>>>>> c; \ 3531 std::vector<std::vector<std::vector<signed char>>> & \ 3532 _get_parent_indices_cache() const override \ 3534 static std::vector<std::vector<std::vector<signed char>>> c; \ 3543 #endif // LIBMESH_ELEM_H virtual Point true_centroid() 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, bool reset=true) const
Same as the active_family_tree_by_neighbor() member, but the neighbor here may be a topological (e...
bool has_neighbor(const Elem *elem) const
void set_p_level(const unsigned int p)
Sets the value of the p-refinement level for the element.
unsigned char mapping_data() const
virtual bool is_vertex_on_parent(unsigned int c, unsigned int n) const
std::unique_ptr< Elem > simple_build_side_ptr(const unsigned int i)
An implementation for simple (all sides equal) elements.
static const Order type_to_default_order_map[INVALID_ELEM]
This array maps the integer representation of the ElemType enum to the default approximation order of...
RefinementState refinement_flag() const
ElemType
Defines an enum for geometric element types.
The SimpleRange templated class is intended to make it easy to construct ranges from pairs of iterato...
void swap2boundaryedges(unsigned short e1, unsigned short e2, BoundaryInfo *boundary_info) const
Swaps two edges in boundary_info, if it is non-null.
virtual Point quasicircumcenter() const
unsigned char _map_type
Mapping function type; currently either 0 (LAGRANGE) or 1 (RATIONAL_BERNSTEIN).
unsigned char _map_data
Mapping function data; currently used when needed to store the RATIONAL_BERNSTEIN nodal weight data i...
void write_connectivity(std::ostream &out, const IOPackage iop) const
Writes the element connectivity for various IO packages to the passed ostream "out".
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i, bool proxy)
const Elem * parent() const
virtual const std::vector< std::pair< dof_id_type, dof_id_type > > bracketing_nodes(unsigned int c, unsigned int n) const
Order
defines an enum for polynomial orders.
void print_info(std::ostream &os=libMesh::out) const
Prints relevant information about the element.
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
void active_family_tree_by_side(std::vector< const Elem *> &family, unsigned int side, bool reset=true) const
Same as the active_family_tree() member, but only adds elements which are next to side...
virtual Node *& set_node(const unsigned int i)
A Node is like a Point, but with more information.
bool is_ancestor_of(const Elem *descendant) const
Node ** _nodes
Pointers to the nodes we are connected to.
Elem * child_neighbor(Elem *elem)
virtual std::vector< unsigned int > sides_on_edge(const unsigned int) const =0
static ElemType complete_order_equivalent_type(const ElemType et)
Predicates::multi_predicate Predicate
Useful iterator typedefs.
virtual Order default_side_order() const
virtual Point origin() const
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
void set_parent(Elem *p)
Sets the pointer to the element's parent.
unsigned int get_node_index(const Node *node_ptr) const
std::string get_info() const
Prints relevant information about the element to a string.
static const unsigned int type_to_n_sides_map[INVALID_ELEM]
This array maps the integer representation of the ElemType enum to the number of sides on the element...
Original Authors: Corwin Joy * Michael Gradman
[email protected] *
[email protected] Caminus, Suite 1150, Two Allen Center, 1200 Smith Street, Houston, TX 77002 This class is an extension of variant_bidirectional_iterator to a filter_iterator similar to boost's.
const Elem * interior_parent() const
const Elem * topological_neighbor(const unsigned int i, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb) const
void orient(BoundaryInfo *boundary_info)
Flips the element (by swapping node and neighbor pointers) to have a mapping Jacobian of opposite sig...
void set_mapping_type(const ElemMappingType type)
Sets the value of the mapping type for the element.
virtual bool is_face(const unsigned int i) const =0
bool is_semilocal(const processor_id_type my_pid) const
unsigned char _pflag
p refinement flag.
virtual ElemType side_type(const unsigned int s) const =0
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
unsigned char _p_level
p refinement level - the difference between the polynomial degree on this element and the minimum pol...
IntRange< unsigned short > side_index_range() const
void contract()
Contract an active element, i.e.
void libmesh_assert_valid_node_pointers() const
Checks for a valid id and pointers to nodes with valid ids on this element.
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i)=0
virtual dof_id_type key() const
static constexpr Real TOLERANCE
const Elem * top_parent() const
We're using a class instead of a typedef to allow forward declarations and future flexibility...
virtual bool runtime_topology() const
virtual bool is_edge_on_side(const unsigned int e, const unsigned int s) const =0
virtual unsigned int embedding_matrix_version() const
unsigned int which_side_am_i(const Elem *e) const
This function tells you which side the boundary element e is.
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const =0
SideIter(const unsigned int side_number, Elem *parent)
virtual ~Elem()=default
Destructor.
RefinementState p_refinement_flag() const
IOPackage
libMesh interfaces with several different software packages for the purposes of creating, reading, and writing mesh files.
virtual dof_id_type low_order_key(const unsigned int s) const =0
virtual bool has_affine_map() const
void find_interior_neighbors(std::set< const Elem *> &neighbor_set) const
This function finds all active elements (not including this one) in the parent manifold of this eleme...
static const unsigned int type_to_dim_map[INVALID_ELEM]
This array maps the integer representation of the ElemType enum to the geometric dimension of the ele...
void family_tree_by_subneighbor(std::vector< const Elem *> &family, const Elem *neighbor, const Elem *subneighbor, bool reset=true) const
Same as the family_tree() member, but only adds elements which are next to subneighbor.
bool operator==(const SideIter &other) const
void family_tree(std::vector< const Elem *> &family, bool reset=true) const
Fills the vector family with the children of this element, recursively.
This is the base class from which all geometric element types are derived.
void add_child(Elem *elem)
Adds a child pointer to the array of children of this element.
virtual BoundingBox loose_bounding_box() const
SideIter & operator=(const SideIter &other)
virtual bool on_reference_element(const Point &p, const Real eps=TOLERANCE) const =0
unsigned int min_new_p_level_by_neighbor(const Elem *neighbor, unsigned int current_min) const
RefinementState
Enumeration of possible element refinement states.
void set_refinement_flag(const RefinementState rflag)
Sets the value of the refinement flag for the element.
std::ostream & operator<<(std::ostream &os, const OrderWrapper &order)
Overload stream operators.
virtual bool is_node_on_side(const unsigned int n, const unsigned int s) const =0
void active_family_tree(std::vector< const Elem *> &active_family, bool reset=true) const
Same as the family_tree() member, but only adds the active children.
void swap2boundarysides(unsigned short s1, unsigned short s2, BoundaryInfo *boundary_info) const
Swaps two sides in boundary_info, if it is non-null.
virtual unsigned int n_children() const =0
ChildRefIter(Elem *const *childpp)
unsigned int _side_number
unsigned int p_level() const
void find_edge_neighbors(const Point &p1, const Point &p2, std::set< const Elem *> &neighbor_set) const
This function finds all active elements in the same manifold as this element which touch the current ...
side_iterator boundary_sides_end()
void make_links_to_me_remote()
Resets this element's neighbors' appropriate neighbor pointers and its parent's and children's approp...
The libMesh namespace provides an interface to certain functionality in the library.
virtual Real hmax() const
virtual bool is_linear() const
unsigned int min_p_level_by_neighbor(const Elem *neighbor, unsigned int current_min) const
virtual bool is_flipped() const =0
void set_interior_parent(Elem *p)
Sets the pointer to the element's interior_parent.
static const unsigned int type_to_n_nodes_map[INVALID_ELEM]
This array maps the integer representation of the ElemType enum to the number of nodes in the element...
bool contains_vertex_of(const Elem *e, bool mesh_connection=false) const
uint8_t processor_id_type
This is the MeshBase class.
SimpleRange< ChildRefIter > child_ref_range()
Returns a range with all children of a parent element, usable in range-based for loops.
bool has_topological_neighbor(const Elem *elem, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb) const
IntRange< unsigned short > edge_index_range() const
void swap3neighbors(unsigned int n1, unsigned int n2, unsigned int n3)
Swaps three neighbor_ptrs, "rotating" them.
side_iterator boundary_sides_begin()
Iterator accessor functions.
virtual Real embedding_matrix(const unsigned int child_num, const unsigned int child_node_num, const unsigned int parent_node_num) const =0
Elem *& operator*() const
virtual void refine(MeshRefinement &mesh_refinement)
Refine the element.
const Elem *const * ConstNeighborPtrIter
virtual bool is_node_on_edge(const unsigned int n, const unsigned int e) const =0
uint32_t hashword(const uint32_t *k, size_t length, uint32_t initval=0)
The hashword function takes an array of uint32_t's of length 'length' and computes a single key from ...
void swap3nodes(unsigned int n1, unsigned int n2, unsigned int n3)
Swaps three node_ptrs, "rotating" them.
void family_tree_by_side(std::vector< const Elem *> &family, unsigned int side, bool reset=true) const
Same as the family_tree() member, but only adds elements which are next to side.
void replace_child(Elem *elem, unsigned int c)
Replaces the child pointer at the specified index in the child array.
void swap4nodes(unsigned int n1, unsigned int n2, unsigned int n3, unsigned int n4)
Swaps four node_ptrs, "rotating" them.
void total_family_tree_by_subneighbor(std::vector< const Elem *> &family, const Elem *neighbor, const Elem *subneighbor, bool reset=true) const
Same as the family_tree_by_subneighbor() member, but also adds any subactive descendants.
void remove_links_to_me()
Resets this element's neighbors' appropriate neighbor pointers and its parent's and children's approp...
virtual std::vector< std::vector< std::vector< signed char > > > & _get_parent_indices_cache() const
Elem subclasses which don't do their own child-to-parent node calculations will need to supply a stat...
Elem *const * NeighborPtrIter
Nested "classes" for use iterating over all neighbors of an element.
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
Implements (adaptive) mesh refinement algorithms for a MeshBase.
virtual Order supported_nodal_order() const
Real length(const unsigned int n1, const unsigned int n2) const
IntRange< unsigned short > face_index_range() const
ElemMappingType mapping_type() const
Elem & operator=(const Elem &)=delete
void make_links_to_me_local(unsigned int n, unsigned int neighbor_side)
Resets the neighbor_side pointers of our nth neighbor (and its descendants, if appropriate) to point ...
void swap2nodes(unsigned int n1, unsigned int n2)
Swaps two node_ptrs.
const Node & node_ref(const unsigned int i) const
virtual Real hmin() const
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
virtual unsigned int n_nodes() const =0
virtual unsigned int local_side_node(unsigned int side, unsigned int side_node) const =0
unsigned int which_node_am_i(unsigned int side, unsigned int side_node) const
This function is deprecated, call local_side_node(side, side_node) instead.
static const unsigned int type_to_n_edges_map[INVALID_ELEM]
This array maps the integer representation of the ElemType enum to the number of edges on the element...
bool contains_edge_of(const Elem *e) const
unsigned int which_neighbor_am_i(const Elem *e) const
This function tells you which neighbor e is.
virtual unsigned int as_parent_node(unsigned int c, unsigned int n) const
virtual std::vector< unsigned int > edges_adjacent_to_node(const unsigned int) const =0
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
virtual unsigned int opposite_node(const unsigned int n, const unsigned int s) const
virtual std::pair< unsigned short int, unsigned short int > second_order_child_vertex(const unsigned int n) const
static constexpr bool infinite()
Elem ** _elemlinks
Pointers to this element's parent and neighbors, and for lower-dimensional elements' interior_parent...
void find_point_neighbors(const Point &p, std::set< const Elem *> &neighbor_set) const
This function finds all active elements (including this one) which are in the same manifold as this e...
void set_mapping_data(const unsigned char data)
Sets the value of the mapping data for the element.
virtual unsigned int local_edge_node(unsigned int edge, unsigned int edge_node) const =0
Similar to Elem::local_side_node(), but instead of a side id, takes an edge id and a node id on that ...
The definition of the struct used for iterating over sides.
const Node *const * get_nodes() const
bool point_test(const Point &p, Real box_tol, Real map_tol) const
Shared private implementation used by the contains_point() and close_to_point() routines.
void _update_side_ptr() const
bool side_on_boundary() const
The BoundaryInfo class contains information relevant to boundary conditions including storing faces...
virtual Point side_vertex_average_normal(const unsigned int s) const
const Elem * reference_elem() const
void libmesh_assert_valid_neighbors() const
Checks for consistent neighbor links on this element.
virtual bool is_remote() const
This is the base class for point locators.
virtual unsigned int n_edges() const =0
ElemQuality
Defines an enum for element quality metrics.
virtual std::unique_ptr< Elem > disconnected_clone() const
virtual unsigned int n_second_order_adjacent_vertices(const unsigned int n) const
void hack_p_level_and_refinement_flag(const unsigned int p, RefinementState pflag)
Sets the value of the p-refinement level for the element without altering the p-level of its ancestor...
static constexpr Real affine_tol
Default tolerance to use in has_affine_map().
bool positive_edge_orientation(const unsigned int i) const
void set_neighbor(const unsigned int i, Elem *n)
Assigns n as the neighbor.
This class implements reference counting.
subdomain_id_type _sbd_id
The subdomain to which this element belongs.
static ElemType second_order_equivalent_type(const ElemType et, const bool full_ordered=true)
Elem(const unsigned int n_nodes, const unsigned int n_sides, Elem *parent, Elem **elemlinkdata, Node **nodelinkdata)
Constructor.
unsigned int which_child_am_i(const Elem *e) const
unsigned int max_descendant_p_level() const
unsigned char _rflag
h refinement flag.
virtual void flip(BoundaryInfo *boundary_info)=0
Flips the element (by swapping node and neighbor pointers) to have a mapping Jacobian of opposite sig...
void swap2neighbors(unsigned int n1, unsigned int n2)
Swaps two neighbor_ptrs.
void active_family_tree_by_neighbor(std::vector< const Elem *> &family, const Elem *neighbor, bool reset=true) const
Same as the active_family_tree() member, but only adds elements which are next to neighbor...
virtual std::vector< unsigned int > nodes_on_edge(const unsigned int) const =0
void total_family_tree_by_neighbor(std::vector< const Elem *> &family, const Elem *neighbor, bool reset=true) const
Same as the family_tree_by_neighbor() member, but also adds any subactive descendants.
SimpleRange< NodeRefIter > node_ref_range()
Returns a range with all nodes of an element, usable in range-based for loops.
Defines a Cartesian bounding box by the two corner extremum.
std::unique_ptr< Elem > _side
ElemMappingType
Enumeration of possible element master->physical mapping types.
ConstNodeRefIter(const Node *const *nodepp)
virtual unsigned int n_sides() const =0
bool topologically_equal(const Elem &rhs) const
const Elem * neighbor_ptr(unsigned int i) const
virtual bool close_to_point(const Point &p, Real tol) const
unsigned int level() const
const Elem * raw_child_ptr(unsigned int i) const
virtual unsigned int n_vertices() const =0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual std::unique_ptr< Elem > side_ptr(unsigned int i)=0
virtual unsigned int local_singular_node(const Point &, const Real=TOLERANCE *TOLERANCE) const
subdomain_id_type subdomain_id() const
virtual bool is_singular_node(unsigned int) const
virtual unsigned short dim() const =0
const Node * node_ptr(const unsigned int i) const
SideIter(const SideIter &other)
void coarsen()
Coarsen the element.
virtual bool is_vertex(const unsigned int i) const =0
virtual Point master_point(const unsigned int i) const =0
static std::unique_ptr< Elem > build_with_id(const ElemType type, dof_id_type id)
Calls the build() method above with a nullptr parent, and additionally sets the newly-created Elem's ...
unsigned int n_neighbors() const
virtual Real quality(const ElemQuality q) const
virtual unsigned short int second_order_adjacent_vertex(const unsigned int n, const unsigned int v) const
virtual Real volume() const
void swap4neighbors(unsigned int n1, unsigned int n2, unsigned int n3, unsigned int n4)
Swaps four neighbor_ptrs, "rotating" them.
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
uint32_t hashword2(const uint32_t &first, const uint32_t &second, uint32_t initval=0)
This is a hard-coded version of hashword for hashing exactly 2 numbers.
virtual void permute(unsigned int perm_num)=0
Permutes the element (by swapping node and neighbor pointers) according to the specified index...
The DofObject defines an abstract base class for objects that have degrees of freedom associated with...
void set_child(unsigned int c, Elem *elem)
Sets the pointer to the child for this element.
virtual void connectivity(const unsigned int sc, const IOPackage iop, std::vector< dof_id_type > &conn) const =0
bool has_ancestor_children() const
virtual bool has_invertible_map(Real tol=TOLERANCE *TOLERANCE) const
IntRange< unsigned short > node_index_range() const
bool positive_face_orientation(const unsigned int i) const
unsigned int local_node(const dof_id_type i) const
virtual bool is_vertex_on_child(unsigned int, unsigned int n) const
void nullify_neighbors()
Replaces this element with nullptr for all of its neighbors.
SimpleRange< NeighborPtrIter > neighbor_ptr_range()
Returns a range with all neighbors of an element, usable in range-based for loops.
void set_p_refinement_flag(const RefinementState pflag)
Sets the value of the p-refinement flag for the element.
virtual unsigned int n_faces() const =0
void inherit_data_from(const Elem &src)
A helper function for copying generic element data (mapping, subdomain, processor) from an element to...
virtual bool infinite() const =0
virtual std::pair< Real, Real > qual_bounds(const ElemQuality) const
void simple_side_ptr(std::unique_ptr< Elem > &side, const unsigned int i, ElemType sidetype)
An implementation for simple (all sides equal) elements.
static dof_id_type compute_key(dof_id_type n0)
virtual unsigned int n_sub_elem() const =0
void total_family_tree(std::vector< const Elem *> &family, bool reset=true) const
Same as the family_tree() member, but also adds any subactive descendants.
std::unique_ptr< const Elem > build_side_ptr(const unsigned int i, bool proxy) const
void family_tree_by_neighbor(std::vector< const Elem *> &family, const Elem *neighbor, bool reset=true) const
Same as the family_tree() member, but only adds elements which are next to neighbor.
virtual std::unique_ptr< Elem > build_edge_ptr(const unsigned int i)=0
static constexpr subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
ConstChildRefIter(const Elem *const *childpp)
virtual Order default_order() const =0
std::unique_ptr< Elem > simple_build_edge_ptr(const unsigned int i)
An implementation for simple (all edges equal) elements.
virtual const std::vector< std::pair< unsigned char, unsigned char > > & parent_bracketing_nodes(unsigned int c, unsigned int n) const
virtual std::vector< std::vector< std::vector< std::vector< std::pair< unsigned char, unsigned char > > > > > & _get_bracketing_node_cache() const
Elem subclasses which don't do their own bracketing node calculations will need to supply a static ca...
virtual unsigned int opposite_side(const unsigned int s) const
void hack_p_level(const unsigned int p)
Sets the value of the p-refinement level for the element without altering the p-level of its ancestor...
static ElemType first_order_equivalent_type(const ElemType et)
processor_id_type processor_id() const
virtual ElemType type() const =0
A Point defines a location in LIBMESH_DIM dimensional Real space.
dof_id_type node_id(const unsigned int i) const
const Point & point(const unsigned int i) const
virtual Point centroid() const
Calls Elem::vertex_average() for backwards compatibility.
bool operator==(const Elem &rhs) const
side_iterator(const IterType &d, const IterType &e, const PredType &p)
bool has_children() const
virtual unsigned int center_node_on_side(const unsigned short side) const
void ErrorVector unsigned int
NodeRefIter(Node *const *nodepp)
std::unique_ptr< Elem *[]> _children
unique_ptr to array of this element's children.
virtual bool is_child_on_edge(const unsigned int c, const unsigned int e) const
virtual bool is_edge(const unsigned int i) const =0
virtual unsigned int n_permutations() const =0
Returns the number of independent permutations of element nodes - e.g.
virtual std::vector< unsigned int > nodes_on_side(const unsigned int) const =0
virtual unsigned int n_nodes_in_child(unsigned int) const
Point vertex_average() const
static const unsigned int max_n_nodes
The maximum number of nodes any element can contain.
const Elem * child_ptr(unsigned int i) const
The definition of the protected nested SideIter class.
virtual bool is_mid_infinite_edge_node(const unsigned int) const
bool is_internal(const unsigned int i) const
SideIter _first_side()
Side iterator helper functions.