58 using DataType =
typename Handle::DataType;
69 : handle_(handle), c2fGather_(c2fGather), c2f_(c2f)
72 bool fixedSize(
int,
int)
77 typename std::enable_if<T::codimension != 0, std::size_t>::type
80 OPM_THROW(std::logic_error,
"This should never throw! We only know sizes for cells");
83 std::size_t size(
const EntityRep<0>& t)
85 const auto& faces = c2fGather_[t];
86 return std::accumulate(faces.begin(), faces.end(), std::size_t{0},
87 [
this](
const auto acc,
const auto& face)
88 { return acc + handle_.size(face); });
90 bool contains(std::size_t dim, std::size_t codim)
92 return dim==3 && codim == 0;
94 template<
class B,
class T>
95 typename std::enable_if<T::codimension != 0, void>::type
98 OPM_THROW(std::logic_error,
"This should never throw! We can only gather cell values and indicate that");
101 void gather(B& buffer,
const EntityRep<0>& t)
103 const auto& faces = c2fGather_[t];
104 for (
const auto& face : faces)
106 handle_.gather(buffer, face);
109 template<
class B,
class T>
110 typename std::enable_if<T::codimension != 0, void>::type
111 scatter(B&,
const T&, std::size_t)
113 OPM_THROW(std::logic_error,
"This should never throw! We can only gather cell values and indicate that");
116 void scatter(B& buffer,
const EntityRep<0>& t, std::size_t)
118 const auto& faces = c2f_[t];
119 for (
const auto& face : faces)
124 handle_.scatter(buffer, face, 1);
129 const C2FTable& c2fGather_, c2f_;
150 using DataType =
typename Handle::DataType;
151 using C2PTable = std::vector< std::array<int,8> >;
159 const C2PTable& c2pGather,
161 : handle_(handle), c2pGather_(c2pGather), c2p_(c2p)
163 bool fixedSize(
int i,
int j)
165 if( ! handle_.fixedSize(i, j))
169 return handle_.fixedSize(i, j);
172 typename std::enable_if<T::codimension != 0, std::size_t>::type
175 OPM_THROW(std::logic_error,
"This should never throw! We only know sizes for cells");
178 std::size_t size(
const EntityRep<0>& t)
180 const auto& points = c2pGather_[t.index()];
181 return std::accumulate(points.begin(), points.end(), std::size_t{0},
182 [
this](
const auto acc,
const auto& point)
183 { return acc + handle_.size(EntityRep<3>(point, true)); });
185 bool contains(std::size_t dim, std::size_t codim)
187 return dim==3 && codim == 0;
189 template<
class B,
class T>
190 typename std::enable_if<T::codimension != 0, void>::type
193 OPM_THROW(std::logic_error,
"This should never throw! We can only gather cell values and indicate that");
196 void gather(B& buffer,
const EntityRep<0>& t)
198 const auto& points = c2pGather_[t.index()];
199 for (
const auto& point : points)
201 handle_.gather(buffer, EntityRep<3>(point,
true));
204 template<
class B,
class T>
205 typename std::enable_if<T::codimension != 0, void>::type
206 scatter(B&,
const T&, std::size_t)
208 OPM_THROW(std::logic_error,
"This should never throw! We can only gather cell values and indicate that");
211 void scatter(B& buffer,
const EntityRep<0>& t, std::size_t s)
213 const auto& points = c2p_[t.index()];
214 for (
const auto& point : points)
216 handle_.scatter(buffer, EntityRep<3>(point,
true), s/8);
221 const C2PTable& c2pGather_, c2p_;
FaceViaCellHandleWrapper(Handle &handle, const C2FTable &c2fGather, const C2FTable &c2f)
Constructs the data handle.
Definition DataHandleWrappers.hpp:66
PointViaCellHandleWrapper(Handle &handle, const C2PTable &c2pGather, const C2PTable &c2p)
Constructs the data handle.
Definition DataHandleWrappers.hpp:158