libMesh
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
libMesh::Parallel::Packing< Node * > Class Reference

#include <parallel_node.h>

Public Types

typedef largest_id_type buffer_type
 

Public Member Functions

template<>
Nodeunpack (std::vector< largest_id_type >::const_iterator in, MeshBase *mesh)
 
template<>
Nodeunpack (std::vector< largest_id_type >::const_iterator in, DistributedMesh *mesh)
 
template<>
Nodeunpack (std::vector< largest_id_type >::const_iterator in, ParallelMesh *mesh)
 

Static Public Member Functions

template<typename OutputIter , typename Context >
static void pack (Node *const &object, OutputIter data_out, const Context *context)
 
template<typename Context >
static unsigned int packable_size (Node *const &object, const Context *context)
 
template<typename BufferIter >
static unsigned int packed_size (BufferIter iter)
 
template<typename BufferIter , typename Context >
static Nodeunpack (BufferIter in, Context *ctx)
 

Detailed Description

Definition at line 63 of file parallel_node.h.

Member Typedef Documentation

◆ buffer_type

typedef largest_id_type libMesh::Parallel::Packing< Node * >::buffer_type

Definition at line 66 of file parallel_node.h.

Member Function Documentation

◆ pack()

template<typename OutputIter , typename Context >
static void libMesh::Parallel::Packing< Node * >::pack ( Node *const &  object,
OutputIter  data_out,
const Context *  context 
)
inlinestatic

Definition at line 69 of file parallel_node.h.

72 { return Packing<const Node *>::pack(object, data_out, context); }
void pack(const std::pair< T1, T2 > &pr, OutputIter data_out, const Context *ctx)

References libMesh::Parallel::Packing< typename T, typename Enable >::pack().

◆ packable_size()

template<typename Context >
static unsigned int libMesh::Parallel::Packing< Node * >::packable_size ( Node *const &  object,
const Context *  context 
)
inlinestatic

Definition at line 75 of file parallel_node.h.

77 { return Packing<const Node*>::packable_size(object, context); }
unsigned int packable_size(const std::pair< T1, T2 > &pr, const Context *ctx)

References libMesh::Parallel::Packing< typename T, typename Enable >::packable_size().

◆ packed_size()

template<typename BufferIter >
static unsigned int libMesh::Parallel::Packing< Node * >::packed_size ( BufferIter  iter)
inlinestatic

Definition at line 80 of file parallel_node.h.

static unsigned int packed_size(BufferIter iter)

References libMesh::Parallel::Packing< typename T, typename Enable >::packed_size().

◆ unpack() [1/4]

template<typename BufferIter , typename Context >
static Node * libMesh::Parallel::Packing< Node * >::unpack ( BufferIter  in,
Context *  ctx 
)
static

◆ unpack() [2/4]

template<>
Node * libMesh::Parallel::Packing< Node * >::unpack ( std::vector< largest_id_type >::const_iterator  in,
DistributedMesh mesh 
)

Definition at line 320 of file parallel_node.C.

322{
323 return unpack(in, static_cast<MeshBase*>(mesh));
324}
This is the MeshBase class.
Definition mesh_base.h:81
static Node * unpack(BufferIter in, Context *ctx)
MeshBase & mesh

References mesh.

◆ unpack() [3/4]

template<>
Node * libMesh::Parallel::Packing< Node * >::unpack ( std::vector< largest_id_type >::const_iterator  in,
MeshBase mesh 
)

Definition at line 182 of file parallel_node.C.

