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
38static const unsigned int header_size = 3;
40static const unsigned int header_size = 2;
44static 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));
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
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;
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));
std::size_t n_boundary_ids() 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.
void add_node(const Node *node, const boundary_id_type id)
Add Node node with boundary id id to the boundary information data structures.
The DistributedMesh class is derived from the MeshBase class, and is intended to provide identical fu...
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 ...
processor_id_type processor_id() const
unique_id_type unique_id() const
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...
static constexpr unique_id_type invalid_unique_id
An invalid unique_id to distinguish an uninitialized DofObject.
bool valid_unique_id() const
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
unsigned int packed_indexing_size() const
If we pack our indices into an buffer for communications, how many ints do we need?
void unpack_indexing(std::vector< largest_id_type >::const_iterator begin)
A method for creating our index buffer from packed data - basically with our current implementation w...
bool has_dofs(const unsigned int s=libMesh::invalid_uint) const
This is the MeshBase class.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
virtual const Node * query_node_ptr(const dof_id_type i) const =0
virtual Node * add_node(Node *n)=0
Add Node n to the end of the vertex array.
A Node is like a Point, but with more information.
processor_id_type processor_id() const
std::pair< T1, T2 > unpack(BufferIter in, Context *ctx)
static unsigned int packed_size(BufferIter iter)
unsigned int packable_size(const std::pair< T1, T2 > &pr, const Context *ctx)
void pack(const std::pair< T1, T2 > &pr, OutputIter data_out, const Context *ctx)
uint8_t processor_id_type
The libMesh namespace provides an interface to certain functionality in the library.
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real