mirror of
https://github.com/triqs/dft_tools
synced 2024-12-25 13:53:40 +01:00
arrays: rm tags file and some cleaning
- tags are defined in files, this impl/tags.hpp was not needed any more. - some code cleaning
This commit is contained in:
parent
6fa737978e
commit
241d5636d7
@ -29,6 +29,8 @@
|
||||
|
||||
namespace triqs { namespace arrays {
|
||||
|
||||
namespace Tag {struct indexmap_storage_pair{}; }// defined here since needed below...
|
||||
|
||||
namespace assignment { template<typename LHS, typename RHS, char OP, typename Enable = void> struct impl; }
|
||||
|
||||
// puts the contents of RHS into LHS. LHS must be an indexmap_storage_pair
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/type_traits/is_complex.hpp>
|
||||
#include <triqs/utility/compiler_details.hpp>
|
||||
#include "./tags.hpp"
|
||||
#include "./traits.hpp"
|
||||
#include <triqs/utility/macros.hpp>
|
||||
|
||||
|
@ -25,6 +25,8 @@ namespace triqs { namespace arrays {
|
||||
|
||||
typedef unsigned long long ull_t;
|
||||
|
||||
namespace Tag {struct no_init {}; struct default_init {};}
|
||||
|
||||
// Flags is a 64 bit unsigned int.
|
||||
// 0 is the default option.
|
||||
// Meaning of the bits :
|
||||
|
@ -40,7 +40,7 @@ namespace triqs { namespace arrays {
|
||||
|
||||
template <bool Const, typename IndexMapIterator, typename StorageType > class iterator_adapter;
|
||||
|
||||
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 >
|
||||
class indexmap_storage_pair : Tag::indexmap_storage_pair, TRIQS_MODEL_CONCEPT(MutableArray) {
|
||||
@ -61,38 +61,23 @@ namespace triqs { namespace arrays {
|
||||
// ------------------------------- constructors --------------------------------------------
|
||||
|
||||
indexmap_storage_pair() {}
|
||||
|
||||
indexmap_storage_pair (const indexmap_type & IM, const storage_type & ST):
|
||||
indexmap_(IM),storage_(ST){
|
||||
//std::cerr << " construct ISP "<< storage_type::is_weak<< std::endl;
|
||||
#ifdef TRIQS_ARRAYS_CHECK_IM_STORAGE_COMPAT
|
||||
if (ST.size() != IM.domain().number_of_elements())
|
||||
TRIQS_RUNTIME_ERROR<<"index_storage_pair construction : storage and indices are not compatible";
|
||||
#endif
|
||||
}
|
||||
|
||||
indexmap_storage_pair (indexmap_type && IM, storage_type && ST):
|
||||
indexmap_(std::move(IM)),storage_(std::move(ST)){
|
||||
//std::cerr << " construct ISP && IM, && ST "<< storage_type::is_weak<< std::endl;
|
||||
#ifdef TRIQS_ARRAYS_CHECK_IM_STORAGE_COMPAT
|
||||
if (ST.size() != IM.domain().number_of_elements())
|
||||
TRIQS_RUNTIME_ERROR<<"index_storage_pair construction : storage and indices are not compatible";
|
||||
#endif
|
||||
}
|
||||
|
||||
indexmap_storage_pair (indexmap_type const & IM, storage_type && ST):
|
||||
indexmap_(IM),storage_(std::move(ST)){
|
||||
//std::cerr << " construct ISP && ST "<< storage_type::is_weak<< std::endl;
|
||||
#ifdef TRIQS_ARRAYS_CHECK_IM_STORAGE_COMPAT
|
||||
if (ST.size() != IM.domain().number_of_elements())
|
||||
TRIQS_RUNTIME_ERROR<<"index_storage_pair construction : storage and indices are not compatible";
|
||||
#endif
|
||||
}
|
||||
indexmap_storage_pair (indexmap_type const & IM, storage_type const & ST): indexmap_(IM),storage_(ST) {deleg(IM,ST);}
|
||||
indexmap_storage_pair (indexmap_type && IM, storage_type && ST) : indexmap_(std::move(IM)),storage_(std::move(ST)){deleg(IM,ST);}
|
||||
indexmap_storage_pair (indexmap_type const & IM, storage_type && ST) : indexmap_(IM),storage_(std::move(ST)) {deleg(IM,ST);}
|
||||
|
||||
/// The storage is allocated from the size of IM.
|
||||
indexmap_storage_pair (const indexmap_type & IM): indexmap_(IM),storage_(){
|
||||
this->storage_ = StorageType(this->indexmap_.domain().number_of_elements(), typename flags::init_tag<OptionFlags>::type() );
|
||||
}
|
||||
|
||||
private :
|
||||
void deleg (const indexmap_type & IM, const storage_type & ST) {
|
||||
//std::cerr << " construct ISP && ST "<< storage_type::is_weak<< std::endl;
|
||||
#ifdef TRIQS_ARRAYS_CHECK_IM_STORAGE_COMPAT
|
||||
if (ST.size() != IM.domain().number_of_elements())
|
||||
TRIQS_RUNTIME_ERROR<<"index_storage_pair construction : storage and indices are not compatible";
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
/// Shallow copy
|
||||
@ -228,10 +213,10 @@ namespace triqs { namespace arrays {
|
||||
/// Equivalent to make_view
|
||||
typename ISPViewType<value_type,domain_type::rank, OptionFlags | ConstView, TraversalOrder, ViewTag, true >::type
|
||||
operator()() const & { return *this; }
|
||||
|
||||
|
||||
typename ISPViewType<value_type,domain_type::rank, OptionFlags, TraversalOrder, ViewTag, true >::type
|
||||
operator()() & { return *this; }
|
||||
|
||||
|
||||
typename ISPViewType<value_type,domain_type::rank, OptionFlags, TraversalOrder, ViewTag, StorageType::is_weak >::type
|
||||
operator()() && { return *this; }
|
||||
|
||||
@ -257,12 +242,12 @@ namespace triqs { namespace arrays {
|
||||
//typename ISPViewType<typename std::add_const<value_type>::type,domain_type::rank, OptionFlags, TraversalOrder, ViewTag >::type
|
||||
typename ISPViewType<value_type,domain_type::rank, OptionFlags, TraversalOrder, ViewTag, false >::type
|
||||
operator()() const { return *this; }
|
||||
|
||||
|
||||
typename ISPViewType<value_type,domain_type::rank, OptionFlags, TraversalOrder, ViewTag, false >::type
|
||||
operator()() { return *this; }
|
||||
|
||||
|
||||
#endif
|
||||
// Interaction with the CLEF library : calling with any clef expression as argument build a new clef expression
|
||||
// Interaction with the CLEF library : calling with any clef expression as argument build a new clef expression
|
||||
// NB : this is ok because indexmap_storage_pair has a shallow copy constructor ...
|
||||
// so A(i_) if A is an array will NOT copy the data....
|
||||
template< typename... Args>
|
||||
|
@ -1,34 +0,0 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef TRIQS_ARRAYS_IMPL_TAGS_H
|
||||
#define TRIQS_ARRAYS_IMPL_TAGS_H
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
|
||||
namespace triqs { namespace arrays {
|
||||
namespace Tag {
|
||||
struct indexmap_storage_pair{};
|
||||
struct no_init {}; struct nan_inf_init {}; struct default_init {};
|
||||
struct h5_array_proxy {};
|
||||
}
|
||||
|
||||
}}//namespace triqs::arrays
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user