eclmpiserializer: improve set handler

use has_serializeOp trait
This commit is contained in:
Arne Morten Kvarving 2022-09-02 13:02:35 +02:00
parent a372a4d09e
commit 2dd6433f16

View File

@ -64,8 +64,8 @@ using remove_cvr_t = std::remove_const_t<std::remove_reference_t<T>>;
namespace Opm { namespace Opm {
/*! \brief Class for (de-)serializing and broadcasting data in parallel. /*! \brief Class for (de-)serializing and broadcasting data in parallel.
*! \details Can be called on any class with a serializeOp member. Such classes *! \details If the class has a serializeOp member this is used,
*! are referred to as 'complex types' in the documentation. * if not it is passed on to the underlying primitive serializer.
*/ */
class EclMpiSerializer { class EclMpiSerializer {
@ -286,7 +286,7 @@ public:
} }
} }
template<class Set, bool complexType = true> template<class Set>
void set(Set& data) void set(Set& data)
{ {
using Data = typename Set::value_type; using Data = typename Set::value_type;
@ -297,7 +297,7 @@ public:
this->vector(d); this->vector(d);
else if constexpr (is_ptr<Data>::value) else if constexpr (is_ptr<Data>::value)
ptr(d); ptr(d);
else if constexpr (complexType) else if constexpr (has_serializeOp<Data>::value)
d.serializeOp(*this); d.serializeOp(*this);
else else
(*this)(d); (*this)(d);