23 #include "libmesh/elem.h" 24 #include "libmesh/mesh_refinement.h" 25 #include "libmesh/remote_elem.h" 39 #ifdef LIBMESH_ENABLE_AMR 44 if (this->
parent() !=
nullptr)
49 if (parent_p_level > p)
61 _p_level = cast_int<unsigned char>(p);
62 parent_p_level = cast_int<unsigned char>(p);
64 parent_p_level = std::min(parent_p_level,
97 _children = std::make_unique<Elem *[]>(nc);
99 unsigned int parent_p_level = this->
p_level();
101 for (
unsigned int c = 0; c != nc; c++)
107 current_child->set_p_level(parent_p_level);
110 for (
auto cnode : current_child->node_index_range())
113 mesh_refinement.
add_node(*
this, c, cnode,
114 current_child->processor_id());
116 current_child->set_node(cnode, node);
119 Elem * added_child = mesh_refinement.
add_elem (std::move(current_child));
123 for (
unsigned int i=0; i != nei; ++i)
129 unsigned int parent_p_level = this->
p_level();
130 for (
unsigned int c = 0; c != nc; c++)
151 for (
unsigned int c = 0; c != nc; c++)
170 unsigned int parent_p_level = 0;
172 const unsigned int n_n = this->
n_nodes();
175 for (
unsigned int c = 0, nc = this->
n_children(); c != nc; ++c)
183 bool calculated_new_pos =
false;
185 for (
unsigned int n=0; n<n_n; n++)
191 if ((em_val != 0.) && (em_val != 1.))
194 calculated_new_pos =
true;
198 if (calculated_new_pos)
201 for (
unsigned int i=0; i<LIBMESH_DIM; i++)
204 child_node(i)=new_pos(i);
214 libmesh_assert_equal_to (mychild.refinement_flag(),
Elem::COARSEN);
216 if (mychild.p_level() > parent_p_level)
217 parent_p_level = mychild.p_level();
240 #endif // #ifdef LIBMESH_ENABLE_AMR void set_p_level(const unsigned int p)
Sets the value of the p-refinement level for the element.
RefinementState refinement_flag() const
const Elem * parent() const
void add_scaled(const TypeVector< T2 > &, const T &)
Add a scaled value to this vector without creating a temporary.
A Node is like a Point, but with more information.
unsigned char _p_level
p refinement level - the difference between the polynomial degree on this element and the minimum pol...
void contract()
Contract an active element, i.e.
RefinementState p_refinement_flag() const
This is the base class from which all geometric element types are derived.
void set_refinement_flag(const RefinementState rflag)
Sets the value of the refinement flag for the element.
virtual unsigned int n_children() const =0
unsigned int p_level() const
The libMesh namespace provides an interface to certain functionality in the library.
SimpleRange< ChildRefIter > child_ref_range()
Returns a range with all children of a parent element, usable in range-based for loops.
virtual Real embedding_matrix(const unsigned int child_num, const unsigned int child_node_num, const unsigned int parent_node_num) const =0
virtual void refine(MeshRefinement &mesh_refinement)
Refine the element.
Implements (adaptive) mesh refinement algorithms for a MeshBase.
virtual unsigned int n_nodes() const =0
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
unsigned int n_systems() const
void set_n_systems(const unsigned int s)
Sets the number of systems for this DofObject.
Node * add_node(Elem &parent, unsigned int child, unsigned int node, processor_id_type proc_id)
Add a node to the mesh.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Elem * add_elem(Elem *elem)
Adds the element elem to the mesh.
void coarsen()
Coarsen the element.
IntRange< unsigned short > node_index_range() const
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
void set_p_refinement_flag(const RefinementState pflag)
Sets the value of the p-refinement flag for the element.
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...
virtual ElemType type() const =0
A Point defines a location in LIBMESH_DIM dimensional Real space.
const Point & point(const unsigned int i) const
std::unique_ptr< Elem *[]> _children
unique_ptr to array of this element's children.
void set_extra_integer(const unsigned int index, const dof_id_type value)
Sets the value on this object of the extra integer associated with index, which should have been obta...
const Elem * child_ptr(unsigned int i) const
const RemoteElem * remote_elem