184{
185#ifndef NDEBUG
186 const std::vector<largest_id_type>::const_iterator original_in = in;
187 const largest_id_type incoming_header = *in++;
188 libmesh_assert_equal_to (incoming_header, node_magic_header);
189#endif
190
191 const processor_id_type processor_id = cast_int<processor_id_type>(*in++);
193 processor_id < mesh->n_processors());
194
195 const dof_id_type id = cast_int<dof_id_type>(*in++);
196
197#ifdef LIBMESH_ENABLE_UNIQUE_ID
198 const unique_id_type unique_id = cast_int<unique_id_type>(*in++);
199#endif
200
201 Node * node = mesh->query_node_ptr(id);
202
203 if (node)
204 {
205 libmesh_assert_equal_to (node->processor_id(), processor_id);
206
207 // We currently don't communicate mesh motion via packed Nodes,
208 // so it should usually be safe to assume (and assert) that Node
209 // locations are consistent between processors.
210 //
211 // There may be exceptions due to rounding in file I/O, so we'll
212 // only assert equality to within a tight tolerance, and we'll
213 // believe the sender's node locations over our own if we don't
214 // own the node.
215 for (unsigned int i=0; i != LIBMESH_DIM; ++i)
216 {
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));
222
223 if (processor_id != mesh->processor_id())
224 (*node)(i) = idtypes_as_Real;
225 }
226
227 if (!node->has_dofs())
228 {
229 node->unpack_indexing(in);
230 libmesh_assert_equal_to (DofObject::unpackable_indexing_size(in),
231 node->packed_indexing_size());
232 in += node->packed_indexing_size();
233 }
234 else
235 {
236 // FIXME: We should add some debug mode tests to ensure that
237 // the encoded indexing is consistent
239 }
240 }
241 else
242 {
243 // If we don't already have it, we need to allocate it.
244 // There is no Node::build() API that lets you defer setting
245 // the (x,y,z) values, so we just use the Node constructor.
246 auto unode = std::make_unique<Node>();
247
248 for (unsigned int i=0; i != LIBMESH_DIM; ++i)
249 {
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;
254 }
255
256 unode->set_id() = id;
257#ifdef LIBMESH_ENABLE_UNIQUE_ID
258 unode->set_unique_id(unique_id);
259#endif
260 unode->processor_id() = processor_id;
261
262 unode->unpack_indexing(in);
263 libmesh_assert_equal_to (DofObject::unpackable_indexing_size(in),
264 unode->packed_indexing_size());
265 in += unode->packed_indexing_size();
266
267 node = mesh->add_node(std::move(unode));
268 }
269
270 // FIXME: We should add some debug mode tests to ensure that the
271 // encoded boundary conditions are consistent
272
273 // Add any nodal boundary condition ids
274 const largest_id_type num_bcs = *in++;
275 // libmesh_assert_greater_equal (num_bcs, 0);
276
277 for (largest_id_type bc_it=0; bc_it < num_bcs; bc_it++)
279 (node, cast_int<boundary_id_type>(*in++));
280
281#ifndef NDEBUG
282 libmesh_assert (in - original_in ==
283 cast_int<int>
285#endif
286
287 return node;
288}
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 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 ...
Definition dof_object.C:567
processor_id_type processor_id() const
Definition dof_object.h:881
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition dof_object.h:484
unsigned int packed_indexing_size() const
If we pack our indices into an buffer for communications, how many ints do we need?
Definition dof_object.C:552
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...
Definition dof_object.C:587
bool has_dofs(const unsigned int s=libMesh::invalid_uint) const
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition mesh_base.h:170
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.
Definition node.h:55
processor_id_type processor_id() const
uint8_t unique_id_type
Definition id_types.h:86
libmesh_assert(ctx)
uint64_t largest_id_type
Definition id_types.h:148
static constexpr Real TOLERANCE
uint8_t dof_id_type
Definition id_types.h:67
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
uint8_t processor_id_type
Definition id_types.h:104

References libMesh::BoundaryInfo::add_node(), libMesh::MeshBase::add_node(), libMesh::MeshBase::get_boundary_info(), libMesh::DofObject::has_dofs(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), mesh, libMesh::DofObject::packed_indexing_size(), libMesh::DofObject::processor_id(), libMesh::ParallelObject::processor_id(), libMesh::MeshBase::query_node_ptr(), libMesh::Real, libMesh::TOLERANCE, libMesh::DofObject::unpack_indexing(), and libMesh::DofObject::unpackable_indexing_size().

◆ unpack() [4/4]

template<>
Node * libMesh::Parallel::Packing< Node * >::unpack ( std::vector< largest_id_type >::const_iterator  in,
ParallelMesh mesh 
)

Definition at line 330 of file parallel_node.C.

332{
333 return unpack(in, static_cast<MeshBase*>(mesh));
334}

References mesh.


The documentation for this class was generated from the following files: