3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-26 06:14:14 +01:00

code cleaning

- TRIQS_MODEL_CONCEPT renamed : clearer for doc
- index_value_type : remove, useless...
This commit is contained in:
Olivier Parcollet 2013-08-23 16:49:57 +02:00
parent f71ff22ed0
commit f78e6baf9e
21 changed files with 42 additions and 52 deletions

View File

@ -23,7 +23,7 @@
namespace triqs { namespace arrays { namespace triqs { namespace arrays {
template<typename T> class immutable_diagonal_matrix_view : TRIQS_MODEL_CONCEPT(ImmutableMatrix) { template<typename T> class immutable_diagonal_matrix_view : TRIQS_CONCEPT_TAG_NAME(ImmutableMatrix) {
array_view<T,1> data; array_view<T,1> data;
public: public:

View File

@ -43,9 +43,9 @@ namespace triqs { namespace arrays {
typename A::value_type max_element(A const &a) { typename A::value_type max_element(A const &a) {
#ifdef TRIQS_FIX_CLANG30_linux #ifdef TRIQS_FIX_CLANG30_linux
typedef typename A::value_type const & T; typedef typename A::value_type const & T;
return fold ( static_cast<T(*)(T,T)>(std::max<T>)) ( a, get_first_element(a)); //a[typename A::domain_type::index_value_type()]); return fold ( static_cast<T(*)(T,T)>(std::max<T>)) ( a, get_first_element(a));
#else #else
return fold ( std::max<typename A::value_type const & >) ( a, get_first_element(a)); //a[typename A::domain_type::index_value_type()]); return fold ( std::max<typename A::value_type const & >) ( a, get_first_element(a));
#endif #endif
} }
@ -53,9 +53,9 @@ namespace triqs { namespace arrays {
typename A::value_type min_element(A const &a) { typename A::value_type min_element(A const &a) {
#ifdef TRIQS_FIX_CLANG30_linux #ifdef TRIQS_FIX_CLANG30_linux
typedef typename A::value_type const & T; typedef typename A::value_type const & T;
return fold ( static_cast<T(*)(T,T)>(std::min<T>)) ( a, get_first_element(a)); //a[typename A::domain_type::index_value_type()]); return fold ( static_cast<T(*)(T,T)>(std::min<T>)) ( a, get_first_element(a));
#else #else
return fold ( std::min<typename A::value_type const & >) ( a, get_first_element(a)); //a[typename A::domain_type::index_value_type()]); return fold ( std::min<typename A::value_type const & >) ( a, get_first_element(a));
#endif #endif
} }

View File

@ -37,7 +37,7 @@ namespace triqs { namespace arrays {
storages::shared_block<ValueType, Borrowed>, Opt, TraversalOrder, Tag::array_view > storages::shared_block<ValueType, Borrowed>, Opt, TraversalOrder, Tag::array_view >
template <typename ValueType, int Rank, ull_t Opt, ull_t TraversalOrder, bool Borrowed> template <typename ValueType, int Rank, ull_t Opt, ull_t TraversalOrder, bool Borrowed>
class array_view : Tag::array_view, TRIQS_MODEL_CONCEPT(MutableCuboidArray), public IMPL_TYPE { class array_view : Tag::array_view, TRIQS_CONCEPT_TAG_NAME(MutableCuboidArray), public IMPL_TYPE {
static_assert( Rank>0, " Rank must be >0"); static_assert( Rank>0, " Rank must be >0");
public: public:
typedef typename IMPL_TYPE::indexmap_type indexmap_type; typedef typename IMPL_TYPE::indexmap_type indexmap_type;
@ -99,7 +99,7 @@ namespace triqs { namespace arrays {
storages::shared_block<ValueType>, Opt, TraversalOrder, Tag::array_view > storages::shared_block<ValueType>, Opt, TraversalOrder, Tag::array_view >
template <typename ValueType, int Rank, ull_t Opt, ull_t TraversalOrder> template <typename ValueType, int Rank, ull_t Opt, ull_t TraversalOrder>
class array: Tag::array, TRIQS_MODEL_CONCEPT(MutableCuboidArray), public IMPL_TYPE { class array: Tag::array, TRIQS_CONCEPT_TAG_NAME(MutableCuboidArray), public IMPL_TYPE {
public: public:
typedef typename IMPL_TYPE::value_type value_type; typedef typename IMPL_TYPE::value_type value_type;
typedef typename IMPL_TYPE::storage_type storage_type; typedef typename IMPL_TYPE::storage_type storage_type;

View File

@ -24,7 +24,7 @@
namespace triqs { namespace arrays { namespace triqs { namespace arrays {
template<typename Tag, typename L, typename R> template<typename Tag, typename L, typename R>
struct array_expr : TRIQS_MODEL_CONCEPT(ImmutableCuboidArray) { struct array_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray) {
typedef typename keeper_type<L>::type L_t; typedef typename keeper_type<L>::type L_t;
typedef typename keeper_type<R>::type R_t; typedef typename keeper_type<R>::type R_t;
static_assert( get_rank<R_t>::value==0 || get_rank<L_t>::value==0 || get_rank<L_t>::value == get_rank<R_t>::value, "rank mismatch in array operations"); static_assert( get_rank<R_t>::value==0 || get_rank<L_t>::value==0 || get_rank<L_t>::value == get_rank<R_t>::value, "rank mismatch in array operations");
@ -43,7 +43,7 @@ namespace triqs { namespace arrays {
// a special case : the unary operator ! // a special case : the unary operator !
template<typename L> struct array_unary_m_expr : TRIQS_MODEL_CONCEPT(ImmutableCuboidArray) { template<typename L> struct array_unary_m_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray) {
typedef typename keeper_type<L>::type L_t; typedef typename keeper_type<L>::type L_t;
typedef typename L_t::value_type value_type; typedef typename L_t::value_type value_type;
typedef typename L_t::domain_type domain_type; typedef typename L_t::domain_type domain_type;

View File

@ -28,7 +28,7 @@
namespace triqs { namespace arrays { namespace triqs { namespace arrays {
template<typename Tag, typename L, typename R, bool scalar_are_diagonal_matrices= false> template<typename Tag, typename L, typename R, bool scalar_are_diagonal_matrices= false>
struct matrix_expr : TRIQS_MODEL_CONCEPT(ImmutableMatrix) { struct matrix_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableMatrix) {
typedef typename keeper_type<L,scalar_are_diagonal_matrices>::type L_t; typedef typename keeper_type<L,scalar_are_diagonal_matrices>::type L_t;
typedef typename keeper_type<R,scalar_are_diagonal_matrices>::type R_t; typedef typename keeper_type<R,scalar_are_diagonal_matrices>::type R_t;
static_assert( get_rank<R_t>::value==0 || get_rank<L_t>::value==0 || get_rank<L_t>::value == get_rank<R_t>::value, "rank mismatch in matrix operations"); static_assert( get_rank<R_t>::value==0 || get_rank<L_t>::value==0 || get_rank<L_t>::value == get_rank<R_t>::value, "rank mismatch in matrix operations");
@ -46,7 +46,7 @@ namespace triqs { namespace arrays {
}; };
template<typename L> // a special case : the unary operator ! template<typename L> // a special case : the unary operator !
struct matrix_unary_m_expr : TRIQS_MODEL_CONCEPT(ImmutableMatrix) { struct matrix_unary_m_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableMatrix) {
typedef typename keeper_type<L>::type L_t; typedef typename keeper_type<L>::type L_t;
typedef typename L_t::value_type value_type; typedef typename L_t::value_type value_type;
typedef typename L_t::domain_type domain_type; typedef typename L_t::domain_type domain_type;

View File

@ -25,7 +25,7 @@
namespace triqs { namespace arrays { namespace triqs { namespace arrays {
template<typename Tag, typename L, typename R> template<typename Tag, typename L, typename R>
struct vector_expr : TRIQS_MODEL_CONCEPT(ImmutableVector) { struct vector_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableVector) {
typedef typename keeper_type<L>::type L_t; typedef typename keeper_type<L>::type L_t;
typedef typename keeper_type<R>::type R_t; typedef typename keeper_type<R>::type R_t;
L_t l; R_t r; L_t l; R_t r;
@ -44,7 +44,7 @@ namespace triqs { namespace arrays {
}; };
template<typename L> // a special case : the unary operator ! template<typename L> // a special case : the unary operator !
struct vector_unary_m_expr : TRIQS_MODEL_CONCEPT(ImmutableVector) { struct vector_unary_m_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableVector) {
typedef typename keeper_type<L>::type L_t; typedef typename keeper_type<L>::type L_t;
L_t l; L_t l;
template<typename LL> vector_unary_m_expr(LL && l_) : l(std::forward<LL>(l_)) {} template<typename LL> vector_unary_m_expr(LL && l_) : l(std::forward<LL>(l_)) {}

View File

@ -48,7 +48,7 @@ namespace triqs { namespace arrays {
template<typename A, typename Enable = void> class m_result; template<typename A, typename Enable = void> class m_result;
template<typename A> class m_result<A,typename boost::enable_if<ImmutableCuboidArray<A> >::type> : TRIQS_MODEL_CONCEPT(ImmutableCuboidArray) { template<typename A> class m_result<A,typename boost::enable_if<ImmutableCuboidArray<A> >::type> : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray) {
public: public:
typedef typename std::result_of<F(typename A::value_type)>::type value_type; typedef typename std::result_of<F(typename A::value_type)>::type value_type;
typedef typename A::domain_type domain_type; typedef typename A::domain_type domain_type;
@ -56,11 +56,10 @@ namespace triqs { namespace arrays {
m_result(F const & f_, A const & a_):a(a_),f(f_) {} m_result(F const & f_, A const & a_):a(a_),f(f_) {}
domain_type domain() const { return a.domain(); } domain_type domain() const { return a.domain(); }
template<typename ... Args> value_type operator() (Args const & ... args) const { return f(a(args...)); } template<typename ... Args> value_type operator() (Args const & ... args) const { return f(a(args...)); }
//value_type operator[] ( typename domain_type::index_value_type const & key) const { return f(a[key]); }
friend std::ostream & operator<<(std::ostream & out, m_result const & x){ return out<<"lazy matrix resulting of a mapping";} friend std::ostream & operator<<(std::ostream & out, m_result const & x){ return out<<"lazy matrix resulting of a mapping";}
}; };
template<typename A> class m_result<A,typename boost::enable_if<ImmutableMatrix<A> >::type> : TRIQS_MODEL_CONCEPT(ImmutableMatrix) { template<typename A> class m_result<A,typename boost::enable_if<ImmutableMatrix<A> >::type> : TRIQS_CONCEPT_TAG_NAME(ImmutableMatrix) {
public: public:
typedef typename std::result_of<F(typename A::value_type)>::type value_type; typedef typename std::result_of<F(typename A::value_type)>::type value_type;
typedef typename A::domain_type domain_type; typedef typename A::domain_type domain_type;
@ -68,11 +67,10 @@ namespace triqs { namespace arrays {
m_result(F const & f_, A const & a_):a(a_),f(f_) {} m_result(F const & f_, A const & a_):a(a_),f(f_) {}
domain_type domain() const { return a.domain(); } domain_type domain() const { return a.domain(); }
template<typename ... Args> value_type operator() (Args const & ... args) const { return f(a(args...)); } template<typename ... Args> value_type operator() (Args const & ... args) const { return f(a(args...)); }
//value_type operator[] ( typename domain_type::index_value_type const & key) const { return f(a[key]); }
friend std::ostream & operator<<(std::ostream & out, m_result const & x){ return out<<"lazy matrix resulting of a mapping";} friend std::ostream & operator<<(std::ostream & out, m_result const & x){ return out<<"lazy matrix resulting of a mapping";}
}; };
template<typename A> class m_result<A,typename boost::enable_if<ImmutableVector<A> >::type> : TRIQS_MODEL_CONCEPT(ImmutableVector) { template<typename A> class m_result<A,typename boost::enable_if<ImmutableVector<A> >::type> : TRIQS_CONCEPT_TAG_NAME(ImmutableVector) {
public: public:
typedef typename std::result_of<F(typename A::value_type)>::type value_type; typedef typename std::result_of<F(typename A::value_type)>::type value_type;
typedef typename A::domain_type domain_type; typedef typename A::domain_type domain_type;
@ -81,7 +79,6 @@ namespace triqs { namespace arrays {
domain_type domain() const { return a.domain(); } domain_type domain() const { return a.domain(); }
size_t size() const { return a.size();} size_t size() const { return a.size();}
template<typename ... Args> value_type operator() (Args const & ... args) const { return f(a(args...)); } template<typename ... Args> value_type operator() (Args const & ... args) const { return f(a(args...)); }
//value_type operator[] ( typename domain_type::index_value_type const & key) const { return f(a[key]); }
value_type operator() ( size_t i) const { return f(a(i)); } value_type operator() ( size_t i) const { return f(a(i)); }
friend std::ostream & operator<<(std::ostream & out, m_result const & x){ return out<<"lazy matrix resulting of a mapping";} friend std::ostream & operator<<(std::ostream & out, m_result const & x){ return out<<"lazy matrix resulting of a mapping";}
}; };
@ -107,7 +104,7 @@ namespace triqs { namespace arrays {
map_impl(map_impl const &) = default; map_impl(map_impl const &) = default;
//map_impl(map_impl &&) = default; //map_impl(map_impl &&) = default;
template<class A, class B> class m_result : TRIQS_MODEL_CONCEPT(ImmutableArray) { template<class A, class B> class m_result : TRIQS_CONCEPT_TAG_NAME(ImmutableArray) {
static_assert( (std::is_same<typename A::domain_type, typename B::domain_type>::value), "type mismatch"); static_assert( (std::is_same<typename A::domain_type, typename B::domain_type>::value), "type mismatch");
public: public:
typedef typename std::result_of<F(typename A::value_type,typename B::value_type)>::type value_type; typedef typename std::result_of<F(typename A::value_type,typename B::value_type)>::type value_type;
@ -118,7 +115,6 @@ namespace triqs { namespace arrays {
} }
domain_type domain() const { return a.domain(); } domain_type domain() const { return a.domain(); }
template<typename ... Args> value_type operator() (Args const & ... args) const { return f(a(args...),b(args...)); } template<typename ... Args> value_type operator() (Args const & ... args) const { return f(a(args...),b(args...)); }
//value_type operator[] ( typename domain_type::index_value_type const & key) const { return f(a[key],b[key]); }
friend std::ostream & operator<<(std::ostream & out, m_result const & x){ return out<<"lazy matrix resulting of a mapping";} friend std::ostream & operator<<(std::ostream & out, m_result const & x){ return out<<"lazy matrix resulting of a mapping";}
}; };

View File

@ -27,7 +27,7 @@ namespace triqs { namespace arrays {
/// The array proxy /// The array proxy
template<typename ValueType, int Rank, int Rank_f = Rank > template<typename ValueType, int Rank, int Rank_f = Rank >
class array_proxy : TRIQS_MODEL_CONCEPT(ImmutableCuboidArray), // WRONG ! IT does not yet implement [ ] class array_proxy : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray), // WRONG ! IT does not yet implement [ ]
public sliceable_object < ValueType, public sliceable_object < ValueType,
h5::index_system<Rank,Rank_f>, h5::index_system<Rank,Rank_f>,
array_proxy_option<Rank_f>, array_proxy_option<Rank_f>,

View File

@ -83,13 +83,11 @@ namespace triqs { namespace arrays {
typedef typename LHS::value_type value_type; typedef typename LHS::value_type value_type;
typedef typename LHS::indexmap_type indexmap_type; typedef typename LHS::indexmap_type indexmap_type;
typedef typename indexmap_type::domain_type::index_value_type index_value_type;
LHS & lhs; const RHS & rhs; LHS & lhs; const RHS & rhs;
typedef typename std::remove_cv<value_type>::type v_t; typedef typename std::remove_cv<value_type>::type v_t;
impl(LHS & lhs_, const RHS & rhs_): lhs(lhs_), rhs(rhs_) {} impl(LHS & lhs_, const RHS & rhs_): lhs(lhs_), rhs(rhs_) {}
template<typename ... Args> void operator()(Args const & ... args) const { template<typename ... Args> void operator()(Args const & ... args) const {
// void operator()(value_type & p, index_value_type const & key) {
_ops_<typename std::remove_cv<value_type>::type, typename RHS::value_type, OP>::invoke(lhs(args...), rhs(args...)) ;} _ops_<typename std::remove_cv<value_type>::type, typename RHS::value_type, OP>::invoke(lhs(args...), rhs(args...)) ;}
void invoke () { void invoke () {
@ -120,12 +118,10 @@ namespace triqs { namespace arrays {
TRIQS_REJECT_ASSIGN_TO_CONST; TRIQS_REJECT_ASSIGN_TO_CONST;
TRIQS_REJECT_MATRIX_COMPOUND_MUL_DIV_NON_SCALAR; TRIQS_REJECT_MATRIX_COMPOUND_MUL_DIV_NON_SCALAR;
typedef typename LHS::value_type value_type; typedef typename LHS::value_type value_type;
typedef typename LHS::indexmap_type::domain_type::index_value_type index_value_type;
LHS & lhs; const RHS & rhs; LHS & lhs; const RHS & rhs;
//value_type & restrict p; //value_type & restrict p;
impl(LHS & lhs_, const RHS & rhs_): lhs(lhs_), rhs(rhs_) {} //, p(*(lhs_.data_start())) {} impl(LHS & lhs_, const RHS & rhs_): lhs(lhs_), rhs(rhs_) {} //, p(*(lhs_.data_start())) {}
template<typename ... Args> void operator()(Args const & ... args) const { _ops_<value_type, typename RHS::value_type, OP>::invoke(lhs(args...),rhs(args...));} template<typename ... Args> void operator()(Args const & ... args) const { _ops_<value_type, typename RHS::value_type, OP>::invoke(lhs(args...),rhs(args...));}
/// void operator()(value_type & p, index_value_type const & key) const { _ops_<value_type, typename RHS::value_type, OP>::invoke(p,rhs[key]);}
void invoke() { void invoke() {
#ifdef TRIQS_ARRAYS_ASSIGN_ISP_WITH_FOREACH #ifdef TRIQS_ARRAYS_ASSIGN_ISP_WITH_FOREACH
foreach(lhs,*this); foreach(lhs,*this);

View File

@ -53,7 +53,7 @@ namespace triqs { namespace arrays {
template <class V, int R, ull_t OptionFlags, ull_t TraversalOrder, class ViewTag, bool Borrowed > struct ISPViewType; template <class V, int R, ull_t OptionFlags, ull_t TraversalOrder, class ViewTag, bool Borrowed > struct ISPViewType;
template <typename IndexMapType, typename StorageType, ull_t OptionFlags, ull_t TraversalOrder, typename ViewTag > template <typename IndexMapType, typename StorageType, ull_t OptionFlags, ull_t TraversalOrder, typename ViewTag >
class indexmap_storage_pair : Tag::indexmap_storage_pair, TRIQS_MODEL_CONCEPT(MutableArray) { class indexmap_storage_pair : Tag::indexmap_storage_pair, TRIQS_CONCEPT_TAG_NAME(MutableArray) {
public : public :
typedef typename StorageType::value_type value_type; typedef typename StorageType::value_type value_type;

View File

@ -39,7 +39,7 @@ namespace triqs { namespace arrays {
//------------- IMPLEMENTATION ----------------------------------- //------------- IMPLEMENTATION -----------------------------------
template<typename ScalarType, typename VectorType1, typename VectorType2> template<typename ScalarType, typename VectorType1, typename VectorType2>
class a_x_ty_lazy : TRIQS_MODEL_CONCEPT(ImmutableMatrix) { class a_x_ty_lazy : TRIQS_CONCEPT_TAG_NAME(ImmutableMatrix) {
typedef typename boost::remove_const<typename VectorType1::value_type>::type V1; typedef typename boost::remove_const<typename VectorType1::value_type>::type V1;
typedef typename boost::remove_const<typename VectorType2::value_type>::type V2; typedef typename boost::remove_const<typename VectorType2::value_type>::type V2;
static_assert((boost::is_same<V1,V2>::value),"Different values : not implemented"); static_assert((boost::is_same<V1,V2>::value),"Different values : not implemented");

View File

@ -110,10 +110,9 @@ namespace triqs { namespace arrays {
//----------------------------------------------------------- //-----------------------------------------------------------
// an implementation class to gather the common part to matrix and expression.... // an implementation class to gather the common part to matrix and expression....
template<typename A> struct inverse_lazy_impl : TRIQS_MODEL_CONCEPT(ImmutableMatrix) { template<typename A> struct inverse_lazy_impl : TRIQS_CONCEPT_TAG_NAME(ImmutableMatrix) {
typedef typename std::remove_const<typename A::value_type>::type value_type; typedef typename std::remove_const<typename A::value_type>::type value_type;
typedef typename A::domain_type domain_type; typedef typename A::domain_type domain_type;
typedef typename domain_type::index_value_type index_value_type;
typedef typename const_view_type_if_exists_else_type<A>::type A_type; typedef typename const_view_type_if_exists_else_type<A>::type A_type;
const A_type a; const A_type a;
inverse_lazy_impl(A const & a_):a (a_) { inverse_lazy_impl(A const & a_):a (a_) {

View File

@ -37,7 +37,7 @@ namespace triqs { namespace arrays {
// ----------------- implementation ----------------------------------------- // ----------------- implementation -----------------------------------------
template<typename MT, typename VT> template<typename MT, typename VT>
class mat_vec_mul_lazy : TRIQS_MODEL_CONCEPT(ImmutableVector) { class mat_vec_mul_lazy : TRIQS_CONCEPT_TAG_NAME(ImmutableVector) {
typedef typename MT::value_type V1; typedef typename MT::value_type V1;
typedef typename VT::value_type V2; typedef typename VT::value_type V2;

View File

@ -32,7 +32,7 @@ namespace triqs { namespace arrays {
// ----------------- implementation ----------------------------------------- // ----------------- implementation -----------------------------------------
template<typename A, typename B> class matmul_lazy : TRIQS_MODEL_CONCEPT(ImmutableMatrix) { template<typename A, typename B> class matmul_lazy : TRIQS_CONCEPT_TAG_NAME(ImmutableMatrix) {
typedef typename boost::remove_const<typename A::value_type>::type V1; typedef typename boost::remove_const<typename A::value_type>::type V1;
typedef typename boost::remove_const<typename B::value_type>::type V2; typedef typename boost::remove_const<typename B::value_type>::type V2;
//static_assert((boost::is_same<V1,V2>::value),"Different values : not implemented"); //static_assert((boost::is_same<V1,V2>::value),"Different values : not implemented");
@ -61,7 +61,6 @@ namespace triqs { namespace arrays {
} }
domain_type domain() const { return mini_vector<size_t,2>(first_dim(a), second_dim(b));} domain_type domain() const { return mini_vector<size_t,2>(first_dim(a), second_dim(b));}
//domain_type domain() const { return indexmaps::cuboid::domain_t<2>(mini_vector<size_t,2>(first_dim(a), second_dim(b)));}
template<typename K0, typename K1> value_type operator() (K0 const & k0, K1 const & k1) const { activate(); return _id->R(k0,k1); } template<typename K0, typename K1> value_type operator() (K0 const & k0, K1 const & k1) const { activate(); return _id->R(k0,k1); }

View File

@ -24,7 +24,7 @@
namespace triqs { namespace arrays { namespace triqs { namespace arrays {
template<typename Expr, int ... ph> template<typename Expr, int ... ph>
class immutable_array_impl : TRIQS_MODEL_CONCEPT(ImmutableCuboidArray) { class immutable_array_impl : TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray) {
template<int I> struct _si { typedef size_t type;}; template<int I> struct _si { typedef size_t type;};
public : public :
immutable_array_impl(Expr e_, clef::pair<ph,range> ... p): immutable_array_impl(Expr e_, clef::pair<ph,range> ... p):

View File

@ -47,7 +47,7 @@ namespace triqs { namespace arrays {
storages::shared_block<ValueType,Borrowed>, Opt, TraversalOrder, Tag::matrix_view > storages::shared_block<ValueType,Borrowed>, Opt, TraversalOrder, Tag::matrix_view >
template <typename ValueType, ull_t Opt, ull_t TraversalOrder, bool Borrowed> template <typename ValueType, ull_t Opt, ull_t TraversalOrder, bool Borrowed>
class matrix_view : Tag::matrix_view, TRIQS_MODEL_CONCEPT(MutableMatrix), public IMPL_TYPE { class matrix_view : Tag::matrix_view, TRIQS_CONCEPT_TAG_NAME(MutableMatrix), public IMPL_TYPE {
public : public :
typedef matrix <ValueType,Opt,TraversalOrder> regular_type; typedef matrix <ValueType,Opt,TraversalOrder> regular_type;
typedef matrix_view<ValueType,Opt,TraversalOrder> view_type; typedef matrix_view<ValueType,Opt,TraversalOrder> view_type;
@ -105,7 +105,7 @@ namespace triqs { namespace arrays {
storages::shared_block<ValueType>, Opt, TraversalOrder, Tag::matrix_view > storages::shared_block<ValueType>, Opt, TraversalOrder, Tag::matrix_view >
template <typename ValueType, ull_t Opt, ull_t TraversalOrder > template <typename ValueType, ull_t Opt, ull_t TraversalOrder >
class matrix: Tag::matrix, TRIQS_MODEL_CONCEPT(MutableMatrix), public IMPL_TYPE { class matrix: Tag::matrix, TRIQS_CONCEPT_TAG_NAME(MutableMatrix), public IMPL_TYPE {
public : public :
typedef typename IMPL_TYPE::value_type value_type; typedef typename IMPL_TYPE::value_type value_type;
typedef typename IMPL_TYPE::storage_type storage_type; typedef typename IMPL_TYPE::storage_type storage_type;

View File

@ -35,7 +35,7 @@ namespace triqs { namespace arrays {
#ifdef DO_NOT_DEFINE_ME #ifdef DO_NOT_DEFINE_ME
// human version of the class, the preprocessor generalisation is next.. // human version of the class, the preprocessor generalisation is next..
template<typename ArrayType > class const_matrix_view_proxy<ArrayType,2> : TRIQS_MODEL_CONCEPT(ImmutableMatrix) { template<typename ArrayType > class const_matrix_view_proxy<ArrayType,2> : TRIQS_CONCEPT_TAG_NAME(ImmutableMatrix) {
ArrayType const * A; size_t n; ArrayType const * A; size_t n;
public : public :
typedef typename ArrayType::value_type value_type; typedef typename ArrayType::value_type value_type;
@ -51,7 +51,7 @@ namespace triqs { namespace arrays {
{ return (*A)( std::forward<A0>(a0) , std::forward<A1>(a1) , n,std::forward<Args>(args)...);} { return (*A)( std::forward<A0>(a0) , std::forward<A1>(a1) , n,std::forward<Args>(args)...);}
}; };
template<typename ArrayType > class matrix_view_proxy<ArrayType,2> : TRIQS_MODEL_CONCEPT(MutableMatrix) { template<typename ArrayType > class matrix_view_proxy<ArrayType,2> : TRIQS_CONCEPT_TAG_NAME(MutableMatrix) {
ArrayType * A; size_t n; ArrayType * A; size_t n;
public : public :
typedef typename ArrayType::value_type value_type; typedef typename ArrayType::value_type value_type;
@ -73,7 +73,7 @@ namespace triqs { namespace arrays {
#define AUX1(z,P,NNN) A##P && a##P, #define AUX1(z,P,NNN) A##P && a##P,
#define TEXT(z, n, text) text #define TEXT(z, n, text) text
#define IMPL(z, POS, unused)\ #define IMPL(z, POS, unused)\
template<typename ArrayType > class const_matrix_view_proxy<ArrayType,POS> : TRIQS_MODEL_CONCEPT(ImmutableMatrix) {\ template<typename ArrayType > class const_matrix_view_proxy<ArrayType,POS> : TRIQS_CONCEPT_TAG_NAME(ImmutableMatrix) {\
static_assert(ArrayType::rank==3, "Only array of rank 3 here");\ static_assert(ArrayType::rank==3, "Only array of rank 3 here");\
ArrayType const * A; size_t n;\ ArrayType const * A; size_t n;\
public :\ public :\
@ -98,7 +98,7 @@ namespace triqs { namespace arrays {
friend std::ostream & operator <<(std::ostream & out, const_matrix_view_proxy const & x) { return out << matrix_view<value_type>(x);}\ friend std::ostream & operator <<(std::ostream & out, const_matrix_view_proxy const & x) { return out << matrix_view<value_type>(x);}\
};\ };\
\ \
template<typename ArrayType > class matrix_view_proxy<ArrayType,POS> : TRIQS_MODEL_CONCEPT(MutableMatrix) {\ template<typename ArrayType > class matrix_view_proxy<ArrayType,POS> : TRIQS_CONCEPT_TAG_NAME(MutableMatrix) {\
static_assert(ArrayType::rank==3, "Only array of rank 3 here");\ static_assert(ArrayType::rank==3, "Only array of rank 3 here");\
ArrayType * A; size_t n;\ ArrayType * A; size_t n;\
public :\ public :\

View File

@ -38,7 +38,7 @@ namespace triqs { namespace arrays {
/** */ /** */
template <typename ValueType, ull_t Opt, bool Borrowed> template <typename ValueType, ull_t Opt, bool Borrowed>
class vector_view : Tag::vector_view, TRIQS_MODEL_CONCEPT(MutableVector), public IMPL_TYPE { class vector_view : Tag::vector_view, TRIQS_CONCEPT_TAG_NAME(MutableVector), public IMPL_TYPE {
public : public :
typedef vector <ValueType,Opt> regular_type; typedef vector <ValueType,Opt> regular_type;
typedef vector_view<ValueType,Opt,false> view_type; typedef vector_view<ValueType,Opt,false> view_type;
@ -101,7 +101,7 @@ namespace triqs { namespace arrays {
#define IMPL_TYPE indexmap_storage_pair< indexmaps::cuboid::map<1,Opt,0> , storages::shared_block<ValueType>, Opt, 0, Tag::vector_view > #define IMPL_TYPE indexmap_storage_pair< indexmaps::cuboid::map<1,Opt,0> , storages::shared_block<ValueType>, Opt, 0, Tag::vector_view >
template <typename ValueType, ull_t Opt> template <typename ValueType, ull_t Opt>
class vector: Tag::vector, TRIQS_MODEL_CONCEPT(MutableVector), public IMPL_TYPE { class vector: Tag::vector, TRIQS_CONCEPT_TAG_NAME(MutableVector), public IMPL_TYPE {
public : public :
typedef typename IMPL_TYPE::value_type value_type; typedef typename IMPL_TYPE::value_type value_type;
typedef typename IMPL_TYPE::storage_type storage_type; typedef typename IMPL_TYPE::storage_type storage_type;

View File

@ -93,7 +93,7 @@ namespace triqs { namespace gfs {
/// A common implementation class for gf and gf_view. They will only redefine contructor and = ... /// A common implementation class for gf and gf_view. They will only redefine contructor and = ...
template<typename Variable, typename Target, typename Opt, bool IsView> class gf_impl : template<typename Variable, typename Target, typename Opt, bool IsView> class gf_impl :
TRIQS_MODEL_CONCEPT(ImmutableGreenFunction), gf_tag<gf_desc<Variable,Target,Opt>> { TRIQS_CONCEPT_TAG_NAME(ImmutableGreenFunction), gf_tag<gf_desc<Variable,Target,Opt>> {
public : public :
// Pattern : ValueView // Pattern : ValueView

View File

@ -48,7 +48,7 @@ namespace triqs { namespace gfs {
template<typename T> struct keeper_type : std::conditional<utility::is_in_ZRC<T>::value, scalar_wrap<T>, typename view_type_if_exists_else_type<T>::type> {}; template<typename T> struct keeper_type : std::conditional<utility::is_in_ZRC<T>::value, scalar_wrap<T>, typename view_type_if_exists_else_type<T>::type> {};
}// gfs_expr_tools }// gfs_expr_tools
template<typename Descriptor, typename Tag, typename L, typename R> struct gf_expr : TRIQS_MODEL_CONCEPT(ImmutableGreenFunction),gf_tag<Descriptor> { template<typename Descriptor, typename Tag, typename L, typename R> struct gf_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableGreenFunction),gf_tag<Descriptor> {
typedef typename gfs_expr_tools::keeper_type<L>::type L_t; typedef typename gfs_expr_tools::keeper_type<L>::type L_t;
typedef typename gfs_expr_tools::keeper_type<R>::type R_t; typedef typename gfs_expr_tools::keeper_type<R>::type R_t;
typedef Descriptor descriptor_t; typedef Descriptor descriptor_t;
@ -70,7 +70,7 @@ namespace triqs { namespace gfs {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//a special case : the unary operator ! //a special case : the unary operator !
template<typename Descriptor, typename L> struct gf_unary_m_expr : TRIQS_MODEL_CONCEPT(ImmutableGreenFunction),gf_tag<Descriptor>{ template<typename Descriptor, typename L> struct gf_unary_m_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableGreenFunction),gf_tag<Descriptor>{
typedef typename gfs_expr_tools::keeper_type<L>::type L_t; typedef typename gfs_expr_tools::keeper_type<L>::type L_t;
typedef Descriptor descriptor_t; typedef Descriptor descriptor_t;
//typedef typename L_t::value_type value_type; //typedef typename L_t::value_type value_type;

View File

@ -25,19 +25,19 @@
#include <boost/type_traits/is_base_of.hpp> #include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/is_complex.hpp> #include <boost/type_traits/is_complex.hpp>
#define TRIQS_CONCEPT_TAGNAME(MyBeautifulConcept) MyBeautifulConcept##__concept_tag #define TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept) MyBeautifulConcept##__concept_tag
#define TRIQS_MODEL_CONCEPT(MyBeautifulConcept) TRIQS_CONCEPT_TAGNAME(MyBeautifulConcept) //#define TRIQS_MODEL_CONCEPT(MyBeautifulConcept) TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept)
#define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT(MyBeautifulConcept) \ #define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT(MyBeautifulConcept) \
struct TRIQS_CONCEPT_TAGNAME(MyBeautifulConcept) {};\ struct TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept) {};\
template<typename T> struct MyBeautifulConcept : boost::is_base_of<TRIQS_CONCEPT_TAGNAME(MyBeautifulConcept) , T> {}; template<typename T> struct MyBeautifulConcept : boost::is_base_of<TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept) , T> {};
#define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R_AUX(r, data, i, elem) BOOST_PP_COMMA_IF(i) TRIQS_CONCEPT_TAGNAME(elem) #define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R_AUX(r, data, i, elem) BOOST_PP_COMMA_IF(i) TRIQS_CONCEPT_TAG_NAME(elem)
#define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MyBeautifulConcept,Rs) \ #define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MyBeautifulConcept,Rs) \
struct TRIQS_CONCEPT_TAGNAME(MyBeautifulConcept) : BOOST_PP_SEQ_FOR_EACH_I (TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R_AUX,nil,Rs) {};\ struct TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept) : BOOST_PP_SEQ_FOR_EACH_I (TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R_AUX,nil,Rs) {};\
template<typename T> struct MyBeautifulConcept : boost::is_base_of<TRIQS_CONCEPT_TAGNAME(MyBeautifulConcept), T> {}; template<typename T> struct MyBeautifulConcept : boost::is_base_of<TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept), T> {};
#ifdef TRIQS_COMPILE_TIME_DEBUG #ifdef TRIQS_COMPILE_TIME_DEBUG
#define TRIQS_ASSERT_MODEL_CONCEPT(MyBeautifulConcept,T) BOOST_CONCEPT_ASSERT((BCC_##MyBeautifulConcept<T>)); #define TRIQS_ASSERT_MODEL_CONCEPT(MyBeautifulConcept,T) BOOST_CONCEPT_ASSERT((BCC_##MyBeautifulConcept<T>));