/******************************************************************************* * * TRIQS: a Toolbox for Research in Interacting Quantum Systems * * Copyright (C) 2011 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 . * ******************************************************************************/ #ifndef TRIQS_ARRAYS_IMPL_COMMON_H #define TRIQS_ARRAYS_IMPL_COMMON_H #include #include #define TRIQS_ARRAYS_ALREADY_INCLUDED /// Maximum dimension of the arrays #define ARRAY_NRANK_MAX 10 #include #include #include #include #include #include #include #include #include // LEADS to an error on OS X??? //#include #include "./traits.hpp" namespace boost { namespace serialization { class access;}} #define TRIQS_ARRAYS_THROW(s) { TRIQS_RUNTIME_ERROR< typename A::view_type make_view(A const & x) { return typename A::view_type(x);} /// Makes a clone template typename A::regular_type make_clone(A const & x) { return typename A::regular_type(x);} namespace arrays { using triqs::make_clone; /// Is the data contiguous template TYPE_DISABLE_IFC(bool, is_amv_value_or_view_class::value) has_contiguous_data(A const &) {return false;} template TYPE_ENABLE_IFC(bool, is_amv_value_class::value) has_contiguous_data(A const &) {return true;} template TYPE_ENABLE_IFC(bool, is_amv_view_class::value) has_contiguous_data(A const & v){return v.indexmap().is_contiguous();} template< typename A> ENABLE_IF(is_amv_view_class) resize_or_check_if_view ( A & a, typename A::shape_type const & sha) { if (a.shape()!=sha) TRIQS_RUNTIME_ERROR<< "Size mismatch : view class shape = "< ENABLE_IF(is_amv_value_class) resize_or_check_if_view ( A & a, typename A::shape_type const & sha) { if (a.shape()!=sha) a.resize(sha); } }}//namespace triqs::arrays #endif