60 using DataType =
typename Handle::DataType;
71 : handle_(handle), c2fGather_(c2fGather), c2f_(c2f)
74 bool fixedSize(
int,
int)
79 typename std::enable_if<T::codimension != 0, std::size_t>::type
82 OPM_THROW(std::logic_error,
"This should never throw! We only know sizes for cells");
85 std::size_t size(
const EntityRep<0>& t)
87 const auto& faces = c2fGather_[t];
89 for (
const auto& face : faces)
91 size += handle_.size(face);
95 bool contains(std::size_t dim, std::size_t codim)
97 return dim==3 && codim == 0;
99 template<
class B,
class T>
100 typename std::enable_if<T::codimension != 0, void>::type
103 OPM_THROW(std::logic_error,
"This should never throw! We can only gather cell values and indicate that");
106 void gather(B& buffer,
const EntityRep<0>& t)
108 const auto& faces = c2fGather_[t];
109 for (
const auto& face : faces)
111 handle_.gather(buffer, face);
114 template<
class B,
class T>
115 typename std::enable_if<T::codimension != 0, void>::type
116 scatter(B&,
const T&, std::size_t)
118 OPM_THROW(std::logic_error,
"This should never throw! We can only gather cell values and indicate that");
121 void scatter(B& buffer,
const EntityRep<0>& t, std::size_t)
123 const auto& faces = c2f_[t];
124 for (
const auto& face : faces)
129 handle_.scatter(buffer, face, 1);
134 const C2FTable& c2fGather_, c2f_;
155 using DataType =
typename Handle::DataType;
156 using C2PTable = std::vector< std::array<int,8> >;
164 const C2PTable& c2pGather,
166 : handle_(handle), c2pGather_(c2pGather), c2p_(c2p)
168 bool fixedSize(
int i,
int j)
170 if( ! handle_.fixedSize(i, j))
174 return handle_.fixedSize(i, j);
177 typename std::enable_if<T::codimension != 0, std::size_t>::type
180 OPM_THROW(std::logic_error,
"This should never throw! We only know sizes for cells");
183 std::size_t size(
const EntityRep<0>& t)
185 const auto& points = c2pGather_[t.index()];
187 for (
const auto& point : points)
189 size += handle_.size(EntityRep<3>(point,
true));
193 bool contains(std::size_t dim, std::size_t codim)
195 return dim==3 && codim == 0;
197 template<
class B,
class T>
198 typename std::enable_if<T::codimension != 0, void>::type
201 OPM_THROW(std::logic_error,
"This should never throw! We can only gather cell values and indicate that");
204 void gather(B& buffer,
const EntityRep<0>& t)
206 const auto& points = c2pGather_[t.index()];
207 for (
const auto& point : points)
209 handle_.gather(buffer, EntityRep<3>(point,
true));
212 template<
class B,
class T>
213 typename std::enable_if<T::codimension != 0, void>::type
214 scatter(B&,
const T&, std::size_t)
216 OPM_THROW(std::logic_error,
"This should never throw! We can only gather cell values and indicate that");
219 void scatter(B& buffer,
const EntityRep<0>& t, std::size_t s)
221 const auto& points = c2p_[t.index()];
222 for (
const auto& point : points)
224 handle_.scatter(buffer, EntityRep<3>(point,
true), s/8);
229 const C2PTable& c2pGather_, c2p_;
FaceViaCellHandleWrapper(Handle &handle, const C2FTable &c2fGather, const C2FTable &c2f)
Constructs the data handle.
Definition DataHandleWrappers.hpp:68
PointViaCellHandleWrapper(Handle &handle, const C2PTable &c2pGather, const C2PTable &c2p)
Constructs the data handle.
Definition DataHandleWrappers.hpp:163