37 #ifdef LIBMESH_ENABLE_UNIQUE_ID 38 static const unsigned int header_size = 12;
40 static const unsigned int header_size = 11;
63 libmesh_assert_equal_to (packed_header, elem_magic_header);
67 const unsigned int level =
68 cast_int<unsigned int>(*in);
71 const int typeint = cast_int<int>(*(in+4));
72 libmesh_assert_greater_equal (typeint, 0);
75 cast_int<ElemType>(typeint);
80 const unsigned int n_sides =
83 const unsigned int n_edges =
86 const unsigned int pre_indexing_size =
87 header_size +
n_nodes + n_sides;
89 const unsigned int indexing_size =
92 unsigned int total_packed_bc_data = 0;
95 for (
unsigned int s = 0; s != n_sides; ++s)
97 const int n_bcs = cast_int<int>
98 (*(in + pre_indexing_size + indexing_size +
99 total_packed_bc_data++));
100 libmesh_assert_greater_equal (n_bcs, 0);
101 total_packed_bc_data += n_bcs;
104 for (
unsigned int e = 0; e != n_edges; ++e)
106 const int n_bcs = cast_int<int>
107 (*(in + pre_indexing_size + indexing_size +
108 total_packed_bc_data++));
109 libmesh_assert_greater_equal (n_bcs, 0);
110 total_packed_bc_data += n_bcs;
113 for (
unsigned short sf=0; sf != 2; ++sf)
115 const int n_bcs = cast_int<int>
116 (*(in + pre_indexing_size + indexing_size +
117 total_packed_bc_data++));
118 libmesh_assert_greater_equal (n_bcs, 0);
119 total_packed_bc_data += n_bcs;
127 pre_indexing_size + indexing_size + total_packed_bc_data;
137 return packed_size(std::vector<largest_id_type>::const_iterator(in));
148 unsigned int total_packed_bcs = 0;
149 const unsigned short n_sides = elem->
n_sides();
151 if (elem->
level() == 0)
153 total_packed_bcs += n_sides;
154 for (
unsigned short s = 0; s != n_sides; ++s)
158 const unsigned short n_edges = elem->
n_edges();
159 total_packed_bcs += n_edges;
160 for (
unsigned short e = 0; e != n_edges; ++e)
164 total_packed_bcs += 2;
165 for (
unsigned short sf=0; sf != 2; ++sf)
174 header_size + elem->
n_nodes() + n_sides +
206 std::back_insert_iterator<std::vector<largest_id_type>> data_out,
209 libmesh_assert(elem);
212 *data_out++ = elem_magic_header;
215 #ifdef LIBMESH_ENABLE_AMR 228 *data_out++ = (refinement_info);
240 *data_out++ = (elem->
id());
242 #ifdef LIBMESH_ENABLE_UNIQUE_ID 244 *data_out++ = (static_cast<largest_id_type>(elem->
unique_id()));
250 #ifdef LIBMESH_ENABLE_AMR 252 if (elem->
level() == 0)
259 *data_out++ =(elem->
parent()->
id());
267 if ((elem->
dim() < LIBMESH_DIM) &&
273 for (
unsigned int n=0; n<elem->
n_nodes(); n++)
274 *data_out++ = (elem->
node_id(n));
279 *data_out++ = (neigh->id());
289 if (elem->
level() == 0)
291 std::vector<boundary_id_type> bcs;
296 *data_out++ =(bcs.size());
298 for (
const auto & bid : bcs)
306 *data_out++ =(bcs.size());
308 for (
const auto & bid : bcs)
312 for (
unsigned short sf=0; sf != 2; ++sf)
316 *data_out++ =(bcs.size());
318 for (
const auto & bid : bcs)
330 std::back_insert_iterator<std::vector<largest_id_type>> data_out,
333 pack(elem, data_out, static_cast<const MeshBase*>(
mesh));
342 std::back_insert_iterator<std::vector<largest_id_type>> data_out,
345 pack(elem, data_out, static_cast<const MeshBase*>(
mesh));
358 const std::vector<largest_id_type>::const_iterator original_in = in;
361 libmesh_assert_equal_to (incoming_header, elem_magic_header);
365 const unsigned int level =
366 cast_int<unsigned int>(*in++);
368 #ifdef LIBMESH_ENABLE_AMR 370 const unsigned int p_level =
371 cast_int<unsigned int>(*in++);
374 const int rflag = cast_int<int>(*in++);
375 const int invalid_rflag =
377 libmesh_assert_greater_equal (rflag, 0);
379 libmesh_assert_less (rflag, invalid_rflag*2+1);
381 const bool has_children = (rflag > invalid_rflag);
384 cast_int<Elem::RefinementState>(rflag - invalid_rflag - 1) :
385 cast_int<Elem::RefinementState>(rflag);
388 const int pflag = cast_int<int>(*in++);
389 libmesh_assert_greater_equal (pflag, 0);
392 cast_int<Elem::RefinementState>(pflag);
395 #endif // LIBMESH_ENABLE_AMR 398 const int typeint = cast_int<int>(*in++);
399 libmesh_assert_greater_equal (typeint, 0);
402 cast_int<ElemType>(typeint);
409 cast_int<processor_id_type>(*in++);
410 libmesh_assert (processor_id < mesh->n_processors() ||
415 cast_int<subdomain_id_type>(*in++);
419 cast_int<dof_id_type>(*in++);
422 #ifdef LIBMESH_ENABLE_UNIQUE_ID 425 cast_int<unique_id_type>(*in++);
428 #ifdef LIBMESH_ENABLE_AMR 436 ? static_cast<dof_id_type>(*in++)
437 : cast_int<dof_id_type>(*in++);
444 const unsigned int which_child_am_i =
446 ? static_cast<unsigned int>(*in++)
447 : cast_int<unsigned int>(*in++);
450 #endif // LIBMESH_ENABLE_AMR 457 libmesh_assert_equal_to (in - original_in, header_size + 1);
466 libmesh_assert_equal_to (elem->
level(), level);
467 libmesh_assert_equal_to (elem->
id(), id);
471 libmesh_assert_equal_to (elem->
processor_id(), processor_id);
472 libmesh_assert_equal_to (elem->
subdomain_id(), subdomain_id);
473 libmesh_assert_equal_to (elem->
type(), type);
478 for (
unsigned int i=0; i !=
n_nodes; ++i)
479 libmesh_assert(elem->
node_id(i) ==
480 cast_int<dof_id_type>(*in++));
485 #ifdef LIBMESH_ENABLE_AMR 487 libmesh_assert_equal_to (elem->
has_children(), has_children);
492 libmesh_assert_equal_to (elem->
p_level(), p_level);
497 libmesh_assert (!level || elem->
parent() !=
nullptr);
498 libmesh_assert (!level || elem->
parent()->
id() == parent_id);
499 libmesh_assert (!level || elem->
parent()->
child_ptr(which_child_am_i) == elem);
509 if (elem->
dim() < LIBMESH_DIM)
559 cast_int<dof_id_type>(*in++);
616 #ifdef LIBMESH_ENABLE_AMR 622 #endif // LIBMESH_ENABLE_AMR 632 Elem * parent =
nullptr;
633 #ifdef LIBMESH_ENABLE_AMR 648 libmesh_assert_equal_to (level, 0);
652 libmesh_assert (elem);
654 #ifdef LIBMESH_ENABLE_AMR 661 parent->
add_child(elem, which_child_am_i);
668 libmesh_assert_equal_to (elem->
level(), level);
676 for (
unsigned int c=0; c != nc; ++c)
680 #endif // LIBMESH_ENABLE_AMR 686 #ifdef LIBMESH_ENABLE_UNIQUE_ID 693 for (
unsigned int n=0; n !=
n_nodes; n++)
696 (cast_int<dof_id_type>(*in++));
726 cast_int<dof_id_type>(*in++);
771 cast_int<boundary_id_type>(*in++);
775 (elem, s, cast_int<boundary_id_type>(*in++));
781 cast_int<boundary_id_type>(*in++);
785 (elem, e, cast_int<boundary_id_type>(*in++));
788 for (
unsigned short sf=0; sf != 2; ++sf)
791 cast_int<boundary_id_type>(*in++);
795 (elem, sf, cast_int<boundary_id_type>(*in++));
811 return unpack(in, static_cast<MeshBase*>(
mesh));
822 return unpack(in, static_cast<MeshBase*>(
mesh));
void set_p_level(const unsigned int p)
RefinementState refinement_flag() const
unique_id_type & set_unique_id()
const Elem * parent() const
virtual Node *& set_node(const unsigned int i)
static unsigned int unpackable_indexing_size(std::vector< largest_id_type >::const_iterator begin)
static const unsigned int type_to_n_sides_map[INVALID_ELEM]
const Elem * interior_parent() const
IntRange< unsigned short > side_index_range() const
unsigned int n_shellface_boundary_ids(const Elem *const elem, const unsigned short int shellface) const
RefinementState p_refinement_flag() const
The base class for all geometric element types.
uint8_t processor_id_type
void add_child(Elem *elem)
void set_refinement_flag(const RefinementState rflag)
unique_id_type unique_id() const
virtual unsigned int n_children() const =0
unsigned int p_level() const
void shellface_boundary_ids(const Elem *const elem, const unsigned short int shellface, std::vector< boundary_id_type > &vec_to_fill) const
const BoundaryInfo & get_boundary_info() const
void set_interior_parent(Elem *p)
static const unsigned int type_to_n_nodes_map[INVALID_ELEM]
std::size_t n_boundary_ids() const
IntRange< unsigned short > edge_index_range() const
std::vector< boundary_id_type > boundary_ids(const Node *node) const
const dof_id_type n_nodes
virtual unsigned int n_nodes() const =0
static const unique_id_type invalid_unique_id
static const processor_id_type invalid_processor_id
static const unsigned int type_to_n_edges_map[INVALID_ELEM]
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
static const dof_id_type invalid_id
bool valid_unique_id() const
virtual unsigned int n_edges() const =0
void set_neighbor(const unsigned int i, Elem *n)
Mesh data structure which is distributed across all processors.
unsigned int which_child_am_i(const Elem *e) const
virtual const Elem * elem_ptr(const dof_id_type i) const =0
virtual unsigned int n_sides() const =0
const Elem * neighbor_ptr(unsigned int i) const
unsigned int level() const
unsigned int n_edge_boundary_ids(const Elem *const elem, const unsigned short int edge) const
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
subdomain_id_type subdomain_id() const
unsigned int packed_indexing_size() const
virtual unsigned short dim() const =0
void pack_indexing(std::back_insert_iterator< std::vector< largest_id_type >> target) const
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
void add_shellface(const dof_id_type elem, const unsigned short int shellface, const boundary_id_type id)
void unpack_indexing(std::vector< largest_id_type >::const_iterator begin)
static unsigned int packable_size(const T &object, const Context *context)
static unsigned int packed_size(BufferIter iter)
SimpleRange< NeighborPtrIter > neighbor_ptr_range()
void set_p_refinement_flag(const RefinementState pflag)
virtual const Node * node_ptr(const dof_id_type i) const =0
void make_links_to_me_local(unsigned int n)
static void pack(const T &object, OutputIter data_out, const Context *context)
processor_id_type processor_id() const
void hack_p_level(const unsigned int p)
processor_id_type processor_id() const
static T unpack(BufferIter in, Context *ctx)
virtual ElemType type() const =0
dof_id_type node_id(const unsigned int i) const
bool has_children() const
const Elem * child_ptr(unsigned int i) const
void add_edge(const dof_id_type elem, const unsigned short int edge, const boundary_id_type id)
std::vector< boundary_id_type > edge_boundary_ids(const Elem *const elem, const unsigned short int edge) const
const RemoteElem * remote_elem