diff --git a/reco/L1/L1Algo/L1SimdSerializer.h b/reco/L1/L1Algo/L1SimdSerializer.h index fdc1a4cd54e1d5e25cb3851a7df11f9d0703dba9..3a8b0e373f9fcb33ffef7d39f4d134344345f85d 100644 --- a/reco/L1/L1Algo/L1SimdSerializer.h +++ b/reco/L1/L1Algo/L1SimdSerializer.h @@ -11,20 +11,37 @@ #define L1SimdSerializer_h 1 #include <boost/serialization/access.hpp> +#include <boost/serialization/split_free.hpp> #include "vectors/L1vec.h" - +/// This header defines functionality for saving and loading SIMDized vectors. At the moment, only the first element of +/// the vector can be saved, and the loaded vector will be horizontally equal. +/// namespace boost { namespace serialization { template<class Archive> - void serialize(Archive& ar, fvec& vect, const unsigned int) + void save(Archive& ar, const fvec& vect, unsigned int) + { + ar << vect[0]; + } + + template<class Archive> + void load(Archive& ar, fvec& vect, unsigned int) { + fscal buffer; + ar >> buffer; for (size_t i = 0; i < fvec::size(); ++i) { - ar&(reinterpret_cast<fscal*>(&vect))[i]; + vect[i] = buffer; } } + + template<class Archive> + void serialize(Archive& ar, fvec& vect, const unsigned int version) + { + split_free(ar, vect, version); + } } // namespace serialization } // namespace boost