/******************************************************************************* * * TRIQS: a Toolbox for Research in Interacting Quantum Systems * * Copyright (C) 2012-2014 by O. Parcollet * * TRIQS is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * TRIQS. If not, see . * ******************************************************************************/ #pragma once #include "./tools.hpp" #include "./gf.hpp" #include "./local/tail.hpp" #include "./meshes/discrete.hpp" namespace triqs { namespace gfs { namespace gfs_implementation { /*template constexpr bool has_a_singularity() { return std::is_same::type, local::tail>::value; } /// --------------------------- singularity --------------------------------- template struct singularity, Target, Opt> { using type = std14::conditional_t < (!has_a_singularity()) && has_a_singularity(), gf, nothing > ; }; */ /// --------------------------- hdf5 --------------------------------- template struct h5_name { static std::string invoke() { return "xxxxx"; } }; template struct h5_rw { static void write(h5::group gr, gf_const_view g) { for (size_t i = 0; i < g.mesh().size(); ++i) h5_write(gr, std::to_string(i), g._data[i]); // h5_write(gr,"symmetry",g._symmetry); } template static void read(h5::group gr, gf_impl &g) { // does not work : need to read the block name and remake the mesh... //g._mesh = gf_mesh(gr.get_all_subgroup_names()); //g._data.resize(g._mesh.size()); // if (g._data.size() != g._mesh.size()) TRIQS_RUNTIME_ERROR << "h5 read block gf : number of block mismatch"; //for (size_t i = 0; i < g.mesh().size(); ++i) h5_read(gr, g.mesh().domain().names()[i], g._data[i]); // h5_read(gr,"symmetry",g._symmetry); } }; /// --------------------------- data access --------------------------------- template struct data_proxy : data_proxy_vector {}; // ------------------------------- Factories -------------------------------------------------- template struct factories { using mesh_t=gf_mesh ; using gf_t=gf ; //using gf_view_t=gf_view ; struct target_shape_t {}; using aux_t = nothing; static typename gf_t::data_t make_data(mesh_t const &m, target_shape_t, aux_t) { return std::vector(m.size()); } static nothing make_singularity(mesh_t const &m, target_shape_t) { return {}; } }; // partial_eval template struct partial_eval_impl { using gv_t = gf_view; template static auto invoke(gv_t g, T const &... x) { return invoke_impl(g, std14::index_sequence(), x...); } template static local::tail_view invoke_impl(gv_t g, std14::index_sequence<0>, T const &x) { return g[g.mesh().index_to_linear(x)]; } template static nothing invoke_impl(gv_t g, std14::index_sequence<1>, T const &x) { return {}; } }; } // gfs_implementation }}