libMesh
Public Types | Public Member Functions | Static Public Member Functions | List of all members
libMesh::Parallel::Packing< const Node * > Class Template Reference

#include <parallel_node.h>

Public Types

typedef largest_id_type buffer_type
 

Public Member Functions

template<>
unsigned int packable_size (const Node *const &node, const MeshBase *mesh)
 
template<>
unsigned int packed_size (const std::vector< largest_id_type >::const_iterator in)
 
template<>
unsigned int packed_size (const std::vector< largest_id_type >::iterator in)
 
template<>
unsigned int packable_size (const Node *const &node, const DistributedMesh *mesh)
 
template<>
unsigned int packable_size (const Node *const &node, const ParallelMesh *mesh)
 
template<>
void pack (const Node *const &node, std::back_insert_iterator< std::vector< largest_id_type >> data_out, const MeshBase *mesh)
 
template<>
void pack (const Node *const &node, std::back_insert_iterator< std::vector< largest_id_type >> data_out, const DistributedMesh *mesh)
 
template<>
void pack (const Node *const &node, std::back_insert_iterator< std::vector< largest_id_type >> data_out, const ParallelMesh *mesh)
 

Static Public Member Functions

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

Detailed Description

template<>
class libMesh::Parallel::Packing< const Node * >

Definition at line 34 of file parallel_node.h.

Member Typedef Documentation

Definition at line 37 of file parallel_node.h.

Member Function Documentation

template<typename OutputIter , typename Context >
static void libMesh::Parallel::Packing< const Node * >::pack ( const Node *const &  object,
OutputIter  data_out,
const Context *  context 
)
static
template<>
void libMesh::Parallel::Packing< const Node * >::pack ( const Node *const &  node,
std::back_insert_iterator< std::vector< largest_id_type >>  data_out,
const MeshBase mesh 
)

Definition at line 134 of file parallel_node.C.

References libMesh::BoundaryInfo::boundary_ids(), libMesh::MeshBase::get_boundary_info(), libMesh::DofObject::id(), libMesh::DofObject::invalid_unique_id, libMesh::libmesh_assert(), std::max(), libMesh::DofObject::pack_indexing(), libMesh::DofObject::processor_id(), libMesh::Real, libMesh::DofObject::unique_id(), and libMesh::DofObject::valid_unique_id().

137 {
138  libmesh_assert(node);
139 
140 #ifndef NDEBUG
141  *data_out++ = (node_magic_header);
142 #endif
143 
144  *data_out++ = (static_cast<largest_id_type>(node->processor_id()));
145  *data_out++ = (static_cast<largest_id_type>(node->id()));
146 
147 #ifdef LIBMESH_ENABLE_UNIQUE_ID
148  if (node->valid_unique_id())
149  *data_out++ = (static_cast<largest_id_type>(node->unique_id()));
150  else
151  // OK to send invalid unique id, we must not own this DOF
152  *data_out++ = (static_cast<largest_id_type>(DofObject::invalid_unique_id));
153 #endif
154 
155  // use "(a+b-1)/b" trick to get a/b to round up
156  static const unsigned int idtypes_per_Real =
157  (sizeof(Real) + sizeof(largest_id_type) - 1) / sizeof(largest_id_type);
158 
159  for (unsigned int i=0; i != LIBMESH_DIM; ++i)
160  {
161  const largest_id_type * Real_as_idtypes =
162  reinterpret_cast<const largest_id_type *>(&((*node)(i)));
163  for (unsigned int j=0; j != idtypes_per_Real; ++j)
164  {
165  *data_out++ =(Real_as_idtypes[j]);
166  }
167  }
168 
169  // Add any DofObject indices
170  node->pack_indexing(data_out);
171 
172  // Add any nodal boundary condition ids
173  std::vector<boundary_id_type> bcs;
174  mesh->get_boundary_info().boundary_ids(node, bcs);
175 
177 
178  *data_out++ =(bcs.size());
179 
180  for (std::vector<boundary_id_type>::iterator bc_it=bcs.begin();
181  bc_it != bcs.end(); ++bc_it)
182  *data_out++ =(*bc_it);
183 }
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:117
uint64_t largest_id_type
Definition: id_types.h:139
long double max(long double a, double b)
bool valid_unique_id() const
Definition: dof_object.h:682
libmesh_assert(j)
std::vector< boundary_id_type > boundary_ids(const Node *node) 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...
Definition: dof_object.C:532
static const unique_id_type invalid_unique_id
An invalid unique_id to distinguish an uninitialized DofObject.
Definition: dof_object.h:329
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
dof_id_type id() const
Definition: dof_object.h:632
unique_id_type unique_id() const
Definition: dof_object.h:649
processor_id_type processor_id() const
Definition: dof_object.h:694
template<>
void libMesh::Parallel::Packing< const Node * >::pack ( const Node *const &  node,
std::back_insert_iterator< std::vector< largest_id_type >>  data_out,
const DistributedMesh mesh 
)

