Skip to content
Snippets Groups Projects
Commit efd3d83b authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Implement writeBinary and readBinary using forEach

This uses the new HybridAlgorithm::forEach() instead
of the old one in writeBinary() and makes readBinary()
aware of heterogeneous containers.
parent b7a3fa30
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -32,8 +32,9 @@ struct GenericVector ...@@ -32,8 +32,9 @@ struct GenericVector
template <class VectorType> template <class VectorType>
static void writeBinary(std::ostream& s, const VectorType& v) static void writeBinary(std::ostream& s, const VectorType& v)
{ {
Dune::Solvers::integralRangeFor<std::size_t>(Dune::Indices::_0, Dune::Solvers::hybridSize(v), [&](auto&& i) { namespace HA = Dune::Solvers::HybridAlgorithm;
GenericVector::writeBinary(s, v[i]); HA::forEach(v, [&](auto&& vi) {
GenericVector::writeBinary(s, vi);
}); });
} }
...@@ -51,10 +52,10 @@ struct GenericVector ...@@ -51,10 +52,10 @@ struct GenericVector
template <class VectorType> template <class VectorType>
static void readBinary(std::istream& s, VectorType& v) static void readBinary(std::istream& s, VectorType& v)
{ {
typename VectorType::iterator it = v.begin(); namespace HA = Dune::Solvers::HybridAlgorithm;
typename VectorType::iterator end = v.end(); HA::forEach(v, [&](auto&& vi) {
for(; it!=end; ++it) GenericVector::readBinary(s, vi);
GenericVector::readBinary(s, *it); });
} }
template <class field_type, int n> template <class field_type, int n>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment