3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 03:33:50 +01:00
dft_tools/test/triqs/gf/ser.cpp
Olivier Parcollet 40f8cb5c18 [API BREAK] gf : rename namespace gf->gfs
- necessary otherwise the class gf and the namespace have
the same name, leading to some confusion, and need to qualify
some functions (specially on gcc).
Same naming conventions as arrays.
2013-07-28 21:11:28 +02:00

35 lines
885 B
C++

//#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
#include <triqs/utility/serialization.hpp>
#include <triqs/gf/imfreq.hpp>
#include <triqs/gf/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;
}