libMesh
parallel_elem.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 #ifndef LIBMESH_PARALLEL_ELEM_H
20 #define LIBMESH_PARALLEL_ELEM_H
21 
22 // libMesh includes
23 #include "libmesh/id_types.h"
24 #include "libmesh/libmesh_config.h"
25 
26 // TIMPI includes
27 #include "timpi/packing.h"
28 
29 
30 namespace libMesh
31 {
32 
33 // Forward declarations
34 class Elem;
35 
36 namespace Parallel
37 {
38 
39 template <>
40 class Packing<const Elem *>
41 {
42 public:
44 
45  template <typename OutputIter, typename Context>
46  static void pack(const Elem * const & object,
47  OutputIter data_out,
48  const Context * context);
49 
50  template <typename Context>
51  static unsigned int packable_size(const Elem * const & object,
52  const Context * context);
53 
54  template <typename BufferIter>
55  static unsigned int packed_size(BufferIter iter);
56 
57  template <typename BufferIter, typename Context>
58  static const Elem * unpack(BufferIter in, Context * ctx);
59 };
60 
61 
62 template <>
63 class Packing<Elem *>
64 {
65 public:
67 
68  template <typename OutputIter, typename Context>
69  static void pack(Elem * const & object,
70  OutputIter data_out,
71  const Context * context)
72  { return Packing<const Elem *>::pack(object, data_out, context); }
73 
74  template <typename Context>
75  static unsigned int packable_size(Elem * const & object,
76  const Context * context)
77  { return Packing<const Elem *>::packable_size(object, context); }
78 
79  template <typename BufferIter>
80  static unsigned int packed_size(BufferIter iter)
81  { return Packing<const Elem *>::packed_size(iter); }
82 
83  template <typename BufferIter, typename Context>
84  static Elem * unpack(BufferIter in, Context * ctx);
85 };
86 
87 
88 template <typename BufferIter, typename Context>
89 inline const Elem*
90 Packing<const Elem*>::unpack(BufferIter in, Context * ctx)
91 { return Packing<Elem*>::unpack(in, ctx); }
92 
93 
94 template <>
95 class Packing<Elem * const>
96 {
97 public:
99 
100  template <typename OutputIter, typename Context>
101  static void pack(Elem * const & object,
102  OutputIter data_out,
103  const Context * context)
104  { return Packing<const Elem *>::pack(object, data_out, context); }
105 
106  template <typename Context>
107  static unsigned int packable_size(Elem * const & object,
108  const Context * context)
109  { return Packing<const Elem*>::packable_size(object, context); }
110 
111  template <typename BufferIter>
112  static unsigned int packed_size(BufferIter iter)
113  { return Packing<const Elem *>::packed_size(iter); }
114 
115  template <typename BufferIter, typename Context>
116  static Elem * unpack(BufferIter in, Context * ctx)
117  { return Packing<Elem *>::unpack(in, ctx); }
118 };
119 
120 
121 template <>
122 class Packing<const Elem * const>
123 {
124 public:
126 
127  template <typename OutputIter, typename Context>
128  static void pack(Elem * const & object,
129  OutputIter data_out,
130  const Context * context)
131  { return Packing<const Elem *>::pack(object, data_out, context); }
132 
133  template <typename Context>
134  static unsigned int packable_size(Elem * const & object,
135  const Context * context)
136  { return Packing<const Elem*>::packable_size(object, context); }
137 
138  template <typename BufferIter>
139  static unsigned int packed_size(BufferIter iter)
140  { return Packing<const Elem *>::packed_size(iter); }
141 
142  template <typename BufferIter, typename Context>
143  static Elem * unpack(BufferIter in, Context * ctx)
144  { return Packing<Elem *>::unpack(in, ctx); }
145 };
146 
147 
148 
149 } // namespace Parallel
150 } // namespace libMesh
151 
152 #endif // LIBMESH_PARALLEL_ELEM_H
static void pack(Elem *const &object, OutputIter data_out, const Context *context)
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
uint64_t largest_id_type
Definition: id_types.h:148
static unsigned int packable_size(Elem *const &object, const Context *context)
The libMesh namespace provides an interface to certain functionality in the library.
static T unpack(BufferIter in, Context *ctx)
Definition: parallel_elem.h:90
static Elem * unpack(BufferIter in, Context *ctx)
static void pack(Elem *const &object, OutputIter data_out, const Context *context)
static unsigned int packable_size(const T &object, const Context *context)
static unsigned int packed_size(BufferIter iter)
static void pack(Elem *const &object, OutputIter data_out, const Context *context)
Definition: parallel_elem.h:69
static unsigned int packed_size(BufferIter iter)
Definition: parallel_elem.h:80
static void pack(const T &object, OutputIter data_out, const Context *context)
static unsigned int packed_size(BufferIter iter)
static unsigned int packable_size(Elem *const &object, const Context *context)
Definition: parallel_elem.h:75
static Elem * unpack(BufferIter in, Context *ctx)
void * ctx
static unsigned int packable_size(Elem *const &object, const Context *context)
static unsigned int packed_size(BufferIter iter)