TIMPI
Public Types | Static Public Member Functions | List of all members
libMesh::Parallel::PackingRange< Container > Class Template Reference

#include <packing.h>

Public Types

typedef DefaultBufferType< typename Container::value_type >::type buffer_type
 
typedef PackingMixedType< buffer_typeMixed
 

Static Public Member Functions

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

Detailed Description

template<typename Container>
class libMesh::Parallel::PackingRange< Container >

Definition at line 800 of file packing.h.

Member Typedef Documentation

◆ buffer_type

template<typename Container >
typedef DefaultBufferType<typename Container::value_type>::type libMesh::Parallel::PackingRange< Container >::buffer_type

Definition at line 805 of file packing.h.

◆ Mixed

template<typename Container >
typedef PackingMixedType<buffer_type> libMesh::Parallel::PackingRange< Container >::Mixed

Definition at line 807 of file packing.h.

Member Function Documentation

◆ pack()

template<typename Container >
template<typename OutputIter , typename Context >
void libMesh::Parallel::PackingRange< Container >::pack ( const Container &  a,
OutputIter  data_out,
const Context *  context 
)
static

Definition at line 848 of file packing.h.

849 {
850  unsigned int size = packable_size(c, ctx);
851 
852  // First write out info about the buffer size
853  put_packed_len<buffer_type>(size, data_out);
854 
855  // Now pack the data
856  for (const auto & entry : c)
857  Mixed::pack_comp(entry, data_out, ctx);
858 }
static unsigned int packable_size(const Container &a, const Context *context)
Definition: packing.h:828
static void pack_comp(const T3 &comp, OutputIter data_out, const Context *)
Definition: packing.h:268

◆ packable_size()

template<typename Container >
template<typename Context >
unsigned int libMesh::Parallel::PackingRange< Container >::packable_size ( const Container &  a,
const Context *  context 
)
static

Definition at line 828 of file packing.h.

829 {
830  unsigned int returnval = get_packed_len_entries<buffer_type>(); // size
831  for (const auto & entry : c)
832  returnval += Mixed::packable_size_comp(entry, ctx);
833  return returnval;
834 }
static unsigned int packable_size_comp(const T3 &, const Context *)
Definition: packing.h:232

◆ packed_size()

template<typename Container >
template<typename BufferIter >
unsigned int libMesh::Parallel::PackingRange< Container >::packed_size ( BufferIter  iter)
static

Definition at line 839 of file packing.h.

840 {
841  // We recorded the size in the first buffer entries
842  return get_packed_len<buffer_type>(iter);
843 }

◆ unpack()

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

Definition at line 863 of file packing.h.

864 {
865  Container c;
866 
867  unsigned int size = packed_size(in);
868 
869  timpi_assert_greater(size, 0);
870 
871  // Get the total size
872  constexpr int size_bytes = get_packed_len_entries<buffer_type>();
873  in += size_bytes;
874  size -= size_bytes;
875 
876  // Unpack the data
877  std::size_t unpacked_size = 0;
878  while (unpacked_size < size)
879  {
881  Mixed::unpack_comp(entry, in, ctx);
882 
883  c.insert(c.end(), entry);
884 
885  // Make sure we increment the iterator
886  const std::size_t unpacked_size_comp =
887  Mixed::packable_size_comp(entry, ctx);
888  in += unpacked_size_comp;
889  unpacked_size += unpacked_size_comp;
890  }
891 
892  // We should always finish at exactly the size we expected, not
893  // proceed past it
894  timpi_assert_equal_to(unpacked_size, size);
895 
896  return c;
897 }
static unsigned int packed_size(BufferIter iter)
Definition: packing.h:839
static void unpack_comp(T3 &comp, BufferIter in, Context *)
Definition: packing.h:309
static unsigned int packable_size_comp(const T3 &, const Context *)
Definition: packing.h:232

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