mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-18 15:57:05 +01:00
Serialisation of an object containing an Eigen::Tensor works for Hdf5. Still quite a lot of tidying up to do.
This commit is contained in:
@ -378,8 +378,20 @@ namespace Grid {
|
||||
{
|
||||
return os;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline bool CompareMember(const T &lhs, const T &rhs) {
|
||||
return lhs == rhs;
|
||||
}
|
||||
|
||||
template <typename Scalar_, int NumIndices_, int Options_, typename Index_>
|
||||
static inline bool CompareMember(const Eigen::Tensor<Scalar_, NumIndices_, Options_, Index_> &lhs,
|
||||
const Eigen::Tensor<Scalar_, NumIndices_, Options_, Index_> &rhs) {
|
||||
Eigen::Tensor<bool, 0, Options_, Index_> bResult = (lhs == rhs).all();
|
||||
return bResult(0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Generic writer interface //////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
inline void push(Writer<T> &w, const std::string &s) {
|
||||
|
@ -109,7 +109,7 @@ THE SOFTWARE.
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GRID_MACRO_MEMBER(A,B) A B;
|
||||
#define GRID_MACRO_COMP_MEMBER(A,B) result = (result and (lhs. B == rhs. B));
|
||||
#define GRID_MACRO_COMP_MEMBER(A,B) result = (result and CompareMember(lhs. B, rhs. B));
|
||||
#define GRID_MACRO_OS_WRITE_MEMBER(A,B) os<< #A <<" " #B << " = " << obj. B << " ; " <<std::endl;
|
||||
#define GRID_MACRO_READ_MEMBER(A,B) Grid::read(RD,#B,obj. B);
|
||||
#define GRID_MACRO_WRITE_MEMBER(A,B) Grid::write(WR,#B,obj. B);
|
||||
|
Reference in New Issue
Block a user