/******************************************************************************* * * TRIQS: a Toolbox for Research in Interacting Quantum Systems * * Copyright (C) 2012 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_TRAITS_H #define TRIQS_ARRAYS_IMPL_TRAITS_H #include #include namespace triqs { namespace arrays { namespace mpl = boost::mpl; // The ImmutableCuboidArray concept TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT(ImmutableCuboidArray); TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MutableCuboidArray, (ImmutableCuboidArray)); // The ImmutableArray concept TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(ImmutableArray, (ImmutableCuboidArray)); TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MutableArray, (ImmutableArray)(MutableCuboidArray)); // The ImmutableMatrix concept TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(ImmutableMatrix, (ImmutableCuboidArray)); TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MutableMatrix, (ImmutableMatrix)(MutableCuboidArray)); // The ImmutableVector concept TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(ImmutableVector, (ImmutableCuboidArray)); TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MutableVector, (ImmutableVector)(MutableCuboidArray)); namespace Tag { struct array {}; struct array_view {}; struct vector {}; struct vector_view {}; struct matrix_view {}; struct matrix {}; } template struct is_array : std::is_base_of {}; template struct is_array_view : std::is_base_of {}; template struct is_array_or_view : _or, is_array_view> {}; template struct is_vector : std::is_base_of {}; template struct is_vector_view : std::is_base_of {}; template struct is_vector_or_view : _or, is_vector_view> {}; template struct is_matrix : std::is_base_of {}; template struct is_matrix_view : std::is_base_of {}; template struct is_matrix_or_view : _or, is_matrix_view> {}; template struct is_amv_value_class : _or, is_matrix, is_vector> {}; template struct is_amv_view_class : _or, is_matrix_view, is_vector_view> {}; template struct is_amv_value_or_view_class : _or, is_amv_view_class> {}; template struct is_scalar : _or, boost::is_complex> {}; template struct is_scalar_for : std::conditional::value, is_scalar, boost::is_same>::type { }; } } // namespace triqs::arrays #endif