/*******************************************************************************
*
* 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
#include
#include
#include
#include
#include "./traits.hpp"
#include
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 typename boost::disable_if,bool>::type has_contiguous_data(A const &) {return false;}
template typename boost::enable_if,bool>::type has_contiguous_data(A const &) {return true;}
template typename boost::enable_if, bool>::type has_contiguous_data(A const & v){return v.indexmap().is_contiguous();}
template< typename A>
typename boost::enable_if >::type
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 = "<
typename boost::enable_if >::type
resize_or_check_if_view ( A & a, typename A::shape_type const & sha) { if (a.shape()!=sha) a.resize(sha); }
}}//namespace triqs::arrays
#endif