21 #include "libmesh/boundary_info.h"
22 #include "libmesh/distributed_mesh.h"
23 #include "libmesh/mesh_base.h"
24 #include "libmesh/node.h"
25 #include "libmesh/parallel_mesh.h"
26 #include "libmesh/parallel_node.h"
37 #ifdef LIBMESH_ENABLE_UNIQUE_ID
38 static const unsigned int header_size = 3;
40 static const unsigned int header_size = 2;
44 static const unsigned int idtypes_per_Real =
69 header_size + LIBMESH_DIM*idtypes_per_Real +
80 const unsigned int pre_indexing_size =
84 header_size + LIBMESH_DIM*idtypes_per_Real;
86 const unsigned int indexing_size =
89 const int n_bcs = cast_int<int>
90 (*(in + pre_indexing_size + indexing_size));
91 libmesh_assert_greater_equal (n_bcs, 0);
93 return pre_indexing_size + indexing_size + 1 + n_bcs;
102 return packed_size(std::vector<largest_id_type>::const_iterator(in));
112 return packable_size(node, static_cast<const MeshBase *>(
mesh));
122 return packable_size(node, static_cast<const MeshBase *>(
mesh));
130 std::back_insert_iterator<std::vector<largest_id_type>> data_out,
136 *data_out++ = (node_magic_header);
139 *data_out++ = (static_cast<largest_id_type>(node->
processor_id()));
140 *data_out++ = (static_cast<largest_id_type>(node->
id()));
142 #ifdef LIBMESH_ENABLE_UNIQUE_ID
144 *data_out++ = (static_cast<largest_id_type>(node->
unique_id()));
150 for (
unsigned int i=0; i != LIBMESH_DIM; ++i)
152 const Real node_i = (*node)(i);
154 std::memcpy(Real_as_idtypes, &node_i,
sizeof(
Real));
155 for (
unsigned int j=0; j != idtypes_per_Real; ++j)
156 *data_out++ =(Real_as_idtypes[j]);
163 std::vector<boundary_id_type> bcs;
166 libmesh_assert(bcs.size() < std::numeric_limits<largest_id_type>::max());
168 *data_out++ =(bcs.size());
170 for (
const auto & bid : bcs)
179 std::back_insert_iterator<std::vector<largest_id_type>> data_out,
182 pack(node, data_out, static_cast<const MeshBase*>(
mesh));
190 std::back_insert_iterator<std::vector<largest_id_type>> data_out,
193 pack(node, data_out, static_cast<const MeshBase*>(
mesh));
204 const std::vector<largest_id_type>::const_iterator original_in = in;
206 libmesh_assert_equal_to (incoming_header, node_magic_header);
211 processor_id < mesh->n_processors());
213 const dof_id_type id = cast_int<dof_id_type>(*in++);
215 #ifdef LIBMESH_ENABLE_UNIQUE_ID
223 libmesh_assert_equal_to (node->
processor_id(), processor_id);
233 for (
unsigned int i=0; i != LIBMESH_DIM; ++i)
235 Real idtypes_as_Real;
236 std::memcpy(&idtypes_as_Real, &(*in),
sizeof(
Real));
237 in += idtypes_per_Real;
238 libmesh_assert_less_equal ((*node)(i), idtypes_as_Real + (std::max(
Real(1),idtypes_as_Real)*
TOLERANCE*
TOLERANCE));
239 libmesh_assert_greater_equal ((*node)(i), idtypes_as_Real - (std::max(
Real(1),idtypes_as_Real)*
TOLERANCE*
TOLERANCE));
242 (*node)(i) = idtypes_as_Real;
264 for (
unsigned int i=0; i != LIBMESH_DIM; ++i)
266 Real idtypes_as_Real;
267 std::memcpy(&idtypes_as_Real, &(*in),
sizeof(
Real));
268 (*node)(i) = idtypes_as_Real;
269 in += idtypes_per_Real;
273 #ifdef LIBMESH_ENABLE_UNIQUE_ID
293 (node, cast_int<boundary_id_type>(*in++));
311 return unpack(in, static_cast<MeshBase*>(
mesh));
321 return unpack(in, static_cast<MeshBase*>(
mesh));