diff --git a/triqs/arrays/array.hpp b/triqs/arrays/array.hpp index 90148e11..8c297a87 100644 --- a/triqs/arrays/array.hpp +++ b/triqs/arrays/array.hpp @@ -37,7 +37,7 @@ namespace triqs { namespace arrays { storages::shared_block, Opt, TraversalOrder, Tag::array_view > template - class array_view : Tag::array_view, TRIQS_CONCEPT_TAG_NAME(MutableCuboidArray), public IMPL_TYPE { + class array_view : Tag::array_view, TRIQS_CONCEPT_TAG_NAME(MutableArray), public IMPL_TYPE { static_assert( Rank>0, " Rank must be >0"); public: typedef typename IMPL_TYPE::indexmap_type indexmap_type; @@ -99,7 +99,7 @@ namespace triqs { namespace arrays { storages::shared_block, Opt, TraversalOrder, Tag::array_view > template - class array: Tag::array, TRIQS_CONCEPT_TAG_NAME(MutableCuboidArray), public IMPL_TYPE { + class array: Tag::array, TRIQS_CONCEPT_TAG_NAME(MutableArray), public IMPL_TYPE { public: typedef typename IMPL_TYPE::value_type value_type; typedef typename IMPL_TYPE::storage_type storage_type; @@ -139,7 +139,7 @@ namespace triqs { namespace arrays { * - a expression : e.g. array A = B+ 2*C; */ template - array(const T & X, TYPE_ENABLE_IF(memory_layout, ImmutableArray) ml = memory_layout(IMPL_TYPE::indexmap_type::traversal_order)): + array(const T & X, TYPE_ENABLE_IF(memory_layout, ImmutableCuboidArray) ml = memory_layout(IMPL_TYPE::indexmap_type::traversal_order)): IMPL_TYPE(indexmap_type(X.domain(),ml)) { triqs_arrays_assign_delegation(*this,X); } #ifdef TRIQS_WITH_PYTHON_SUPPORT @@ -189,7 +189,7 @@ namespace triqs { namespace arrays { */ template array & operator=(const RHS & X) { - static_assert(ImmutableArray::value, "Assignment : RHS not supported"); + static_assert(ImmutableCuboidArray::value, "Assignment : RHS not supported"); IMPL_TYPE::resize(X.domain()); triqs_arrays_assign_delegation(*this,X); return *this; diff --git a/triqs/arrays/expression_template/array_algebra.hpp b/triqs/arrays/expression_template/array_algebra.hpp index 65ce4773..df7574fa 100644 --- a/triqs/arrays/expression_template/array_algebra.hpp +++ b/triqs/arrays/expression_template/array_algebra.hpp @@ -24,7 +24,7 @@ namespace triqs { namespace arrays { template - struct array_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray) { + struct array_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableArray) { typedef typename keeper_type::type L_t; typedef typename keeper_type::type R_t; static_assert( get_rank::value==0 || get_rank::value==0 || get_rank::value == get_rank::value, "rank mismatch in array operations"); @@ -43,7 +43,7 @@ namespace triqs { namespace arrays { // a special case : the unary operator ! - template struct array_unary_m_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray) { + template struct array_unary_m_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableArray) { typedef typename keeper_type::type L_t; typedef typename L_t::value_type value_type; typedef typename L_t::domain_type domain_type; @@ -64,18 +64,18 @@ namespace triqs { namespace arrays { typename std::enable_if::value && TRAIT2 ::value, array_expr>::type\ operator OP (A1 const & a1, A2 const & a2) { return array_expr(a1,a2);} -DEFINE_OPERATOR(plus, +, ImmutableCuboidArray,ImmutableCuboidArray); -DEFINE_OPERATOR(minus, -, ImmutableCuboidArray,ImmutableCuboidArray); -DEFINE_OPERATOR(multiplies, *, ImmutableCuboidArray,ImmutableCuboidArray); -DEFINE_OPERATOR(multiplies, *, is_in_ZRC,ImmutableCuboidArray); -DEFINE_OPERATOR(multiplies, *, ImmutableCuboidArray,is_in_ZRC); -DEFINE_OPERATOR(divides, /, ImmutableCuboidArray,ImmutableCuboidArray); -DEFINE_OPERATOR(divides, /, is_in_ZRC,ImmutableCuboidArray); -DEFINE_OPERATOR(divides, /, ImmutableCuboidArray,is_in_ZRC); +DEFINE_OPERATOR(plus, +, ImmutableArray,ImmutableArray); +DEFINE_OPERATOR(minus, -, ImmutableArray,ImmutableArray); +DEFINE_OPERATOR(multiplies, *, ImmutableArray,ImmutableArray); +DEFINE_OPERATOR(multiplies, *, is_in_ZRC,ImmutableArray); +DEFINE_OPERATOR(multiplies, *, ImmutableArray,is_in_ZRC); +DEFINE_OPERATOR(divides, /, ImmutableArray,ImmutableArray); +DEFINE_OPERATOR(divides, /, is_in_ZRC,ImmutableArray); +DEFINE_OPERATOR(divides, /, ImmutableArray,is_in_ZRC); #undef DEFINE_OPERATOR // the unary is special - template typename std::enable_if::value, array_unary_m_expr>::type + template typename std::enable_if::value, array_unary_m_expr>::type operator - (A1 const & a1) { return {a1};} template array diff --git a/triqs/arrays/functional/map.hpp b/triqs/arrays/functional/map.hpp index e020d233..23e3becb 100644 --- a/triqs/arrays/functional/map.hpp +++ b/triqs/arrays/functional/map.hpp @@ -48,7 +48,7 @@ namespace triqs { namespace arrays { template class m_result; - template class m_result >::type> : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray) { + template class m_result >::type> : TRIQS_CONCEPT_TAG_NAME(ImmutableArray) { public: typedef typename std::result_of::type value_type; typedef typename A::domain_type domain_type; @@ -88,7 +88,7 @@ namespace triqs { namespace arrays { template struct result { typedef m_result type;}; template< class A > m_result operator()(A const & a) const { - //static_assert( (ImmutableArray::value), "map : A does not model ImmutableArray"); + //static_assert( (ImmutableCuboidArray::value), "map : A does not model ImmutableCuboidArray"); return m_result(f,a); } @@ -104,7 +104,7 @@ namespace triqs { namespace arrays { map_impl(map_impl const &) = default; //map_impl(map_impl &&) = default; - template class m_result : TRIQS_CONCEPT_TAG_NAME(ImmutableArray) { + template class m_result : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray) { static_assert( (std::is_same::value), "type mismatch"); public: typedef typename std::result_of::type value_type; @@ -122,8 +122,8 @@ namespace triqs { namespace arrays { template struct result { typedef m_result type;}; template< class A, class B > m_result operator()(A const & a, B const & b) { - static_assert( (ImmutableArray::value), "map1 : A does not model ImmutableArray"); - static_assert( (ImmutableArray::value), "map1 : B does not model ImmutableArray"); + static_assert( (ImmutableCuboidArray::value), "map1 : A does not model ImmutableCuboidArray"); + static_assert( (ImmutableCuboidArray::value), "map1 : B does not model ImmutableCuboidArray"); return m_result(f,a,b); } diff --git a/triqs/arrays/h5/array_proxy.hpp b/triqs/arrays/h5/array_proxy.hpp index 9dc9ffae..2014dd1e 100644 --- a/triqs/arrays/h5/array_proxy.hpp +++ b/triqs/arrays/h5/array_proxy.hpp @@ -27,7 +27,7 @@ namespace triqs { namespace arrays { /// The array proxy template - class array_proxy : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray), // WRONG ! IT does not yet implement [ ] + class array_proxy : TRIQS_CONCEPT_TAG_NAME(ImmutableArray), // WRONG ! IT does not yet implement [ ] public sliceable_object < ValueType, h5::index_system, array_proxy_option, diff --git a/triqs/arrays/impl/assignment.hpp b/triqs/arrays/impl/assignment.hpp index 295e3a9b..ab42d085 100644 --- a/triqs/arrays/impl/assignment.hpp +++ b/triqs/arrays/impl/assignment.hpp @@ -114,7 +114,7 @@ namespace triqs { namespace arrays { // ----------------- assignment for expressions RHS -------------------------------------------------- template - struct impl::value && (!is_scalar_for::value) && (!is_isp::value)) > { + struct impl::value && (!is_scalar_for::value) && (!is_isp::value)) > { TRIQS_REJECT_ASSIGN_TO_CONST; TRIQS_REJECT_MATRIX_COMPOUND_MUL_DIV_NON_SCALAR; typedef typename LHS::value_type value_type; diff --git a/triqs/arrays/impl/indexmap_storage_pair.hpp b/triqs/arrays/impl/indexmap_storage_pair.hpp index 470802be..48060456 100644 --- a/triqs/arrays/impl/indexmap_storage_pair.hpp +++ b/triqs/arrays/impl/indexmap_storage_pair.hpp @@ -53,7 +53,7 @@ namespace triqs { namespace arrays { template struct ISPViewType; template - class indexmap_storage_pair : Tag::indexmap_storage_pair, TRIQS_CONCEPT_TAG_NAME(MutableArray) { + class indexmap_storage_pair : Tag::indexmap_storage_pair, TRIQS_CONCEPT_TAG_NAME(MutableCuboidArray) { public : typedef typename StorageType::value_type value_type; diff --git a/triqs/arrays/impl/traits.hpp b/triqs/arrays/impl/traits.hpp index 09197a32..22f7caec 100644 --- a/triqs/arrays/impl/traits.hpp +++ b/triqs/arrays/impl/traits.hpp @@ -29,32 +29,21 @@ namespace triqs { namespace arrays { namespace mpl=boost::mpl; - // The ImmutableArray concept - TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT(ImmutableArray); - TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MutableArray,(ImmutableArray)); + // The ImmutableCuboidArray concept + TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT(ImmutableCuboidArray); + TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MutableCuboidArray,(ImmutableCuboidArray)); - /*template struct BCC_ImmutableArray { - BOOST_CONCEPT_USAGE(BCC_ImmutableArray) - { - typename X::mc_weight_type r = i.Try(); // this is e.g. for a QMC move - r = i.Accept(); - i.Reject(); - } - private: X i; - }; -*/ - - // The ImmutableCuboidArray concept - TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(ImmutableCuboidArray,(ImmutableArray)); - TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MutableCuboidArray,(ImmutableCuboidArray)(MutableArray)); + // 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,(ImmutableArray)); - TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MutableMatrix,(ImmutableMatrix)(MutableArray)); + 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,(ImmutableArray)); - TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MutableVector,(ImmutableVector)(MutableArray)); + 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 {}; } template struct is_array : std::is_base_of {}; diff --git a/triqs/arrays/indexmaps/cuboid/domain.hpp b/triqs/arrays/indexmaps/cuboid/domain.hpp index f7bacf77..2ea41240 100644 --- a/triqs/arrays/indexmaps/cuboid/domain.hpp +++ b/triqs/arrays/indexmaps/cuboid/domain.hpp @@ -184,5 +184,11 @@ namespace PrettyPrint_details { template void pretty_print (std::ostream & out, A const & a ) { PrettyPrint_details::print_impl(out,a).print();} -}}} +} + +template +indexmaps::cuboid::domain_t make_cuboid_domain(U ... u) { return {u...};} +//cuboid_array_domain make_cuboid_domain(U ... u) { return {u...};} + +}} #endif diff --git a/triqs/arrays/indexmaps/cuboid/foreach.hpp b/triqs/arrays/indexmaps/cuboid/foreach.hpp index 2c46d5be..a3d50f7d 100644 --- a/triqs/arrays/indexmaps/cuboid/foreach.hpp +++ b/triqs/arrays/indexmaps/cuboid/foreach.hpp @@ -29,7 +29,7 @@ namespace triqs { namespace arrays { template struct get_traversal_order : std::integral_constant{}; template - typename std::enable_if::value >::type + typename std::enable_if::value >::type foreach (T const & x, Function const & F) { indexmaps::cuboid::foreach::value> (x.domain(), F); } template @@ -40,7 +40,7 @@ namespace triqs { namespace arrays { }; template - typename std::enable_if::value >::type + typename std::enable_if::value >::type assign_foreach (T & x, Function const & F) { indexmaps::cuboid::foreach::value> (x.domain(),assign_foreach_adapter(x,F)); } }}//namespace diff --git a/triqs/arrays/make_immutable_array.hpp b/triqs/arrays/make_immutable_array.hpp index 4d1df7f4..0b162163 100644 --- a/triqs/arrays/make_immutable_array.hpp +++ b/triqs/arrays/make_immutable_array.hpp @@ -26,7 +26,7 @@ namespace triqs { namespace arrays { template - class immutable_array_expr_impl : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray) { + class immutable_array_expr_impl : TRIQS_CONCEPT_TAG_NAME(ImmutableArray) { template struct _si { typedef size_t type;}; public : immutable_array_expr_impl(Expr e_, clef::pair ... p): @@ -46,7 +46,7 @@ namespace triqs { namespace arrays { * \brief Makes a lazy immutable (cuboid) array from a simple expression and a set of range... * \param expr The lazy expression * \param i_=R i_ is a placeholder, R a range. The i_=R produce a pair of i_ and R , which is the parameter. - * \return A lazy object implementing the ImmutableCuboidArray concept with the domain built from the ranges. + * \return A lazy object implementing the ImmutableArray concept with the domain built from the ranges. */ template immutable_array_expr_impl make_immutable_array( Expr const & expr, clef::pair ... p) { @@ -56,7 +56,7 @@ namespace triqs { namespace arrays { // if ones prefers to use a function... template - class immutable_array_fun_impl : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray) { + class immutable_array_fun_impl : TRIQS_CONCEPT_TAG_NAME(ImmutableArray) { template struct _si { typedef size_t type;}; public : immutable_array_fun_impl(Function f, Ranges ... r) : f_(std::move(f)), dom_(make_shape(r.size()...)) {}; diff --git a/triqs/arrays/matrix.hpp b/triqs/arrays/matrix.hpp index f7f61f96..98bdbb1a 100644 --- a/triqs/arrays/matrix.hpp +++ b/triqs/arrays/matrix.hpp @@ -133,7 +133,7 @@ namespace triqs { namespace arrays { /// Build a new matrix from X.domain() and fill it with by evaluating X. X can be : template - matrix(const T & X, TYPE_ENABLE_IF(memory_layout<2>, ImmutableArray) ml = memory_layout<2>(IMPL_TYPE::indexmap_type::traversal_order)): + matrix(const T & X, TYPE_ENABLE_IF(memory_layout<2>, ImmutableCuboidArray) ml = memory_layout<2>(IMPL_TYPE::indexmap_type::traversal_order)): IMPL_TYPE(indexmap_type(X.domain(),ml)) { triqs_arrays_assign_delegation(*this,X); } #ifdef TRIQS_WITH_PYTHON_SUPPORT @@ -181,7 +181,7 @@ namespace triqs { namespace arrays { */ template matrix & operator=(const RHS & X) { - static_assert( ImmutableArray::value, "Assignment : RHS not supported"); + static_assert( ImmutableCuboidArray::value, "Assignment : RHS not supported"); IMPL_TYPE::resize(X.domain()); triqs_arrays_assign_delegation(*this,X); return *this; diff --git a/triqs/arrays/vector.hpp b/triqs/arrays/vector.hpp index 94801669..3c6f28f9 100644 --- a/triqs/arrays/vector.hpp +++ b/triqs/arrays/vector.hpp @@ -133,8 +133,8 @@ namespace triqs { namespace arrays { * - ml : useless directly, since there only one ml, but used in generic code it maintains the same constructor as array, matrix */ template - //vector(const T & X, typename boost::enable_if< ImmutableArray >::type *dummy =0): - vector(const T & X, TYPE_ENABLE_IF(memory_layout<1>, ImmutableArray) ml = memory_layout<1>(IMPL_TYPE::indexmap_type::traversal_order)): + //vector(const T & X, typename boost::enable_if< ImmutableCuboidArray >::type *dummy =0): + vector(const T & X, TYPE_ENABLE_IF(memory_layout<1>, ImmutableCuboidArray) ml = memory_layout<1>(IMPL_TYPE::indexmap_type::traversal_order)): IMPL_TYPE(indexmap_type(X.domain(),ml)) { triqs_arrays_assign_delegation(*this,X); } #ifdef TRIQS_WITH_PYTHON_SUPPORT @@ -171,7 +171,7 @@ namespace triqs { namespace arrays { */ template vector & operator=(const RHS & X) { - static_assert( ImmutableArray::value, "Assignment : RHS not supported"); + static_assert( ImmutableCuboidArray::value, "Assignment : RHS not supported"); IMPL_TYPE::resize(X.domain()); triqs_arrays_assign_delegation(*this,X); return *this;