32 std::vector<const Node *> & nodes)
38 nodes.resize(valence + 6);
50 unsigned int j, i = 1;
92 std::vector<Elem *> new_elements;
94 const bool mesh_has_boundary_data =
97 std::vector<Elem *> new_boundary_elements;
98 std::vector<short int> new_boundary_sides;
99 std::vector<boundary_id_type> new_boundary_ids;
102 std::vector<boundary_id_type> ids;
106 libmesh_assert_equal_to(elem->type(),
TRI3);
110 tri->subdomain_id() = elem->subdomain_id();
111 tri->set_node(0) = elem->node_ptr(0);
112 tri->set_node(1) = elem->node_ptr(1);
113 tri->set_node(2) = elem->node_ptr(2);
115 if (mesh_has_boundary_data)
117 for (
auto side : elem->side_index_range())
121 for (std::size_t
id=0;
id<ids.size(); ++id)
124 new_boundary_ids.push_back(ids[
id]);
125 new_boundary_elements.push_back(tri);
126 new_boundary_sides.push_back(
side);
134 new_elements.push_back(tri);
139 if (mesh_has_boundary_data)
142 libmesh_assert_greater(new_boundary_elements.size(), 0);
146 libmesh_assert_equal_to(new_boundary_sides.size(), new_boundary_elements.size());
147 libmesh_assert_equal_to(new_boundary_sides.size(), new_boundary_ids.size());
150 for (std::size_t s = 0; s < new_boundary_elements.size(); ++s)
152 new_boundary_sides[s],
153 new_boundary_ids[s]);
180 std::unordered_map<dof_id_type, std::vector<const Elem *>> nodes_to_elem_map;
186 std::vector<const Node *> neighbors;
188 const unsigned int valence =
189 cast_int<unsigned int>(neighbors.size());
190 libmesh_assert_greater(valence, 1);
191 node->set_valence(valence);
197 libmesh_assert(tri3s);
211 for (
auto i : elem->side_index_range())
213 if (elem->neighbor_ptr(i) ==
nullptr)
217 if (elem->neighbor_ptr(
next[i]))
222 if (elem->neighbor_ptr(
prev[i]))
235 static const Real tol = 1e-5;
238 std::vector<Tri3Subdivision *> ghost_elems;
239 std::vector<Node *> ghost_nodes;
241 for (
unsigned int eid = 0; eid <
n_elem; ++eid)
254 libmesh_assert_not_equal_to(elem->
neighbor_ptr(i), elem);
261 for (
unsigned int l=0;l<4;l++)
272 Node * node =
nullptr;
273 for (std::size_t j = 0; j < ghost_nodes.size(); ++j)
275 if ((*ghost_nodes[j] - point).norm() < tol * (elem->
point(k) - point).norm())
277 node = ghost_nodes[j];
286 ghost_nodes.push_back(node);
293 ghost_elems.push_back(newelem);
333 libmesh_assert_not_equal_to(elem->
neighbor_ptr(i), elem);
344 Node * node =
nullptr;
345 for (std::size_t j = 0; j < ghost_nodes.size(); ++j)
347 if ((*ghost_nodes[j] - point).norm() < tol * (elem->
point(i) - point).norm())
349 node = ghost_nodes[j];
358 ghost_nodes.push_back(node);
362 ghost_elems.push_back(newelem);
381 std::vector<Tri3Subdivision *> missing_ghost_elems;
382 for (
auto & elem : ghost_elems)
384 libmesh_assert(elem->is_ghost());
386 for (
auto i : elem->side_index_range())
388 if (elem->neighbor_ptr(i) ==
nullptr &&
389 elem->neighbor_ptr(
prev[i]) !=
nullptr)
395 unsigned int n_nb = 0;
396 while (nb1 !=
nullptr && nb1->
id() != elem->id())
401 libmesh_assert(nb1 ==
nullptr || nb1->
id() != nb2->
id());
405 libmesh_assert_not_equal_to(nb2->
id(), elem->id());
425 Node * node =
nullptr;
426 for (std::size_t k = 0; k < ghost_nodes.size(); ++k)
428 if ((*ghost_nodes[k] - point).norm() < tol * (nb2->
point(j) - point).norm())
430 node = ghost_nodes[k];
439 ghost_nodes.push_back(node);
463 newelem->
set_node(1) = elem->node_ptr(i);
470 elem->set_neighbor(i, newelem);
473 missing_ghost_elems.push_back(newelem);
480 for (
auto & elem : missing_ghost_elems)
virtual Node *& set_node(const unsigned int i)
A geometric point in (x,y,z) space associated with a DOF.
IntRange< unsigned short > side_index_range() const
void remove(const Node *node)
The base class for all geometric element types.
const BoundaryInfo & get_boundary_info() const
void prepare_subdivision_properties()
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
std::size_t n_boundary_ids() const
Node * get_ordered_node(unsigned int node_id) const
std::vector< boundary_id_type > boundary_ids(const Node *node) const
void add_node(const Node *node, const boundary_id_type id)
virtual SimpleRange< element_iterator > element_ptr_range()=0
bool is_subdivision_updated() const
virtual Elem * add_elem(Elem *e)=0
virtual SimpleRange< node_iterator > node_ptr_range()=0
A surface shell element used in mechanics calculations.
void prepare_for_use(const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false)
unsigned int local_node_number(unsigned int node_id) const
void set_neighbor(const unsigned int i, Elem *n)
unsigned int get_ordered_valence(unsigned int node_id) const
virtual const Elem * elem_ptr(const dof_id_type i) const =0
virtual Elem * insert_elem(Elem *e)=0
const Elem * neighbor_ptr(unsigned int i) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void set_ghost(bool ghosted)
const Node * node_ptr(const unsigned int i) const
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
virtual dof_id_type n_elem() const =0
virtual ElemType type() const =0
A geometric point in (x,y,z) space.
const Point & point(const unsigned int i) const