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));
127 #ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION 128 #include "libmesh/ignore_warnings.h" 134 std::back_insert_iterator<std::vector<largest_id_type>> data_out,
140 *data_out++ = (node_magic_header);
146 #ifdef LIBMESH_ENABLE_UNIQUE_ID 148 *data_out++ = (static_cast<largest_id_type>(node->
unique_id()));
154 for (
unsigned int i=0; i != LIBMESH_DIM; ++i)
156 const Real node_i = (*node)(i);
158 std::memcpy(Real_as_idtypes, &node_i,
sizeof(
Real));
159 for (
unsigned int j=0; j != idtypes_per_Real; ++j)
160 *data_out++ =(Real_as_idtypes[j]);
167 std::vector<boundary_id_type> bcs;
170 libmesh_assert(bcs.size() < std::numeric_limits<largest_id_type>::max());
172 *data_out++ =(bcs.size());
174 for (
const auto & bid : bcs)
186 const std::vector<largest_id_type>::const_iterator original_in = in;
188 libmesh_assert_equal_to (incoming_header, node_magic_header);
193 processor_id < mesh->n_processors());
195 const dof_id_type id = cast_int<dof_id_type>(*in++);
197 #ifdef LIBMESH_ENABLE_UNIQUE_ID 205 libmesh_assert_equal_to (node->processor_id(), processor_id);
215 for (
unsigned int i=0; i != LIBMESH_DIM; ++i)
217 Real idtypes_as_Real;
218 std::memcpy(&idtypes_as_Real, &(*in),
sizeof(
Real));
219 in += idtypes_per_Real;
220 libmesh_assert_less_equal ((*node)(i), idtypes_as_Real + (std::max(
Real(1),idtypes_as_Real)*
TOLERANCE*
TOLERANCE));
221 libmesh_assert_greater_equal ((*node)(i), idtypes_as_Real - (std::max(
Real(1),idtypes_as_Real)*
TOLERANCE*
TOLERANCE));
224 (*node)(i) = idtypes_as_Real;
227 if (!node->has_dofs())
229 node->unpack_indexing(in);
231 node->packed_indexing_size());
232 in += node->packed_indexing_size();
246 auto unode = std::make_unique<Node>();
248 for (
unsigned int i=0; i != LIBMESH_DIM; ++i)
250 Real idtypes_as_Real;
251 std::memcpy(&idtypes_as_Real, &(*in),
sizeof(
Real));
252 (*unode)(i) = idtypes_as_Real;
253 in += idtypes_per_Real;
256 unode->set_id() = id;
257 #ifdef LIBMESH_ENABLE_UNIQUE_ID 258 unode->set_unique_id(unique_id);
260 unode->processor_id() = processor_id;
262 unode->unpack_indexing(in);
264 unode->packed_indexing_size());
265 in += unode->packed_indexing_size();
279 (node, cast_int<boundary_id_type>(*in++));
291 #ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION 292 #include "libmesh/restore_warnings.h" 299 std::back_insert_iterator<std::vector<largest_id_type>> data_out,
302 pack(node, data_out, static_cast<const MeshBase*>(
mesh));
310 std::back_insert_iterator<std::vector<largest_id_type>> data_out,
313 pack(node, data_out, static_cast<const MeshBase*>(
mesh));
323 return unpack(in, static_cast<MeshBase*>(
mesh));
333 return unpack(in, static_cast<MeshBase*>(
mesh));
A Node is like a Point, but with more information.
static unsigned int unpackable_indexing_size(std::vector< largest_id_type >::const_iterator begin)
If we have indices packed into an buffer for communications, how much of that buffer applies to this ...
static constexpr Real TOLERANCE
unique_id_type unique_id() const
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
The libMesh namespace provides an interface to certain functionality in the library.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
static T unpack(BufferIter in, Context *ctx)
static unsigned int packable_size(const T &object, const Context *context)
This is the MeshBase class.
std::size_t n_boundary_ids() const
uint8_t processor_id_type
void add_node(const Node *node, const boundary_id_type id)
Add Node node with boundary id id to the boundary information data structures.
static const unique_id_type invalid_unique_id
An invalid unique_id to distinguish an uninitialized DofObject.
static const processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
static unsigned int packed_size(BufferIter iter)
virtual const Node * query_node_ptr(const dof_id_type i) const =0
bool valid_unique_id() const
The DistributedMesh class is derived from the MeshBase class, and is intended to provide identical fu...
static void pack(const T &object, OutputIter data_out, const Context *context)
virtual Node * add_node(Node *n)=0
Add Node n to the end of the vertex array.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int packed_indexing_size() const
If we pack our indices into an buffer for communications, how many ints do we need?
void pack_indexing(std::back_insert_iterator< std::vector< largest_id_type >> target) const
A method for creating packed data from our index buffer - basically a copy with prepended size with o...
processor_id_type processor_id() const
processor_id_type processor_id() const