/******************************************************************************* * * TRIQS: a Toolbox for Research in Interacting Quantum Systems * * Copyright (C) 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 "./product.hpp" #include "./meshes/matsubara_freq.hpp" namespace triqs { namespace gfs { WRONGE CODE // short cut. Here only the change compare to default multi var implementation using imfreq_bff = cartesian_product; //struct imfreq_bff {}; // = cartesian_product; using imfreq_mesh_3 = mesh_product; // The default target for this mesh template <> struct gf_default_target { using type = tensor_valued<4>; }; // reimplement a simpler constructor, which enforces that the 2 meshes are equal. template struct gf_mesh : imfreq_mesh_3 { gf_mesh() = default; gf_mesh(matsubara_freq_mesh const& m1, matsubara_freq_mesh const& m2) : imfreq_mesh_3{m1, m2, m2} {} }; namespace gfs_implementation { /// --------------------------- data access --------------------------------- struct imfreq_bff_indices_mixer { template static auto invoke(MI const& m, TI const& t) { return std::make_tuple(std::get<0>(m), std::get<1>(m), std::get<0>(t), std::get<1>(t), std::get<2>(m), std::get<2>(t), std::get<3>(t)); } }; template <> struct data_proxy, void> : data_proxy_array_index_mixer, 3, 4, imfreq_bff_indices_mixer> { //template auto operator()(S& data, Tu const& tu) const { // return data(std::get<0>(tu), arrays::range(), std::get<1>(tu), arrays::range(), std::get<2>(tu), arrays::range()); // } }; // ------------------------------- evaluator -------------------------------------------------- //template //struct evaluator : evaluator, Target, nothing, Opt> {}; /// --------------------------- hdf5 --------------------------------- template struct h5_name, nothing, Opt> { static std::string invoke() { return "imfreq_bff"; } }; /// --------------------------- partial eval --------------------------------- template struct partial_eval_impl { template gf_view partial_eval(gf_view, nothing, void, IsConst> g, Omega const& omega) { static_assert(pos == 0, "EE"); auto& m = g.mesh().components(); auto av = g.data()(std::get<0>(m).index_to_linear(omega), arrays::ellipsis{}); return {{std::get<1>(m)}, av, {}, {}, {}}; } }; } // gfs_implementation gf_mesh get_bosonic_mesh(gf_view> g) { return std::get<0>(g.mesh().components()); } /* template auto partial_eval(gf>& g, Omega const& omega) RETURN(partial_eval(g(), omega)); template auto partial_eval(gf> const& g, Omega const& omega) RETURN(partial_eval(g(), omega)); /// --------------------------- curry --------------------------------- template auto curry_on_bosonic_freq(gf_view, nothing, void, IsConst> g) { return make_gf_view_lambda_valued(std::get<0>(g.mesh().components()), [g](auto&& x) { return partial_eval(g, x); }); } auto curry_on_bosonic_freq(gf>& g) RETURN(curry_on_bosonic_freq(g())); auto curry_on_bosonic_freq(gf> const& g) RETURN(curry_on_bosonic_freq(g())); */ } } /* template struct curry_polymorphic_lambda2 { G g; template AUTO_DECL operator()(I &&... i) const RETURN(partial_eval(g, i...)); }; */