3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 03:33:50 +01:00
dft_tools/test/triqs/gfs/ser.cpp

35 lines
887 B
C++
Raw Normal View History

//#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
#include <triqs/utility/serialization.hpp>
2013-07-29 09:57:07 +02:00
#include <triqs/gfs/imfreq.hpp>
#include <triqs/gfs/imtime.hpp>
namespace tql= triqs::clef;
namespace tqa= triqs::arrays;
using tqa::range;
using triqs::arrays::make_shape;
using triqs::gfs::Fermion;
using triqs::gfs::imfreq;
using triqs::gfs::imtime;
using triqs::gfs::make_gf;
#define TEST(X) std::cout << BOOST_PP_STRINGIZE((X)) << " ---> "<< (X) <<std::endl<<std::endl;
int main() {
double beta =1;
auto G = make_gf<imfreq> (beta, Fermion, make_shape(2,2));
double x = 127;
std::string s = triqs::serialize(x);
std::cout << " s = "<< s<< std::endl;
std::cout << triqs::deserialize<double>(s) << std::endl;
std::cout << triqs::deserialize<int>(s) << std::endl;
std::vector<std::string> v; v.push_back("abc"); v.push_back("3");
std::cout << triqs::serialize(v)<< std::endl;
}