From b76a61680c7172c127a19c16cbb7215a0295bd37 Mon Sep 17 00:00:00 2001 From: Olivier Parcollet Date: Tue, 18 Feb 2014 17:09:24 +0100 Subject: [PATCH] gf make_gf_from_g_and_tail : add security - if shape (g) != shape(t) -> exception --- triqs/gfs/local/no_tail.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/triqs/gfs/local/no_tail.hpp b/triqs/gfs/local/no_tail.hpp index b3ffa0e1..37702cbf 100644 --- a/triqs/gfs/local/no_tail.hpp +++ b/triqs/gfs/local/no_tail.hpp @@ -35,6 +35,8 @@ namespace gfs { template gf_view make_gf_from_g_and_tail(gf_impl const &g, local::tail t) { + if (t.shape() != get_target_shape(g)) + TRIQS_RUNTIME_ERROR << "make_gf_from_g_and_tail: Shape of the gf target and of the tail mismatch"; auto g2 = gf{g}; // copy the function without tail return {std::move(g2.mesh()), std::move(g2.data()), std::move(t), g2.symmetry()}; } @@ -42,6 +44,8 @@ namespace gfs { template gf_view make_gf_view_from_g_and_tail(gf_impl const &g, local::tail_view t) { + if (t.shape() != get_target_shape(g)) + TRIQS_RUNTIME_ERROR << "make_gf_from_g_and_tail: Shape of the gf target and of the tail mismatch"; return {g.mesh(), g.data(), t, g.symmetry()}; } }