Definition at line 190 of file parallel_node.C.

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

193 {
194  pack(node, data_out, static_cast<const MeshBase*>(mesh));
195 }
static void pack(const Node *const &object, OutputIter data_out, const Context *context)
template<>
void libMesh::Parallel::Packing< const Node * >::pack ( const Node *const &  node,
std::back_insert_iterator< std::vector< largest_id_type >>  data_out,
const ParallelMesh mesh 
)

Definition at line 202 of file parallel_node.C.

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

205 {
206  pack(node, data_out, static_cast<const MeshBase*>(mesh));
207 }
static void pack(const Node *const &object, OutputIter data_out, const Context *context)
template<typename Context >
static unsigned int libMesh::Parallel::Packing< const Node * >::packable_size ( const Node *const &  object,
const Context *  context 
)
static
template<>
unsigned int libMesh::Parallel::Packing< const Node * >::packable_size ( const Node *const &  node,
const MeshBase mesh 
)

Definition at line 62 of file parallel_node.C.

References libMesh::MeshBase::get_boundary_info(), libMesh::BoundaryInfo::n_boundary_ids(), and libMesh::DofObject::packed_indexing_size().

64 {
65  return
66 #ifndef NDEBUG
67  1 + // add an int for the magic header when testing
68 #endif
69  header_size + LIBMESH_DIM*idtypes_per_Real +
70  node->packed_indexing_size() +
71  1 + mesh->get_boundary_info().n_boundary_ids(node);
72 }
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:117
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:457
std::size_t n_boundary_ids() const
template<>
unsigned int libMesh::Parallel::Packing< const Node * >::packable_size ( const Node *const &  node,
const DistributedMesh mesh 
)

Definition at line 112 of file parallel_node.C.

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

114 {
115  return packable_size(node, static_cast<const MeshBase *>(mesh));
116 }
static unsigned int packable_size(const Node *const &object, const Context *context)
template<>
unsigned int libMesh::Parallel::Packing< const Node * >::packable_size ( const Node *const &  node,
const ParallelMesh mesh 
)

Definition at line 123 of file parallel_node.C.

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

125 {
126  return packable_size(node, static_cast<const MeshBase *>(mesh));
127 }
static unsigned int packable_size(const Node *const &object, const Context *context)
template<typename BufferIter >
static unsigned int libMesh::Parallel::Packing< const Node * >::packed_size ( BufferIter  iter)
static
template<>
unsigned int libMesh::Parallel::Packing< const Node * >::packed_size ( const std::vector< largest_id_type >::const_iterator  in)

Definition at line 79 of file parallel_node.C.

References libMesh::DofObject::unpackable_indexing_size().

80 {
81  const unsigned int pre_indexing_size =
82 #ifndef NDEBUG
83  1 + // add an int for the magic header when testing
84 #endif
85  header_size + LIBMESH_DIM*idtypes_per_Real;
86 
87  const unsigned int indexing_size =
88  DofObject::unpackable_indexing_size(in+pre_indexing_size);
89 
90  const int n_bcs = cast_int<int>
91  (*(in + pre_indexing_size + indexing_size));
92  libmesh_assert_greater_equal (n_bcs, 0);
93 
94  return pre_indexing_size + indexing_size + 1 + n_bcs;
95 }
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:473
template<>
unsigned int libMesh::Parallel::Packing< const Node * >::packed_size ( const std::vector< largest_id_type >::iterator  in)

Definition at line 102 of file parallel_node.C.

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

103 {
104  return packed_size(std::vector<largest_id_type>::const_iterator(in));
105 }
static unsigned int packed_size(BufferIter iter)
template<typename BufferIter , typename Context >
const Node * libMesh::Parallel::Packing< const Node * >::unpack ( BufferIter  in,
Context *  ctx 
)
static

Definition at line 84 of file parallel_node.h.

References libMesh::Parallel::Packing< T >::unpack().

85 { return Packing<Node *>::unpack(in, ctx); }
PetscErrorCode Vec Mat Mat void * ctx
static T unpack(BufferIter in, Context *ctx)

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