From 3975edea2089b430488e563ab57694bd3ea05b6e Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Wed, 28 Jul 2021 20:59:31 +0200 Subject: [PATCH] rename MultiArray + pre-processor variables --- src/include/allocator.h | 4 +- src/include/arith.h | 4 +- src/include/base_def.h | 4 +- src/include/basic_types.h | 4 +- src/include/cnorxz.h | 4 +- src/include/container_index.h | 4 +- src/include/conversions.h | 8 +- src/include/cxz_array.cc.h | 80 +++++++++---------- src/include/cxz_array.h | 70 ++++++++-------- src/include/cxz_array_base.cc.h | 76 +++++++++--------- src/include/cxz_array_base.h | 46 +++++------ src/include/{ma_assert.h => cxz_assert.h} | 0 src/include/cxz_operation.cc.h | 20 ++--- src/include/cxz_operation.h | 12 +-- src/include/dynamic_operation.cc.h | 12 +-- src/include/dynamic_operation.h | 8 +- src/include/functional_array.cc.h | 34 ++++---- src/include/functional_array.h | 22 ++--- src/include/helper_tools.cc.h | 36 ++++----- src/include/helper_tools.h | 34 ++++---- src/include/high_level_operation.h | 4 +- src/include/map_range.cc.h | 12 +-- src/include/map_range.h | 14 ++-- src/include/map_range_factory_product_map.h | 4 +- src/include/mbase_def.h | 10 +-- src/include/operation_def.h | 4 +- src/include/ranges/anonymous_range.h | 4 +- src/include/ranges/dynamic_meta.h | 4 +- src/include/ranges/dynamic_range.h | 4 +- src/include/ranges/index_base.h | 4 +- src/include/ranges/index_type.h | 4 +- src/include/ranges/index_wrapper.h | 4 +- src/include/ranges/multi_range.h | 4 +- .../ranges/multi_range_factory_product_map.h | 4 +- src/include/ranges/range_base.h | 4 +- src/include/ranges/range_helper.h | 4 +- .../ranges/range_types/classic_range.h | 10 +-- src/include/ranges/range_types/header.h | 14 ++-- src/include/ranges/range_types/null_range.h | 10 +-- src/include/ranges/range_types/space_range.h | 10 +-- src/include/ranges/range_types/spin_range.h | 10 +-- src/include/ranges/rbase_def.h | 4 +- src/include/ranges/reg_ind_num.h | 4 +- src/include/ranges/rheader.h | 4 +- src/include/ranges/rpheader.h | 4 +- src/include/ranges/single_range.h | 4 +- src/include/ranges/subrange.h | 4 +- src/include/ranges/type_map.h | 4 +- src/include/ranges/value_range.h | 4 +- src/include/ranges/x_to_string.h | 4 +- src/include/slice.cc.h | 18 ++--- src/include/slice.h | 32 ++++---- src/include/statics/static_for.h | 4 +- src/include/statics/traits.h | 8 +- src/include/type_operations.h | 12 +-- src/include/xfor/exttype.h | 4 +- src/include/xfor/for_type.h | 4 +- src/include/xfor/for_utils.h | 4 +- src/include/xfor/iloop.h | 4 +- src/include/xfor/xfor.h | 4 +- src/lib/ranges/anonymous_range.cc | 2 +- src/lib/ranges/dynamic_range.cc | 2 +- src/tests/CMakeLists.txt | 4 +- .../{ma_unit_test.cc => array_unit_test.cc} | 12 +-- src/tests/op2_unit_test.cc | 24 +++--- src/tests/op3_unit_test.cc | 8 +- src/tests/op4_unit_test.cc | 12 +-- src/tests/op_perf_test.cc | 14 ++-- src/tests/op_unit_test.cc | 76 +++++++++--------- 69 files changed, 454 insertions(+), 454 deletions(-) rename src/include/{ma_assert.h => cxz_assert.h} (100%) rename src/tests/{ma_unit_test.cc => array_unit_test.cc} (94%) diff --git a/src/include/allocator.h b/src/include/allocator.h index f894381..56ca670 100644 --- a/src/include/allocator.h +++ b/src/include/allocator.h @@ -1,6 +1,6 @@ -#ifndef __ma_allocator__ -#define __ma_allocator__ +#ifndef __cxz_allocator__ +#define __cxz_allocator__ #include #include diff --git a/src/include/arith.h b/src/include/arith.h index 10a865f..74b1230 100644 --- a/src/include/arith.h +++ b/src/include/arith.h @@ -1,6 +1,6 @@ -#ifndef __arith_h__ -#define __arith_h__ +#ifndef __cxz_arith_h__ +#define __cxz_arith_h__ #include diff --git a/src/include/base_def.h b/src/include/base_def.h index 9628956..d5d87da 100644 --- a/src/include/base_def.h +++ b/src/include/base_def.h @@ -1,7 +1,7 @@ // -*- C++ -*- -#ifndef __base_def_h__ -#define __base_def_h__ +#ifndef __cxz_base_def_h__ +#define __cxz_base_def_h__ #include diff --git a/src/include/basic_types.h b/src/include/basic_types.h index 0e0a9c7..0c806be 100644 --- a/src/include/basic_types.h +++ b/src/include/basic_types.h @@ -1,5 +1,5 @@ -#ifndef __basic_types_h__ -#define __basic_types_h__ +#ifndef __cxz_basic_types_h__ +#define __cxz_basic_types_h__ #include diff --git a/src/include/cnorxz.h b/src/include/cnorxz.h index 212af70..6a655a5 100644 --- a/src/include/cnorxz.h +++ b/src/include/cnorxz.h @@ -1,7 +1,7 @@ // -*- C++ -*- -#ifndef __cnorxz_h__ -#define __cnorxz_h__ +#ifndef __cxz_cnorxz_h__ +#define __cxz_cnorxz_h__ #include #include "container_index.h" diff --git a/src/include/container_index.h b/src/include/container_index.h index c457e44..c47d1d6 100644 --- a/src/include/container_index.h +++ b/src/include/container_index.h @@ -1,7 +1,7 @@ // -*- C++ -*- -#ifndef __container_index_h__ -#define __container_index_h__ +#ifndef __cxz_container_index_h__ +#define __cxz_container_index_h__ #include #include diff --git a/src/include/conversions.h b/src/include/conversions.h index 76ffb87..2b1dc78 100644 --- a/src/include/conversions.h +++ b/src/include/conversions.h @@ -1,6 +1,6 @@ -#ifndef __ma_conversions_h__ -#define __ma_conversions_h__ +#ifndef __cxz_conversions_h__ +#define __cxz_conversions_h__ #include "cxz_array.h" #include "slice.h" @@ -94,7 +94,7 @@ namespace CNORXZ } template - auto tcast(MultiArray& ma) + auto tcast(Array& ma) -> decltype(rangeTpToSlice ( rtcast( ma.range()->space() ), reinterpret_cast( ma.data() ) )) @@ -107,7 +107,7 @@ namespace CNORXZ } template - auto tcast(const MultiArray& ma) + auto tcast(const Array& ma) -> decltype(rangeTpToSlice ( rtcast( ma.range()->space() ), reinterpret_cast( ma.data() ) )) diff --git a/src/include/cxz_array.cc.h b/src/include/cxz_array.cc.h index 3d90a10..797a991 100644 --- a/src/include/cxz_array.cc.h +++ b/src/include/cxz_array.cc.h @@ -12,21 +12,21 @@ namespace CNORXZ } /******************* - * MultiArray * + * Array * *******************/ template - MultiArray::MultiArray(const typename CRange::Space& space) : - MutableMultiArrayBase(space), + Array::Array(const typename CRange::Space& space) : + MutableArrayBase(space), mCont(MAB::mRange->size()) { MAB::mInit = true; } template - MultiArray::MultiArray(const typename CRange::Space& space, + Array::Array(const typename CRange::Space& space, const vector& vec) : - MutableMultiArrayBase(space), + MutableArrayBase(space), mCont(vec) { MAB::mInit = true; @@ -37,24 +37,24 @@ namespace CNORXZ template - MultiArray::MultiArray(const std::shared_ptr&... ranges) : - MutableMultiArrayBase(ranges...), + Array::Array(const std::shared_ptr&... ranges) : + MutableArrayBase(ranges...), mCont(MAB::mRange->size()) { MAB::mInit = true; } template - MultiArray::MultiArray(const std::shared_ptr&... ranges, const T& val) : - MutableMultiArrayBase(ranges...), + Array::Array(const std::shared_ptr&... ranges, const T& val) : + MutableArrayBase(ranges...), mCont(MAB::mRange->size(), val) { MAB::mInit = true; } template - MultiArray::MultiArray(const std::shared_ptr&... ranges, const vector& vec) : - MutableMultiArrayBase(ranges...), + Array::Array(const std::shared_ptr&... ranges, const vector& vec) : + MutableArrayBase(ranges...), mCont(vec) { MAB::mInit = true; @@ -64,8 +64,8 @@ namespace CNORXZ } template - MultiArray::MultiArray(const std::shared_ptr&... ranges, vector&& vec) : - MutableMultiArrayBase(ranges...), + Array::Array(const std::shared_ptr&... ranges, vector&& vec) : + MutableArrayBase(ranges...), mCont(std::forward>(vec)) { MAB::mInit = true; @@ -76,8 +76,8 @@ namespace CNORXZ template template - MultiArray::MultiArray(const std::shared_ptr&... ranges, MultiArray&& in) : - MutableMultiArrayBase(ranges...), + Array::Array(const std::shared_ptr&... ranges, Array&& in) : + MutableArrayBase(ranges...), mCont( std::move( in.mCont ) ) { // maybe some checks here in the future... @@ -87,8 +87,8 @@ namespace CNORXZ } template - MultiArray::MultiArray(MultiArray&& ama, SIZET... sizes) : - MutableMultiArrayBase + Array::Array(Array&& ama, SIZET... sizes) : + MutableArrayBase ( ama.range()->template get<0>().template scast(sizes...)->space() ), mCont( std::move( ama.mCont ) ) { @@ -97,85 +97,85 @@ namespace CNORXZ } template - T& MultiArray::operator[](const IndexType& i) + T& Array::operator[](const IndexType& i) { return mCont[ i.pos() ]; } template - const T& MultiArray::operator[](const IndexType& i) const + const T& Array::operator[](const IndexType& i) const { return mCont[ i.pos() ]; } template - T& MultiArray::at(const typename IndexType::MetaType& meta) + T& Array::at(const typename IndexType::MetaType& meta) { return mCont[ MAB::cbegin().at(meta).pos() ]; } template - const T& MultiArray::at(const typename IndexType::MetaType& meta) const + const T& Array::at(const typename IndexType::MetaType& meta) const { return mCont[ MAB::cbegin().at(meta).pos() ]; } template - bool MultiArray::isConst() const + bool Array::isConst() const { return false; } template - bool MultiArray::isSlice() const + bool Array::isSlice() const { return false; } template template - MultiArray MultiArray::format(const std::shared_ptr&... nrs) + Array Array::format(const std::shared_ptr&... nrs) { //MAB::mInit = false; - return MultiArray( nrs... , mCont ); + return Array( nrs... , mCont ); } template template - MultiArray MultiArray::format(const std::tuple...>& nrs) + Array Array::format(const std::tuple...>& nrs) { //MAB::mInit = false; - return MultiArray( nrs , mCont ); + return Array( nrs , mCont ); } template template - Slice MultiArray::slformat(const std::shared_ptr&... nrs) + Slice Array::slformat(const std::shared_ptr&... nrs) { return Slice( nrs..., mCont.data() ); } template template - ConstSlice MultiArray::slformat(const std::shared_ptr&... nrs) const + ConstSlice Array::slformat(const std::shared_ptr&... nrs) const { return ConstSlice( nrs..., mCont.data() ); } template - const T* MultiArray::data() const + const T* Array::data() const { return mCont.data(); } template - T* MultiArray::data() + T* Array::data() { return mCont.data(); } template - std::shared_ptr > MultiArray::anonymous(bool slice) const + std::shared_ptr > Array::anonymous(bool slice) const { AnonymousRangeFactory arf(MAB::mRange->space()); if(slice){ @@ -184,14 +184,14 @@ namespace CNORXZ data() ); } else { - return std::make_shared > + return std::make_shared > ( std::dynamic_pointer_cast( arf.create() ), mCont ); } } template - MultiArray& MultiArray::operator=(const T& in) + Array& Array::operator=(const T& in) { for(auto& x: mCont){ x = in; @@ -200,7 +200,7 @@ namespace CNORXZ } template - MultiArray& MultiArray::operator+=(const MultiArray& in) + Array& Array::operator+=(const Array& in) { if(not MAB::mInit){ // not initialized by default constructor !! (*this) = in; @@ -217,7 +217,7 @@ namespace CNORXZ } template - MultiArray& MultiArray::operator-=(const MultiArray& in) + Array& Array::operator-=(const Array& in) { if(not MAB::mInit){ // not initialized by default constructor !! (*this) = in; @@ -234,7 +234,7 @@ namespace CNORXZ } template - MultiArray& MultiArray::operator*=(const T& in) + Array& Array::operator*=(const T& in) { for(auto& x: mCont){ x *= in; @@ -243,7 +243,7 @@ namespace CNORXZ } template - MultiArray& MultiArray::operator/=(const T& in) + Array& Array::operator/=(const T& in) { for(auto& x: mCont){ x /= in; @@ -252,7 +252,7 @@ namespace CNORXZ } template - MultiArray::operator T() const + Array::operator T() const { //static_assert( sizeof...(SRanges) == 1, "try to cast non-scalar type into scalar" ); // TODO: check that SIZE is statically = 1 !!! @@ -260,7 +260,7 @@ namespace CNORXZ } template - auto MultiArray::cat() const + auto Array::cat() const -> decltype(ArrayCatter::cat(*this)) { return ArrayCatter::cat(*this); diff --git a/src/include/cxz_array.h b/src/include/cxz_array.h index 97e98ad..7b5471f 100644 --- a/src/include/cxz_array.h +++ b/src/include/cxz_array.h @@ -18,49 +18,49 @@ namespace CNORXZ struct ArrayCatter { template - static auto cat(const MultiArray& ma) - -> MultiArray + static auto cat(const Array& ma) + -> Array { return ma; } }; template - class MultiArray : public MutableMultiArrayBase + class Array : public MutableArrayBase { public: typedef ContainerRange CRange; - typedef MultiArrayBase MAB; + typedef ArrayBase MAB; typedef ConstContainerIndex IndexType; - using MultiArrayBase::operator[]; - using MutableMultiArrayBase::operator[]; + using ArrayBase::operator[]; + using MutableArrayBase::operator[]; - DEFAULT_MEMBERS(MultiArray); - MultiArray(const std::shared_ptr&... ranges); - MultiArray(const std::shared_ptr&... ranges, const T& val); - MultiArray(const std::shared_ptr&... ranges, const vector& vec); - MultiArray(const std::shared_ptr&... ranges, vector&& vec); + DEFAULT_MEMBERS(Array); + Array(const std::shared_ptr&... ranges); + Array(const std::shared_ptr&... ranges, const T& val); + Array(const std::shared_ptr&... ranges, const vector& vec); + Array(const std::shared_ptr&... ranges, vector&& vec); template - MultiArray(const std::shared_ptr&... ranges, MultiArray&& in); // same effect as format + Array(const std::shared_ptr&... ranges, Array&& in); // same effect as format - MultiArray(const typename CRange::Space& space); - MultiArray(const typename CRange::Space& space, const vector& vec); - MultiArray(MultiArray&& ama, SIZET... sizes); + Array(const typename CRange::Space& space); + Array(const typename CRange::Space& space, const vector& vec); + Array(Array&& ama, SIZET... sizes); // Only if ALL ranges have default extensions: - //MultiArray(const vector& vec); - //MultiArray(vector&& vec); + //Array(const vector& vec); + //Array(vector&& vec); // template - // MultiArray(const MultiArray,Range3> in); + // Array(const Array,Range3> in); - // implement contstructor using FunctionalMultiArray as Input !!! + // implement contstructor using FunctionalArray as Input !!! //template - //MultiArray& operator=(const MultiArray,Range3> in); + //Array& operator=(const Array,Range3> in); virtual T& operator[](const IndexType& i) final; virtual const T& operator[](const IndexType& i) const final; @@ -71,11 +71,11 @@ namespace CNORXZ virtual bool isSlice() const override; template - MultiArray format(const std::shared_ptr&... nrs); // reformat array using 'nr' which in + Array format(const std::shared_ptr&... nrs); // reformat array using 'nr' which in // total must have the same size as mRange template - MultiArray format(const std::tuple...>& nrs); + Array format(const std::tuple...>& nrs); template Slice slformat(const std::shared_ptr&... nrs); @@ -89,23 +89,23 @@ namespace CNORXZ virtual const vector& vdata() const { return mCont; } vector&& vmove() { MAB::mInit = false; return std::move(mCont); } - virtual std::shared_ptr > anonymous(bool slice = false) const override; - //virtual std::shared_ptr > anonymousMove() override; + virtual std::shared_ptr > anonymous(bool slice = false) const override; + //virtual std::shared_ptr > anonymousMove() override; auto cat() const -> decltype(ArrayCatter::cat(*this)); operator T() const; - MultiArray& operator=(const T& in); + Array& operator=(const T& in); - MultiArray& operator+=(const MultiArray& in); - MultiArray& operator-=(const MultiArray& in); - MultiArray& operator*=(const T& in); - MultiArray& operator/=(const T& in); + Array& operator+=(const Array& in); + Array& operator-=(const Array& in); + Array& operator*=(const T& in); + Array& operator/=(const T& in); template - friend class MultiArray; + friend class Array; private: @@ -113,17 +113,17 @@ namespace CNORXZ }; template - using Scalar = MultiArray; + using Scalar = Array; template Scalar scalar(const T& in); template - struct ArrayCatter > + struct ArrayCatter > { template - static auto cat(const MultiArray,Ranges...>& ma) - -> MultiArray + static auto cat(const Array,Ranges...>& ma) + -> Array { auto sma = *ma.begin(); const size_t smas = sma.size(); @@ -136,7 +136,7 @@ namespace CNORXZ assert(x.size() == smas); ov.insert(ov.end(), x.vdata().begin(), x.vdata().end()); } - return MultiArray(cr->space(), std::move(ov)); + return Array(cr->space(), std::move(ov)); } }; diff --git a/src/include/cxz_array_base.cc.h b/src/include/cxz_array_base.cc.h index f24c198..2f5552b 100644 --- a/src/include/cxz_array_base.cc.h +++ b/src/include/cxz_array_base.cc.h @@ -5,11 +5,11 @@ namespace CNORXZ { /********************** - * MultiArrayBase * + * ArrayBase * **********************/ template - MultiArrayBase::MultiArrayBase(const MultiArrayBase& in) : + ArrayBase::ArrayBase(const ArrayBase& in) : mInit(in.mInit), mRange(in.mRange) { @@ -20,7 +20,7 @@ namespace CNORXZ template - MultiArrayBase::MultiArrayBase(MultiArrayBase&& in) : + ArrayBase::ArrayBase(ArrayBase&& in) : mInit(in.mInit), mRange(in.mRange) { @@ -30,7 +30,7 @@ namespace CNORXZ } template - MultiArrayBase& MultiArrayBase::operator=(const MultiArrayBase& in) + ArrayBase& ArrayBase::operator=(const ArrayBase& in) { mInit = in.mInit; mRange = in.mRange; @@ -41,7 +41,7 @@ namespace CNORXZ } template - MultiArrayBase& MultiArrayBase::operator=(MultiArrayBase&& in) + ArrayBase& ArrayBase::operator=(ArrayBase&& in) { mInit = in.mInit; mRange = in.mRange; @@ -52,7 +52,7 @@ namespace CNORXZ } template - MultiArrayBase::MultiArrayBase(const std::shared_ptr&... ranges) + ArrayBase::ArrayBase(const std::shared_ptr&... ranges) { ContainerRangeFactory crf(ranges...); mRange = std::dynamic_pointer_cast >( crf.create() ); @@ -60,7 +60,7 @@ namespace CNORXZ } template - MultiArrayBase::MultiArrayBase(const typename CRange::Space& space) + ArrayBase::ArrayBase(const typename CRange::Space& space) { ContainerRangeFactory crf(space); mRange = std::dynamic_pointer_cast >( crf.create() ); @@ -69,7 +69,7 @@ namespace CNORXZ template template - const T& MultiArrayBase::operator[](const ConstContainerIndex& i) + const T& ArrayBase::operator[](const ConstContainerIndex& i) { IndexType ii(*mProtoI); ii = i; @@ -77,7 +77,7 @@ namespace CNORXZ } template - const T& MultiArrayBase::operator[](const std::tuple...>& is) const + const T& ArrayBase::operator[](const std::tuple...>& is) const { IndexType ii(*mProtoI); ii(is); @@ -85,25 +85,25 @@ namespace CNORXZ } template - size_t MultiArrayBase::size() const + size_t ArrayBase::size() const { return mRange->size(); } template - typename MultiArrayBase::CIndexType MultiArrayBase::begin() const + typename ArrayBase::CIndexType ArrayBase::begin() const { return cbegin(); } template - typename MultiArrayBase::CIndexType MultiArrayBase::end() const + typename ArrayBase::CIndexType ArrayBase::end() const { return end(); } template - typename MultiArrayBase::CIndexType MultiArrayBase::cbegin() const + typename ArrayBase::CIndexType ArrayBase::cbegin() const { CIndexType i(*mProtoI,true); i = 0; @@ -111,7 +111,7 @@ namespace CNORXZ } template - typename MultiArrayBase::CIndexType MultiArrayBase::cend() const + typename ArrayBase::CIndexType ArrayBase::cend() const { CIndexType i(*mProtoI,true); i = i.max(); @@ -119,28 +119,28 @@ namespace CNORXZ } template - const std::shared_ptr::CRange>& - MultiArrayBase::range() const + const std::shared_ptr::CRange>& + ArrayBase::range() const { return mRange; } template - bool MultiArrayBase::isConst() const + bool ArrayBase::isConst() const { return true; } template ConstOperationRoot - MultiArrayBase::operator()(const std::shared_ptr&... inds) const + ArrayBase::operator()(const std::shared_ptr&... inds) const { return ConstOperationRoot(*this, inds...); } template ConstOperationRoot - MultiArrayBase::op(const std::shared_ptr& ind) const + ArrayBase::op(const std::shared_ptr& ind) const { return ConstOperationRoot(data(), *ind); } @@ -148,7 +148,7 @@ namespace CNORXZ template template ConstOperationRoot - MultiArrayBase::m(const std::shared_ptr&... inds) const + ArrayBase::m(const std::shared_ptr&... inds) const { static_assert(sizeof...(SRanges) == sizeof...(MappedRanges), "number of mapped ranges must be equal to number of original ranges"); @@ -156,14 +156,14 @@ namespace CNORXZ } template - bool MultiArrayBase::isInit() const + bool ArrayBase::isInit() const { return mInit; } template template - auto MultiArrayBase::getRangePtr() const + auto ArrayBase::getRangePtr() const -> decltype(mRange->template getPtr()) { return mRange->template getPtr(); @@ -171,20 +171,20 @@ namespace CNORXZ /****************************** - * MutableMultiArrayBase * + * MutableArrayBase * ******************************/ template - MutableMultiArrayBase::MutableMultiArrayBase(const std::shared_ptr&... ranges) : - MultiArrayBase(ranges...) {} + MutableArrayBase::MutableArrayBase(const std::shared_ptr&... ranges) : + ArrayBase(ranges...) {} template - MutableMultiArrayBase::MutableMultiArrayBase(const typename CRange::Space& space) : - MultiArrayBase(space) {} + MutableArrayBase::MutableArrayBase(const typename CRange::Space& space) : + ArrayBase(space) {} template template - T& MutableMultiArrayBase::operator[](const ConstContainerIndex& i) + T& MutableArrayBase::operator[](const ConstContainerIndex& i) { IndexType ii(*MAB::mProtoI); ii = i; @@ -192,7 +192,7 @@ namespace CNORXZ } template - T& MutableMultiArrayBase::operator[](const std::tuple...>& is) + T& MutableArrayBase::operator[](const std::tuple...>& is) { IndexType ii(*MAB::mProtoI,this->data()); ii(is); @@ -200,7 +200,7 @@ namespace CNORXZ } template - typename MutableMultiArrayBase::IndexType MutableMultiArrayBase::begin() + typename MutableArrayBase::IndexType MutableArrayBase::begin() { IndexType i(*MAB::mProtoI,this->data(),true); i = 0; @@ -208,7 +208,7 @@ namespace CNORXZ } template - typename MutableMultiArrayBase::IndexType MutableMultiArrayBase::end() + typename MutableArrayBase::IndexType MutableArrayBase::end() { IndexType i(*MAB::mProtoI,this->data(),true); i = i.max(); @@ -217,35 +217,35 @@ namespace CNORXZ template - bool MutableMultiArrayBase::isConst() const + bool MutableArrayBase::isConst() const { return false; } template OperationRoot - MutableMultiArrayBase::operator()(const std::shared_ptr&... inds) + MutableArrayBase::operator()(const std::shared_ptr&... inds) { return OperationRoot(*this, inds...); } template OperationRoot - MutableMultiArrayBase::op(const std::shared_ptr& ind) + MutableArrayBase::op(const std::shared_ptr& ind) { return OperationRoot(data(), *ind); } template ConstOperationRoot - MutableMultiArrayBase::operator()(const std::shared_ptr&... inds) const + MutableArrayBase::operator()(const std::shared_ptr&... inds) const { return ConstOperationRoot(*this, inds...); } template ConstOperationRoot - MutableMultiArrayBase::op(const std::shared_ptr& ind) const + MutableArrayBase::op(const std::shared_ptr& ind) const { return ConstOperationRoot(data(), *ind); } @@ -253,7 +253,7 @@ namespace CNORXZ template template OperationRoot - MutableMultiArrayBase::m(const std::shared_ptr&... inds) + MutableArrayBase::m(const std::shared_ptr&... inds) { static_assert(sizeof...(SRanges) == sizeof...(MappedRanges), "number of mapped ranges must be equal to number of original ranges"); @@ -263,7 +263,7 @@ namespace CNORXZ template template ConstOperationRoot - MutableMultiArrayBase::m(const std::shared_ptr&... inds) const + MutableArrayBase::m(const std::shared_ptr&... inds) const { static_assert(sizeof...(SRanges) == sizeof...(MappedRanges), "number of mapped ranges must be equal to number of original ranges"); diff --git a/src/include/cxz_array_base.h b/src/include/cxz_array_base.h index 791215e..4e91609 100644 --- a/src/include/cxz_array_base.h +++ b/src/include/cxz_array_base.h @@ -51,7 +51,7 @@ namespace CNORXZ // Explicitely specify subranges in template argument !!! template - class MultiArrayBase + class ArrayBase { public: @@ -67,17 +67,17 @@ namespace CNORXZ public: - //DEFAULT_MEMBERS(MultiArrayBase); - MultiArrayBase(const std::shared_ptr&... ranges); - MultiArrayBase(const typename CRange::Space& space); + //DEFAULT_MEMBERS(ArrayBase); + ArrayBase(const std::shared_ptr&... ranges); + ArrayBase(const typename CRange::Space& space); - MultiArrayBase() = default; - MultiArrayBase(const MultiArrayBase& in); - MultiArrayBase(MultiArrayBase&& in); - MultiArrayBase& operator=(const MultiArrayBase& in); - MultiArrayBase& operator=(MultiArrayBase&& in); + ArrayBase() = default; + ArrayBase(const ArrayBase& in); + ArrayBase(ArrayBase&& in); + ArrayBase& operator=(const ArrayBase& in); + ArrayBase& operator=(ArrayBase&& in); - virtual ~MultiArrayBase() = default; + virtual ~ArrayBase() = default; template const T& operator[](const ConstContainerIndex& i); @@ -100,7 +100,7 @@ namespace CNORXZ virtual bool isConst() const; - virtual std::shared_ptr > anonymous(bool slice = false) const = 0; + virtual std::shared_ptr > anonymous(bool slice = false) const = 0; virtual ConstOperationRoot op(const std::shared_ptr& ind) const; @@ -121,26 +121,26 @@ namespace CNORXZ }; template - class MutableMultiArrayBase : public MultiArrayBase + class MutableArrayBase : public ArrayBase { public: typedef ContainerRange CRange; - typedef MultiArrayBase MAB; + typedef ArrayBase MAB; typedef ContainerIndex IndexType; typedef ConstContainerIndex CIndexType; - using MultiArrayBase::operator[]; - using MultiArrayBase::at; - using MultiArrayBase::data; - using MultiArrayBase::begin; - using MultiArrayBase::end; - using MultiArrayBase::cbegin; - using MultiArrayBase::cend; + using ArrayBase::operator[]; + using ArrayBase::at; + using ArrayBase::data; + using ArrayBase::begin; + using ArrayBase::end; + using ArrayBase::cbegin; + using ArrayBase::cend; - DEFAULT_MEMBERS(MutableMultiArrayBase); - MutableMultiArrayBase(const std::shared_ptr&... ranges); - MutableMultiArrayBase(const typename CRange::Space& space); + DEFAULT_MEMBERS(MutableArrayBase); + MutableArrayBase(const std::shared_ptr&... ranges); + MutableArrayBase(const typename CRange::Space& space); template T& operator[](const ConstContainerIndex& i); diff --git a/src/include/ma_assert.h b/src/include/cxz_assert.h similarity index 100% rename from src/include/ma_assert.h rename to src/include/cxz_assert.h diff --git a/src/include/cxz_operation.cc.h b/src/include/cxz_operation.cc.h index 3d12cae..7d50b1b 100644 --- a/src/include/cxz_operation.cc.h +++ b/src/include/cxz_operation.cc.h @@ -68,7 +68,7 @@ namespace CNORXZ template auto OperationBase::p(const std::shared_ptr&... inds) const { - auto ma = std::make_shared> + auto ma = std::make_shared> (inds->range()... , static_cast(0)); (*ma)(inds...) = THIS(); return ConstOperationRoot(ma, inds...); @@ -78,7 +78,7 @@ namespace CNORXZ template auto OperationBase::to(const std::shared_ptr&... inds) const { - MultiArray out(inds->range()...); + Array out(inds->range()...); out(inds...) = THIS(); return out; } @@ -87,7 +87,7 @@ namespace CNORXZ template auto OperationBase::addto(const std::shared_ptr&... inds) const { - MultiArray out(inds->range()..., + Array out(inds->range()..., static_cast(0)); out(inds...) += THIS(); return out; @@ -97,7 +97,7 @@ namespace CNORXZ template auto OperationBase::pto(const std::shared_ptr&... inds) const { - MultiArray out(inds->range()...); + Array out(inds->range()...); out(inds...).par() = THIS(); return out; } @@ -106,7 +106,7 @@ namespace CNORXZ template auto OperationBase::paddto(const std::shared_ptr&... inds) const { - MultiArray out(inds->range()..., + Array out(inds->range()..., static_cast(0)); out(inds...).par() += THIS(); return out; @@ -343,7 +343,7 @@ namespace CNORXZ template ConstOperationRoot:: - ConstOperationRoot(const MultiArrayBase& ma, + ConstOperationRoot(const ArrayBase& ma, const std::shared_ptr&... indices) : mDataPtr(ma.data()), mOrigDataPtr(ma.data()), @@ -355,7 +355,7 @@ namespace CNORXZ template ConstOperationRoot:: - ConstOperationRoot(std::shared_ptr > maptr, + ConstOperationRoot(std::shared_ptr > maptr, const std::shared_ptr&... indices) : mDataPtr(maptr->data()), mOrigDataPtr(maptr->data()), @@ -517,7 +517,7 @@ namespace CNORXZ template OperationRoot:: - OperationRoot(MutableMultiArrayBase& ma, + OperationRoot(MutableArrayBase& ma, const std::shared_ptr&... indices) : mDataPtr(ma.data()), mOrigDataPtr(ma.data()), @@ -531,7 +531,7 @@ namespace CNORXZ template OperationRoot:: - OperationRoot(MutableMultiArrayBase& ma, + OperationRoot(MutableArrayBase& ma, const std::tuple...>& indices) : mDataPtr(ma.data()), mOrigDataPtr(ma.data()), @@ -728,7 +728,7 @@ namespace CNORXZ template ParallelOperationRoot:: - ParallelOperationRoot(MutableMultiArrayBase& ma, + ParallelOperationRoot(MutableArrayBase& ma, const std::shared_ptr&... indices) : mDataPtr(ma.data()), mOrigDataPtr(ma.data()), diff --git a/src/include/cxz_operation.h b/src/include/cxz_operation.h index 6299e35..474f529 100644 --- a/src/include/cxz_operation.h +++ b/src/include/cxz_operation.h @@ -477,10 +477,10 @@ namespace CNORXZ static constexpr bool CONT = true; static constexpr bool VABLE = true; - ConstOperationRoot(const MultiArrayBase& ma, + ConstOperationRoot(const ArrayBase& ma, const std::shared_ptr&... indices); - ConstOperationRoot(std::shared_ptr > maptr, + ConstOperationRoot(std::shared_ptr > maptr, const std::shared_ptr&... indices); ConstOperationRoot(const T* data, const IndexType& ind); @@ -506,7 +506,7 @@ namespace CNORXZ const T* mDataPtr; const T* mOrigDataPtr; IndexType mIndex; - std::shared_ptr > mMaPtr; // never remove this ptr, otherwise we lose temporary container instances! + std::shared_ptr > mMaPtr; // never remove this ptr, otherwise we lose temporary container instances! }; template @@ -609,10 +609,10 @@ namespace CNORXZ IndexType mIndex; public: - OperationRoot(MutableMultiArrayBase& ma, + OperationRoot(MutableArrayBase& ma, const std::shared_ptr&... indices); - OperationRoot(MutableMultiArrayBase& ma, + OperationRoot(MutableArrayBase& ma, const std::tuple...>& indices); OperationRoot(T* data, const IndexType& ind); @@ -695,7 +695,7 @@ namespace CNORXZ IndexType mIndex; public: - ParallelOperationRoot(MutableMultiArrayBase& ma, + ParallelOperationRoot(MutableArrayBase& ma, const std::shared_ptr&... indices); ParallelOperationRoot(T* data, const IndexType& ind); diff --git a/src/include/dynamic_operation.cc.h b/src/include/dynamic_operation.cc.h index c0f02fe..43bbb45 100644 --- a/src/include/dynamic_operation.cc.h +++ b/src/include/dynamic_operation.cc.h @@ -45,7 +45,7 @@ namespace CNORXZ DynamicOuterOp::DynamicOuterOp(const DynamicOuterOp& in) : mThreadId(omp_get_thread_num()), mOp(in.mOp), mIndices(in.mIndices), - mMa((mThreadId != in.mThreadId) ? std::make_shared>(*in.mMa) : in.mMa), + mMa((mThreadId != in.mThreadId) ? std::make_shared>(*in.mMa) : in.mMa), mProto((mThreadId != in.mThreadId) ? OperationRoot(*mMa,mIndices) : in.mProto), mL((mThreadId != in.mThreadId) ? mkILoop(std::make_tuple(*mProto.mOp,mOp), mIndices, @@ -60,7 +60,7 @@ namespace CNORXZ DynamicOuterOp::DynamicOuterOp(DynamicOuterOp&& in) : mThreadId(omp_get_thread_num()), mOp(in.mOp), mIndices(in.mIndices), - mMa((mThreadId != in.mThreadId) ? std::make_shared>(*in.mMa) : in.mMa), + mMa((mThreadId != in.mThreadId) ? std::make_shared>(*in.mMa) : in.mMa), mProto((mThreadId != in.mThreadId) ? OperationRoot(*mMa,mIndices) : in.mProto), mL((mThreadId != in.mThreadId) ? mkILoop(std::make_tuple(*mProto.mOp,mOp), mIndices, @@ -79,7 +79,7 @@ namespace CNORXZ mOp = in.mOp; mIndices = in.mIndices; if(mThreadId != in.mThreadId){ - mMa = std::make_shared>(in.mMa); + mMa = std::make_shared>(in.mMa); mProto = OperationRoot(*mMa,mIndices); mL = mkILoop(std::make_tuple(*mProto.mOp,mOp), mIndices, std::make_tuple(mMa), @@ -103,7 +103,7 @@ namespace CNORXZ mOp = in.mOp; mIndices = in.mIndices; if(mThreadId != in.mThreadId){ - mMa = std::make_shared>(in.mMa); + mMa = std::make_shared>(in.mMa); mProto = OperationRoot(*mMa,mIndices); mL = mkILoop(std::make_tuple(*mProto.mOp,mOp), mIndices, std::make_tuple(mMa), @@ -124,7 +124,7 @@ namespace CNORXZ const std::shared_ptr&... inds) : mThreadId(omp_get_thread_num()), mOp(op), mIndices(inds...), - mMa(std::make_shared>(mkArray(inds->range()...))), + mMa(std::make_shared>(mkArray(inds->range()...))), mProto(OperationRoot(*mMa,inds...)), mL(std::make_tuple(*mProto.mOp,mOp), std::make_tuple(inds...), std::make_tuple(mMa), std::make_tuple(mProto.mOp->assign( mOp, mkMIndex(inds...) )), @@ -137,7 +137,7 @@ namespace CNORXZ : mThreadId(omp_get_thread_num()), //mDyn(dyn), mOp(op), mIndices(inds...), - mMa(std::make_shared>(mkArray(inds->range()...))), + mMa(std::make_shared>(mkArray(inds->range()...))), mProto(OperationRoot(*mMa,inds...)), mL(std::make_tuple(*mProto.mOp,mOp), std::make_tuple(inds...), std::make_tuple(mMa), std::make_tuple(mProto.mOp->assign( mOp, mkMIndex(inds...) )), diff --git a/src/include/dynamic_operation.h b/src/include/dynamic_operation.h index 08fed92..a2973fe 100644 --- a/src/include/dynamic_operation.h +++ b/src/include/dynamic_operation.h @@ -1,6 +1,6 @@ -#ifndef __dynamic_operation_h__ -#define __dynamic_operation_h__ +#ifndef __cxz_dynamic_operation_h__ +#define __cxz_dynamic_operation_h__ #include "base_def.h" #include "cxz_operation.h" @@ -77,13 +77,13 @@ namespace CNORXZ Operation mOp; //OperationRoot mProto; std::tuple...> mIndices; - std::shared_ptr> mMa; + std::shared_ptr> mMa; OpH> mProto; typedef ILoop,Operation>, std::tuple...>, - std::tuple>>, + std::tuple>>, std::tupleassign( mOp, mkMIndex(std::shared_ptr()...) ))>> LoopT; diff --git a/src/include/functional_array.cc.h b/src/include/functional_array.cc.h index 02fb54e..01520cd 100644 --- a/src/include/functional_array.cc.h +++ b/src/include/functional_array.cc.h @@ -6,30 +6,30 @@ namespace CNORXZ /**************************** - * FunctionalMultiArray * + * FunctionalArray * ****************************/ template - FunctionalMultiArray::FunctionalMultiArray(const std::shared_ptr&... ranges, + FunctionalArray::FunctionalArray(const std::shared_ptr&... ranges, const std::shared_ptr& func) : - MultiArrayBase(ranges...), mFunc(func) {} + ArrayBase(ranges...), mFunc(func) {} template - FunctionalMultiArray::FunctionalMultiArray(const std::shared_ptr&... ranges) : - MultiArrayBase(ranges...) {} + FunctionalArray::FunctionalArray(const std::shared_ptr&... ranges) : + ArrayBase(ranges...) {} template - FunctionalMultiArray::FunctionalMultiArray(const typename CRange::Space& space) : - MultiArrayBase(space) {} + FunctionalArray::FunctionalArray(const typename CRange::Space& space) : + ArrayBase(space) {} template - FunctionalMultiArray::FunctionalMultiArray(const typename CRange::Space& space, + FunctionalArray::FunctionalArray(const typename CRange::Space& space, const std::shared_ptr& func) : - MultiArrayBase(space), mFunc(func) {} + ArrayBase(space), mFunc(func) {} template - const T& FunctionalMultiArray::operator[](const IndexType& i) const + const T& FunctionalArray::operator[](const IndexType& i) const { if constexpr(Function::FISSTATIC){ mVal = Function::apply(i.meta()); @@ -41,7 +41,7 @@ namespace CNORXZ } template - const T& FunctionalMultiArray::at(const typename CRange::IndexType::MetaType& meta) const + const T& FunctionalArray::at(const typename CRange::IndexType::MetaType& meta) const { if constexpr(Function::FISSTATIC){ mVal = Function::apply(meta); @@ -53,32 +53,32 @@ namespace CNORXZ } template - const T* FunctionalMultiArray::data() const + const T* FunctionalArray::data() const { return &mVal; } template - bool FunctionalMultiArray::isConst() const + bool FunctionalArray::isConst() const { return true; } template - bool FunctionalMultiArray::isSlice() const + bool FunctionalArray::isSlice() const { return false; } template - std::shared_ptr > FunctionalMultiArray::anonymous(bool slice) const + std::shared_ptr > FunctionalArray::anonymous(bool slice) const { assert(0); // think about it carefully return nullptr; } template - ConstOperationRoot FunctionalMultiArray:: + ConstOperationRoot FunctionalArray:: operator()(const std::shared_ptr&... inds) const { if(not mMaPtr){ @@ -89,7 +89,7 @@ namespace CNORXZ } template - auto FunctionalMultiArray:: + auto FunctionalArray:: exec(const std::shared_ptr&... inds) const -> Operation...> { diff --git a/src/include/functional_array.h b/src/include/functional_array.h index 10112dc..b8df149 100644 --- a/src/include/functional_array.h +++ b/src/include/functional_array.h @@ -1,6 +1,6 @@ -#ifndef __functional_array__ -#define __functional_array__ +#ifndef __cxz_functional_array__ +#define __cxz_functional_array__ #include "cxz_array_base.h" #include "slice.h" @@ -9,14 +9,14 @@ namespace CNORXZ { template - class FunctionalMultiArray : public MultiArrayBase + class FunctionalArray : public ArrayBase { public: typedef ContainerRange CRange; - typedef MultiArrayBase MAB; + typedef ArrayBase MAB; typedef ConstContainerIndex IndexType; - typedef MultiArray MAType; + typedef Array MAType; typedef T value_type; private: @@ -27,11 +27,11 @@ namespace CNORXZ public: - DEFAULT_MEMBERS(FunctionalMultiArray); - FunctionalMultiArray(const std::shared_ptr&... ranges, const std::shared_ptr& func); - FunctionalMultiArray(const std::shared_ptr&... ranges); - FunctionalMultiArray(const typename CRange::Space& space); - FunctionalMultiArray(const typename CRange::Space& space, const std::shared_ptr& func); + DEFAULT_MEMBERS(FunctionalArray); + FunctionalArray(const std::shared_ptr&... ranges, const std::shared_ptr& func); + FunctionalArray(const std::shared_ptr&... ranges); + FunctionalArray(const typename CRange::Space& space); + FunctionalArray(const typename CRange::Space& space, const std::shared_ptr& func); virtual const T& operator[](const IndexType& i) const override; virtual const T& at(const typename CRange::IndexType::MetaType& meta) const override; @@ -40,7 +40,7 @@ namespace CNORXZ virtual bool isConst() const override; virtual bool isSlice() const override; - virtual std::shared_ptr > anonymous(bool slice = false) const override; + virtual std::shared_ptr > anonymous(bool slice = false) const override; auto exec(const std::shared_ptr&... inds) const -> Operation...>; diff --git a/src/include/helper_tools.cc.h b/src/include/helper_tools.cc.h index 957eb96..c2dfb19 100644 --- a/src/include/helper_tools.cc.h +++ b/src/include/helper_tools.cc.h @@ -237,7 +237,7 @@ namespace CNORXZ template auto dynamic(const MArray& ma, bool slice) - -> std::shared_ptr> + -> std::shared_ptr> { DynamicRangeFactory drf(ma.range()->space()); if(slice){ @@ -246,7 +246,7 @@ namespace CNORXZ ma.data() ); } else { - return std::make_shared> + return std::make_shared> ( std::dynamic_pointer_cast( drf.create() ), ma.vdata() ); } @@ -254,7 +254,7 @@ namespace CNORXZ template auto mdynamic(MArray& ma, bool slice) - -> std::shared_ptr> + -> std::shared_ptr> { DynamicRangeFactory drf(ma.range()->space()); if(slice){ @@ -263,7 +263,7 @@ namespace CNORXZ ma.data() ); } else { - return std::make_shared> + return std::make_shared> ( std::dynamic_pointer_cast( drf.create() ), ma.vdata() ); } @@ -294,7 +294,7 @@ namespace CNORXZ } template - auto anonToDynView(const MultiArrayBase& ma) + auto anonToDynView(const ArrayBase& ma) -> ConstSlice { constexpr size_t LAST = sizeof...(RangeTypes)+1; @@ -307,7 +307,7 @@ namespace CNORXZ } template - auto anonToDynView(MutableMultiArrayBase& ma) + auto anonToDynView(MutableArrayBase& ma) -> Slice { constexpr size_t LAST = sizeof...(RangeTypes)+1; @@ -320,8 +320,8 @@ namespace CNORXZ } template - auto dynToAnonMove(MultiArray&& ma) - -> MultiArray + auto dynToAnonMove(Array&& ma) + -> Array { constexpr size_t LAST = sizeof...(RangeTypes)+1; AnonymousRangeFactory arf(rptr(ma)->orig()); @@ -333,7 +333,7 @@ namespace CNORXZ } template - auto anonToDynView(const MultiArrayBase& ma) + auto anonToDynView(const ArrayBase& ma) -> ConstSlice { DynamicRangeFactory drf(rptr<0>(ma)->orig()); @@ -342,7 +342,7 @@ namespace CNORXZ } template - auto anonToDynView(MutableMultiArrayBase& ma) + auto anonToDynView(MutableArrayBase& ma) -> Slice { DynamicRangeFactory drf(rptr<0>(ma)->orig()); @@ -351,8 +351,8 @@ namespace CNORXZ } template - auto dynToAnonMove(MultiArray&& ma) - -> MultiArray + auto dynToAnonMove(Array&& ma) + -> Array { AnonymousRangeFactory arf(rptr<0>(ma)->orig()); auto mNSpace = std::make_tuple( createExplicit( arf ) ); @@ -376,23 +376,23 @@ namespace CNORXZ template auto mkArray(const std::shared_ptr&... rs) - -> MultiArray + -> Array { - return MultiArray(rs...); + return Array(rs...); } template auto mkArray(const std::shared_ptr&... rs, const T& val) - -> MultiArray + -> Array { - return MultiArray(rs..., val); + return Array(rs..., val); } template auto mkArrayPtr(const std::shared_ptr&... rs) - -> std::shared_ptr> + -> std::shared_ptr> { - return std::make_shared>(rs...); + return std::make_shared>(rs...); } } diff --git a/src/include/helper_tools.h b/src/include/helper_tools.h index 71f5788..dc1aab1 100644 --- a/src/include/helper_tools.h +++ b/src/include/helper_tools.h @@ -1,6 +1,6 @@ -#ifndef __helper_tools_h__ -#define __helper_tools_h__ +#ifndef __cxz_helper_tools_h__ +#define __cxz_helper_tools_h__ #include "base_def.h" #include "slice.h" @@ -119,35 +119,35 @@ namespace CNORXZ template auto dynamic(const MArray& ma, bool slice = false) - -> std::shared_ptr>; + -> std::shared_ptr>; template auto mdynamic(MArray& ma, bool slice) - -> std::shared_ptr>; + -> std::shared_ptr>; template - auto anonToDynView(const MultiArrayBase& ma) + auto anonToDynView(const ArrayBase& ma) -> ConstSlice; template - auto anonToDynView(MutableMultiArrayBase& ma) + auto anonToDynView(MutableArrayBase& ma) -> Slice; template - auto dynToAnonMove(MultiArray&& ma) - -> MultiArray; + auto dynToAnonMove(Array&& ma) + -> Array; template - auto anonToDynView(const MultiArrayBase& ma) + auto anonToDynView(const ArrayBase& ma) -> ConstSlice; template - auto anonToDynView(MutableMultiArrayBase& ma) + auto anonToDynView(MutableArrayBase& ma) -> Slice; template - auto dynToAnonMove(MultiArray&& ma) - -> MultiArray; + auto dynToAnonMove(Array&& ma) + -> Array; template auto metaSlice(const std::shared_ptr& r) @@ -159,15 +159,15 @@ namespace CNORXZ template auto mkArray(const std::shared_ptr&... rs) - -> MultiArray; + -> Array; template auto mkArrayPtr(const std::shared_ptr&... rs) - -> std::shared_ptr>; + -> std::shared_ptr>; template auto mkArray(const std::shared_ptr&... rs, const T& val) - -> MultiArray; + -> Array; template auto mkILoop(const OpTp& opTp, const IndTp& indTp, const VarTp& varTp, const LTp& lTp, @@ -214,11 +214,11 @@ namespace CNORXZ template inline auto mkOp(const std::shared_ptr& i) - -> decltype(std::declval decltype(std::declval,typename Index::RangeType> > ().exec(i)) { - FunctionalMultiArray, typename Index::RangeType> fma(i->range()); return fma.exec(i); diff --git a/src/include/high_level_operation.h b/src/include/high_level_operation.h index 71706fa..b2fafa8 100644 --- a/src/include/high_level_operation.h +++ b/src/include/high_level_operation.h @@ -1,6 +1,6 @@ -#ifndef __high_level_operation_h__ -#define __high_level_operation_h__ +#ifndef __cxz_high_level_operation_h__ +#define __cxz_high_level_operation_h__ #include "base_def.h" #include "ranges/rheader.h" diff --git a/src/include/map_range.cc.h b/src/include/map_range.cc.h index 8cc780e..d9c0cd5 100644 --- a/src/include/map_range.cc.h +++ b/src/include/map_range.cc.h @@ -415,7 +415,7 @@ namespace CNORXZ struct OutRangeMaker { template - static void mk(std::shared_ptr& outRange, MultiArray& mapMult, const MapF& mapf) + static void mk(std::shared_ptr& outRange, Array& mapMult, const MapF& mapf) { std::map mult; for(auto ii = mapf.begin(); ii.max() != ii.pos(); ++ii) { @@ -434,7 +434,7 @@ namespace CNORXZ typename ORType::FType orf(outmeta); outRange = std::dynamic_pointer_cast( orf.create() ); - mapMult = MultiArray( outRange, outmult ); + mapMult = Array( outRange, outmult ); } }; @@ -442,7 +442,7 @@ namespace CNORXZ struct OutRangeMaker { template - static void mk(std::shared_ptr& outRange, MultiArray& mapMult, const MapF& mapf) + static void mk(std::shared_ptr& outRange, Array& mapMult, const MapF& mapf) { static_assert( std::is_same::value, "out range value type for NONE must be size_t" ); @@ -464,7 +464,7 @@ namespace CNORXZ typename ORType::FType orf(max); outRange = std::dynamic_pointer_cast( orf.create() ); - mapMult = MultiArray( outRange, outmult ); + mapMult = Array( outRange, outmult ); } }; @@ -472,7 +472,7 @@ namespace CNORXZ template void GenMapRange::mkOutRange(const MA& mapf) { - //FunctionalMultiArray fma(mSpace, mMapf); + //FunctionalArray fma(mSpace, mMapf); OutRangeMaker::mk(mOutRange,mMapMult,mapf); auto i = mapf.begin(); mMapPos.resize(i.max()); @@ -666,7 +666,7 @@ namespace CNORXZ template auto GenMapRange::mapMultiplicity() const - -> const MultiArray& + -> const Array& { return mMapMult; } diff --git a/src/include/map_range.h b/src/include/map_range.h index 9532f2b..024a7f5 100644 --- a/src/include/map_range.h +++ b/src/include/map_range.h @@ -1,7 +1,7 @@ // -*- C++ -*- -#ifndef __map_range_h__ -#define __map_range_h__ +#ifndef __cxz_map_range_h__ +#define __cxz_map_range_h__ #include #include @@ -29,12 +29,12 @@ namespace CNORXZ template auto mkMapOp(const std::shared_ptr& func, const std::shared_ptr&... is) - -> decltype(std::make_tuple(FunctionalMultiArray decltype(std::make_tuple(FunctionalArray().exec(is...), - FunctionalMultiArray())) { - typedef FunctionalMultiArray FMA; + typedef FunctionalArray FMA; if(Func::FISSTATIC){ FMA fma(is->range()...); return std::make_tuple(fma.exec(is...),fma); @@ -277,7 +277,7 @@ namespace CNORXZ Op mMapf; //Op mMapf; std::shared_ptr mOutRange; - MultiArray mMapMult; + Array mMapMult; vector mMapPos; private: @@ -314,7 +314,7 @@ namespace CNORXZ virtual IndexType begin() const final; virtual IndexType end() const final; - const MultiArray& mapMultiplicity() const; + const Array& mapMultiplicity() const; ConstSlice explMapMultiplicity() const; vector mapPos() const; diff --git a/src/include/map_range_factory_product_map.h b/src/include/map_range_factory_product_map.h index cc89ed2..8406e07 100644 --- a/src/include/map_range_factory_product_map.h +++ b/src/include/map_range_factory_product_map.h @@ -1,6 +1,6 @@ -#ifndef __map_range_factory_product_map_h__ -#define __map_range_factory_product_map_h__ +#ifndef __cxz_map_range_factory_product_map_h__ +#define __cxz_map_range_factory_product_map_h__ #include #include diff --git a/src/include/mbase_def.h b/src/include/mbase_def.h index 39eb5a4..16b07cd 100644 --- a/src/include/mbase_def.h +++ b/src/include/mbase_def.h @@ -1,6 +1,6 @@ -#ifndef __mbase_def_h__ -#define __mbase_def_h__ +#ifndef __cxz_mbase_def_h__ +#define __cxz_mbase_def_h__ #include "ranges/rbase_def.h" #include "allocator.h" @@ -23,15 +23,15 @@ namespace CNORXZ // cxz_array.h template - class MultiArrayBase; + class ArrayBase; // cxz_array.h template - class MutableMultiArrayBase; + class MutableArrayBase; // cxz_array.h template - class MultiArray; + class Array; // cxz_operation.h template diff --git a/src/include/operation_def.h b/src/include/operation_def.h index 287970c..7dcb685 100644 --- a/src/include/operation_def.h +++ b/src/include/operation_def.h @@ -1,6 +1,6 @@ -#ifndef __operation_def_h__ -#define __operation_def_h__ +#ifndef __cxz_operation_def_h__ +#define __cxz_operation_def_h__ #include "cxz_operation.h" diff --git a/src/include/ranges/anonymous_range.h b/src/include/ranges/anonymous_range.h index 031d0c0..643a159 100644 --- a/src/include/ranges/anonymous_range.h +++ b/src/include/ranges/anonymous_range.h @@ -1,7 +1,7 @@ // -*- C++ -*- -#ifndef __anonymous_range_h__ -#define __anonymous_range_h__ +#ifndef __cxz_anonymous_range_h__ +#define __cxz_anonymous_range_h__ #include #include diff --git a/src/include/ranges/dynamic_meta.h b/src/include/ranges/dynamic_meta.h index 51535aa..a1a4d60 100644 --- a/src/include/ranges/dynamic_meta.h +++ b/src/include/ranges/dynamic_meta.h @@ -1,6 +1,6 @@ -#ifndef __dynamic_meta_h__ -#define __dynamic_meta_h__ +#ifndef __cxz_dynamic_meta_h__ +#define __cxz_dynamic_meta_h__ #include #include diff --git a/src/include/ranges/dynamic_range.h b/src/include/ranges/dynamic_range.h index f0075c6..e69f487 100644 --- a/src/include/ranges/dynamic_range.h +++ b/src/include/ranges/dynamic_range.h @@ -1,6 +1,6 @@ -#ifndef __dynamic_range_h__ -#define __dynamic_range_h__ +#ifndef __cxz_dynamic_range_h__ +#define __cxz_dynamic_range_h__ #include #include diff --git a/src/include/ranges/index_base.h b/src/include/ranges/index_base.h index 9c0c4b2..627a907 100644 --- a/src/include/ranges/index_base.h +++ b/src/include/ranges/index_base.h @@ -1,7 +1,7 @@ // -*- C++ -*- -#ifndef __index_base_h__ -#define __index_base_h__ +#ifndef __cxz_index_base_h__ +#define __cxz_index_base_h__ #include #include diff --git a/src/include/ranges/index_type.h b/src/include/ranges/index_type.h index ac5e0fd..c57938f 100644 --- a/src/include/ranges/index_type.h +++ b/src/include/ranges/index_type.h @@ -1,6 +1,6 @@ -#ifndef __index_type_h__ -#define __index_type_h__ +#ifndef __cxz_index_type_h__ +#define __cxz_index_type_h__ namespace CNORXZ { diff --git a/src/include/ranges/index_wrapper.h b/src/include/ranges/index_wrapper.h index 580412e..28efcf6 100644 --- a/src/include/ranges/index_wrapper.h +++ b/src/include/ranges/index_wrapper.h @@ -1,6 +1,6 @@ -#ifndef __index_wrapper_h__ -#define __index_wrapper_h__ +#ifndef __cxz_index_wrapper_h__ +#define __cxz_index_wrapper_h__ #include "ranges/rbase_def.h" #include "xfor/xfor.h" diff --git a/src/include/ranges/multi_range.h b/src/include/ranges/multi_range.h index 3ab22d6..6efda26 100644 --- a/src/include/ranges/multi_range.h +++ b/src/include/ranges/multi_range.h @@ -1,7 +1,7 @@ // -*- C++ -*- -#ifndef __multi_range_h__ -#define __multi_range_h__ +#ifndef __cxz_multi_range_h__ +#define __cxz_multi_range_h__ #include #include diff --git a/src/include/ranges/multi_range_factory_product_map.h b/src/include/ranges/multi_range_factory_product_map.h index 6630b1d..adba8ce 100644 --- a/src/include/ranges/multi_range_factory_product_map.h +++ b/src/include/ranges/multi_range_factory_product_map.h @@ -1,6 +1,6 @@ -#ifndef __multi_range_factory_product_map_h__ -#define __multi_range_factory_product_map_h__ +#ifndef __cxz_multi_range_factory_product_map_h__ +#define __cxz_multi_range_factory_product_map_h__ #include #include diff --git a/src/include/ranges/range_base.h b/src/include/ranges/range_base.h index a701e3d..548d3da 100644 --- a/src/include/ranges/range_base.h +++ b/src/include/ranges/range_base.h @@ -1,7 +1,7 @@ // -*- C++ -*- -#ifndef __range_base_h__ -#define __range_base_h__ +#ifndef __cxz_range_base_h__ +#define __cxz_range_base_h__ #include #include diff --git a/src/include/ranges/range_helper.h b/src/include/ranges/range_helper.h index 53f1462..d60f78a 100644 --- a/src/include/ranges/range_helper.h +++ b/src/include/ranges/range_helper.h @@ -1,6 +1,6 @@ -#ifndef __range_helper_h__ -#define __range_helper_h__ +#ifndef __cxz_range_helper_h__ +#define __cxz_range_helper_h__ namespace CNORXZ { diff --git a/src/include/ranges/range_types/classic_range.h b/src/include/ranges/range_types/classic_range.h index 492d66a..dccd37e 100644 --- a/src/include/ranges/range_types/classic_range.h +++ b/src/include/ranges/range_types/classic_range.h @@ -4,11 +4,11 @@ //#else #ifndef include_range_type -#ifdef __ranges_header__ +#ifdef __cxz_ranges_header__ // assert, that this is only used within range_types/header.h -#ifndef __range_type_classic_def__ -#define __range_type_classic_def__ +#ifndef __cxz_range_type_classic_def__ +#define __cxz_range_type_classic_def__ namespace CNORXZ { @@ -80,8 +80,8 @@ namespace CNORXZ } -#endif // #ifndef __range_type_classic_def__ +#endif // #ifndef __cxz_range_type_classic_def__ -#endif // #ifdef __ranges_header__ +#endif // #ifdef __cxz_ranges_header__ #endif // #ifdef include_range_type diff --git a/src/include/ranges/range_types/header.h b/src/include/ranges/range_types/header.h index 6fef0a9..2026d20 100644 --- a/src/include/ranges/range_types/header.h +++ b/src/include/ranges/range_types/header.h @@ -1,19 +1,19 @@ #ifdef include_range_type -#define __incl_this__ +#define __cxz_incl_this__ #endif -#ifdef __single_range_h__ +#ifdef __cxz_single_range_h__ // singel_range is template which is specialized here // therefore it must be defined before... -#define __incl_this__ +#define __cxz_incl_this__ #endif -#ifdef __incl_this__ +#ifdef __cxz_incl_this__ -#define __ranges_header__ -//#ifndef __ranges_header__ -//#define __ranges_header__ +#define __cxz_ranges_header__ +//#ifndef __cxz_ranges_header__ +//#define __cxz_ranges_header__ #include "null_range.h" #include "spin_range.h" diff --git a/src/include/ranges/range_types/null_range.h b/src/include/ranges/range_types/null_range.h index b87e39e..810ce30 100644 --- a/src/include/ranges/range_types/null_range.h +++ b/src/include/ranges/range_types/null_range.h @@ -4,11 +4,11 @@ include_range_type(NUL,-2) #else -#ifdef __ranges_header__ +#ifdef __cxz_ranges_header__ // assert, that this is only used within range_types/header.h -#ifndef __range_type_null_def__ -#define __range_type_null_def__ +#ifndef __cxz_range_type_null_def__ +#define __cxz_range_type_null_def__ namespace CNORXZ { @@ -89,8 +89,8 @@ namespace CNORXZ } -#endif // #ifndef __range_type_null_def__ +#endif // #ifndef __cxz_range_type_null_def__ -#endif // #ifdef __ranges_header__ +#endif // #ifdef __cxz_ranges_header__ #endif // #ifdef include_range_type diff --git a/src/include/ranges/range_types/space_range.h b/src/include/ranges/range_types/space_range.h index badc9d7..3c3c6a5 100644 --- a/src/include/ranges/range_types/space_range.h +++ b/src/include/ranges/range_types/space_range.h @@ -3,10 +3,10 @@ include_range_type(PSPACE,3) // Periodic 1dim space #else -#ifdef __ranges_header__ +#ifdef __cxz_ranges_header__ -#ifndef __range_type_space_def__ -#define __range_type_space_def__ +#ifndef __cxz_range_type_space_def__ +#define __cxz_range_type_space_def__ namespace CNORXZ { @@ -128,8 +128,8 @@ namespace CNORXZ using MSpaceRF = decltype(CreateNDimSpaceRange::template mkf()); } -#endif // #ifndef __range_type_space_def__ +#endif // #ifndef __cxz_range_type_space_def__ -#endif // #ifdef __ranges_header__ +#endif // #ifdef __cxz_ranges_header__ #endif // #ifdef include_range_type diff --git a/src/include/ranges/range_types/spin_range.h b/src/include/ranges/range_types/spin_range.h index 256f9be..c88dcb7 100644 --- a/src/include/ranges/range_types/spin_range.h +++ b/src/include/ranges/range_types/spin_range.h @@ -4,11 +4,11 @@ include_range_type(SPIN,2) #else -#ifdef __ranges_header__ +#ifdef __cxz_ranges_header__ // assert, that this is only used within range_types/header.h -#ifndef __range_type_spin_def__ -#define __range_type_spin_def__ +#ifndef __cxz_range_type_spin_def__ +#define __cxz_range_type_spin_def__ namespace CNORXZ { @@ -82,8 +82,8 @@ namespace CNORXZ } -#endif // #ifndef __range_type_spin_def__ +#endif // #ifndef __cxz_range_type_spin_def__ -#endif // #ifdef __ranges_header__ +#endif // #ifdef __cxz_ranges_header__ #endif // #ifdef include_range_type diff --git a/src/include/ranges/rbase_def.h b/src/include/ranges/rbase_def.h index 2aa04fa..57a1943 100644 --- a/src/include/ranges/rbase_def.h +++ b/src/include/ranges/rbase_def.h @@ -1,7 +1,7 @@ // -*- C++ -*- -#ifndef __ranges_base_def_h__ -#define __ranges_base_def_h__ +#ifndef __cxz_ranges_base_def_h__ +#define __cxz_ranges_base_def_h__ #include diff --git a/src/include/ranges/reg_ind_num.h b/src/include/ranges/reg_ind_num.h index c7b9640..6fc4bd4 100644 --- a/src/include/ranges/reg_ind_num.h +++ b/src/include/ranges/reg_ind_num.h @@ -1,6 +1,6 @@ -#ifndef __reg_ind_num_h__ -#define __reg_ind_num_h__ +#ifndef __cxz_reg_ind_num_h__ +#define __cxz_reg_ind_num_h__ diff --git a/src/include/ranges/rheader.h b/src/include/ranges/rheader.h index 6c88ee0..c9ea0c4 100644 --- a/src/include/ranges/rheader.h +++ b/src/include/ranges/rheader.h @@ -1,6 +1,6 @@ -//#ifndef __rheader_h__ -//#define __rheader_h__ +//#ifndef __cxz_rheader_h__ +//#define __cxz_rheader_h__ #include "dynamic_range.h" #include "rpheader.h" diff --git a/src/include/ranges/rpheader.h b/src/include/ranges/rpheader.h index 3de270f..c6ecd37 100644 --- a/src/include/ranges/rpheader.h +++ b/src/include/ranges/rpheader.h @@ -1,6 +1,6 @@ -//#ifndef __rpheader_h__ -//#define __rpheader_h__ +//#ifndef __cxz_rpheader_h__ +//#define __cxz_rpheader_h__ #include "single_range.h" #include "multi_range.h" diff --git a/src/include/ranges/single_range.h b/src/include/ranges/single_range.h index 17d5887..c6e417f 100644 --- a/src/include/ranges/single_range.h +++ b/src/include/ranges/single_range.h @@ -1,7 +1,7 @@ // -*- C++ -*- -#ifndef __single_range_h__ -#define __single_range_h__ +#ifndef __cxz_single_range_h__ +#define __cxz_single_range_h__ #include #include diff --git a/src/include/ranges/subrange.h b/src/include/ranges/subrange.h index e34bea7..c1b128c 100644 --- a/src/include/ranges/subrange.h +++ b/src/include/ranges/subrange.h @@ -1,6 +1,6 @@ -#ifndef __subrange_h__ -#define __subrange_h__ +#ifndef __cxz_subrange_h__ +#define __cxz_subrange_h__ #include #include diff --git a/src/include/ranges/type_map.h b/src/include/ranges/type_map.h index 3f65c7b..5e41ad1 100644 --- a/src/include/ranges/type_map.h +++ b/src/include/ranges/type_map.h @@ -1,6 +1,6 @@ -#ifndef __ma_type_map_h__ -#define __ma_type_map_h__ +#ifndef __cxz_type_map_h__ +#define __cxz_type_map_h__ #include #include diff --git a/src/include/ranges/value_range.h b/src/include/ranges/value_range.h index db236e1..fd9b0ec 100644 --- a/src/include/ranges/value_range.h +++ b/src/include/ranges/value_range.h @@ -1,6 +1,6 @@ -#ifndef __value_range_h__ -#define __value_range_h__ +#ifndef __cxz_value_range_h__ +#define __cxz_value_range_h__ #include #include diff --git a/src/include/ranges/x_to_string.h b/src/include/ranges/x_to_string.h index aa66616..547d657 100644 --- a/src/include/ranges/x_to_string.h +++ b/src/include/ranges/x_to_string.h @@ -1,6 +1,6 @@ -#ifndef __x_to_string_h__ -#define __x_to_string_h__ +#ifndef __cxz_x_to_string_h__ +#define __cxz_x_to_string_h__ #include #include diff --git a/src/include/slice.cc.h b/src/include/slice.cc.h index 5a118e3..84a9338 100644 --- a/src/include/slice.cc.h +++ b/src/include/slice.cc.h @@ -17,7 +17,7 @@ namespace CNORXZ template ConstSlice::ConstSlice(const std::tuple...>& ranges, const T* data) : - MultiArrayBase(ranges), + ArrayBase(ranges), mData(data) { MAB::mInit = true; @@ -25,15 +25,15 @@ namespace CNORXZ template ConstSlice::ConstSlice(const std::shared_ptr&... ranges, const T* data) : - MultiArrayBase(ranges...), + ArrayBase(ranges...), mData(data) { MAB::mInit = true; } template - ConstSlice::ConstSlice(const MultiArrayBase& ma, SIZET... sizes) : - MultiArrayBase + ConstSlice::ConstSlice(const ArrayBase& ma, SIZET... sizes) : + ArrayBase ( ma.range()->template get<0>().template scast(sizes...)->space() ), mData( ma.data() ) { @@ -87,7 +87,7 @@ namespace CNORXZ } template - std::shared_ptr > ConstSlice::anonymous(bool slice) const + std::shared_ptr > ConstSlice::anonymous(bool slice) const { assert(slice); assert(not MAB::mProtoI->sliceMode()); // only originally ordered slices! @@ -118,13 +118,13 @@ namespace CNORXZ template Slice::Slice(const std::shared_ptr&... ranges, T* data) : - MutableMultiArrayBase(ranges...), + MutableArrayBase(ranges...), mData(data) {} template Slice::Slice(const std::tuple...>& ranges, T* data) : - MutableMultiArrayBase(ranges), + MutableArrayBase(ranges), mData(data) { MAB::mInit = true; @@ -208,14 +208,14 @@ namespace CNORXZ } template - std::shared_ptr > Slice::anonymous(bool slice) const + std::shared_ptr > Slice::anonymous(bool slice) const { assert(0); // think about carefully!!!! return nullptr; } /* template - std::shared_ptr > Slice::anonymousMove() + std::shared_ptr > Slice::anonymousMove() { assert(0); // think about carefully!!!! return nullptr; diff --git a/src/include/slice.h b/src/include/slice.h index 68b4c27..dbc9a01 100644 --- a/src/include/slice.h +++ b/src/include/slice.h @@ -1,6 +1,6 @@ -#ifndef __slice_h__ -#define __slice_h__ +#ifndef __cxz_slice_h__ +#define __cxz_slice_h__ #include "cxz_array_base.h" #include "cxz_operation.h" @@ -8,23 +8,23 @@ namespace CNORXZ { template - class ConstSlice : public MultiArrayBase + class ConstSlice : public ArrayBase { public: typedef ContainerRange CRange; - typedef MultiArrayBase MAB; + typedef ArrayBase MAB; typedef ConstContainerIndex IType; - using MultiArrayBase::operator(); - using MultiArrayBase::operator[]; + using ArrayBase::operator(); + using ArrayBase::operator[]; DEFAULT_MEMBERS(ConstSlice); ConstSlice(const std::tuple...>& ranges, const T* data = nullptr); ConstSlice(const std::shared_ptr&... ranges, const T* data = nullptr); - ConstSlice(const MultiArrayBase& ma, SIZET... sizes); + ConstSlice(const ArrayBase& ma, SIZET... sizes); virtual const T& operator[](const IType& i) const final; virtual const T& at(const typename IType::MetaType& meta) const override; @@ -36,7 +36,7 @@ namespace CNORXZ virtual auto begin() const -> IType override; virtual auto end() const -> IType override; - virtual std::shared_ptr > anonymous(bool slice = false) const override; + virtual std::shared_ptr > anonymous(bool slice = false) const override; auto define(const std::shared_ptr&... inds) -> ConstSliceDef; @@ -51,18 +51,18 @@ namespace CNORXZ template - class Slice : public MutableMultiArrayBase + class Slice : public MutableArrayBase { public: typedef ContainerRange CRange; - typedef MultiArrayBase MAB; + typedef ArrayBase MAB; typedef ConstContainerIndex IType; - using MultiArrayBase::operator(); - using MutableMultiArrayBase::operator(); - using MultiArrayBase::operator[]; - using MutableMultiArrayBase::operator[]; + using ArrayBase::operator(); + using MutableArrayBase::operator(); + using ArrayBase::operator[]; + using MutableArrayBase::operator[]; DEFAULT_MEMBERS(Slice); @@ -85,8 +85,8 @@ namespace CNORXZ virtual auto begin() const -> IType override; virtual auto end() const -> IType override; - virtual std::shared_ptr > anonymous(bool slice = false) const override; - //virtual std::shared_ptr > anonymousMove() override; + virtual std::shared_ptr > anonymous(bool slice = false) const override; + //virtual std::shared_ptr > anonymousMove() override; auto define(const std::shared_ptr&... inds) -> SliceDef; diff --git a/src/include/statics/static_for.h b/src/include/statics/static_for.h index d8758ed..63ff959 100644 --- a/src/include/statics/static_for.h +++ b/src/include/statics/static_for.h @@ -1,6 +1,6 @@ -#ifndef __static_for_h__ -#define __static_for_h__ +#ifndef __cxz_static_for_h__ +#define __cxz_static_for_h__ #include diff --git a/src/include/statics/traits.h b/src/include/statics/traits.h index 2a97631..9f16627 100644 --- a/src/include/statics/traits.h +++ b/src/include/statics/traits.h @@ -14,10 +14,10 @@ namespace CNORXZ static constexpr bool VALUE = true; \ } - add_array_trait(MultiArrayBase); - add_array_trait(MutableMultiArrayBase); - add_array_trait(MultiArray); - add_array_trait(FunctionalMultiArray); + add_array_trait(ArrayBase); + add_array_trait(MutableArrayBase); + add_array_trait(Array); + add_array_trait(FunctionalArray); add_array_trait(Slice); add_array_trait(ConstSlice); diff --git a/src/include/type_operations.h b/src/include/type_operations.h index acebd59..60a6f74 100644 --- a/src/include/type_operations.h +++ b/src/include/type_operations.h @@ -1,6 +1,6 @@ -#ifndef __type_operations_h__ -#define __type_operations_h__ +#ifndef __cxz_type_operations_h__ +#define __cxz_type_operations_h__ #include #include @@ -20,7 +20,7 @@ namespace CNORXZ using namespace CNORXZInternal; } - // MultiArray + // Array template class operate @@ -30,7 +30,7 @@ namespace CNORXZ operate(const std::shared_ptr&... inds) : ituple(inds...) {} - inline auto apply(const MultiArray& ma) + inline auto apply(const Array& ma) -> OperationRoot { return unpack<0,sizeof...(Ranges),0> @@ -46,9 +46,9 @@ namespace CNORXZ }; template - class OperationTemplate,OperationClass> : public OperationBase,OperationClass> + class OperationTemplate,OperationClass> : public OperationBase,OperationClass> { - typedef OperationBase,OperationClass> OB; + typedef OperationBase,OperationClass> OB; auto operator()(const std::shared_ptr&... indices) -> Operation,operate,OperationClass> diff --git a/src/include/xfor/exttype.h b/src/include/xfor/exttype.h index fc72b50..1ff460a 100644 --- a/src/include/xfor/exttype.h +++ b/src/include/xfor/exttype.h @@ -1,6 +1,6 @@ -#ifndef __exttype_h__ -#define __exttype_h__ +#ifndef __cxz_exttype_h__ +#define __cxz_exttype_h__ #include diff --git a/src/include/xfor/for_type.h b/src/include/xfor/for_type.h index 7880ed7..6833c99 100644 --- a/src/include/xfor/for_type.h +++ b/src/include/xfor/for_type.h @@ -1,6 +1,6 @@ -#ifndef __for_type_h__ -#define __for_type_h__ +#ifndef __cxz_for_type_h__ +#define __cxz_for_type_h__ namespace CNORXZInternal { diff --git a/src/include/xfor/for_utils.h b/src/include/xfor/for_utils.h index 5722d7e..453ea53 100644 --- a/src/include/xfor/for_utils.h +++ b/src/include/xfor/for_utils.h @@ -1,6 +1,6 @@ -#ifndef __for_utils_h__ -#define __for_utils_h__ +#ifndef __cxz_for_utils_h__ +#define __cxz_for_utils_h__ //#include "ranges/rheader.h" #include diff --git a/src/include/xfor/iloop.h b/src/include/xfor/iloop.h index c54aaad..8c74ae9 100644 --- a/src/include/xfor/iloop.h +++ b/src/include/xfor/iloop.h @@ -1,6 +1,6 @@ -#ifndef __ma_iloop_h__ -#define __ma_iloop_h__ +#ifndef __cxz_iloop_h__ +#define __cxz_iloop_h__ #include #include diff --git a/src/include/xfor/xfor.h b/src/include/xfor/xfor.h index 2125538..3880b6c 100644 --- a/src/include/xfor/xfor.h +++ b/src/include/xfor/xfor.h @@ -1,6 +1,6 @@ -#ifndef __xfor_h__ -#define __xfor_h__ +#ifndef __cxz_xfor_h__ +#define __cxz_xfor_h__ #include #include diff --git a/src/lib/ranges/anonymous_range.cc b/src/lib/ranges/anonymous_range.cc index 9f2f652..acf7266 100644 --- a/src/lib/ranges/anonymous_range.cc +++ b/src/lib/ranges/anonymous_range.cc @@ -1,7 +1,7 @@ #include "ranges/anonymous_range.h" #include "ranges/ranges_header.cc.h" -#include "ma_assert.h" +#include "cxz_assert.h" namespace CNORXZ { diff --git a/src/lib/ranges/dynamic_range.cc b/src/lib/ranges/dynamic_range.cc index fc02940..2ec7bfe 100644 --- a/src/lib/ranges/dynamic_range.cc +++ b/src/lib/ranges/dynamic_range.cc @@ -1,7 +1,7 @@ #include "ranges/dynamic_range.h" #include "ranges/ranges_header.cc.h" -#include "ma_assert.h" +#include "cxz_assert.h" namespace CNORXZ { diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index bad8c59..fa99e9a 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -10,8 +10,8 @@ add_dependencies(autest multiarray) target_link_libraries(autest ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} multiarray) add_test(NAME autest COMMAND autest) -#add_executable(mautest src/tests/ma_unit_test.cc ${MA_CC_FILES}) -add_executable(mautest ma_unit_test.cc) +#add_executable(mautest src/tests/array_unit_test.cc ${MA_CC_FILES}) +add_executable(mautest array_unit_test.cc) add_dependencies(mautest multiarray) target_link_libraries(mautest ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} multiarray) add_test(NAME mautest COMMAND mautest) diff --git a/src/tests/ma_unit_test.cc b/src/tests/array_unit_test.cc similarity index 94% rename from src/tests/ma_unit_test.cc rename to src/tests/array_unit_test.cc index bc85a74..1fa0e55 100644 --- a/src/tests/ma_unit_test.cc +++ b/src/tests/array_unit_test.cc @@ -98,7 +98,7 @@ namespace { TEST_F(MATest_1Dim, SimpleCall) { - MultiArray ma(srptr, vv); + Array ma(srptr, vv); EXPECT_EQ( ma.size(), 5u); EXPECT_EQ( ma.isConst(), false); EXPECT_EQ( ma.isSlice(), false); @@ -115,7 +115,7 @@ namespace { TEST_F(MATest_1Dim, ForLoop) { vector v2 = { 0.693 , 2.718, 3.141, 1.618, 9.98 }; - MultiArray ma(srptr, std::move( v2 ) ); + Array ma(srptr, std::move( v2 ) ); size_t cnt = 0; for(auto el: ma){ @@ -142,7 +142,7 @@ namespace { swapFactory( rfbptr, { 'a', 'c', 'e', 'g', 'i' } ); std::shared_ptr sr2 = std::dynamic_pointer_cast( rfbptr->create() ); - MultiArray ma(srptr, vv); + Array ma(srptr, vv); auto i = ma.cbegin(); EXPECT_EQ( ma[ i.at('x') ], 3.141); @@ -158,7 +158,7 @@ namespace { TEST_F(MATest_MDim, SimpleCall) { - MultiArray ma(mrptr, sr3ptr, vv); + Array ma(mrptr, sr3ptr, vv); EXPECT_EQ( ma.size(), 24u ); EXPECT_EQ( ma.range()->dim(), 2u ); @@ -175,7 +175,7 @@ namespace { TEST_F(MATest_MDim, ReFormat) { - MultiArray ma(mrptr, sr3ptr, vv); + Array ma(mrptr, sr3ptr, vv); auto ma2 = ma.format( sr4ptr ); auto i = ma2.cbegin(); @@ -188,7 +188,7 @@ namespace { TEST_F(MATest_MDim, SliceTest1) { - MultiArray ma(mrptr, sr3ptr, vv); + Array ma(mrptr, sr3ptr, vv); Slice sl(sr3ptr); auto i = MAT::getIndex(sr3ptr); diff --git a/src/tests/op2_unit_test.cc b/src/tests/op2_unit_test.cc index 4d5be4d..0e7eb7d 100644 --- a/src/tests/op2_unit_test.cc +++ b/src/tests/op2_unit_test.cc @@ -119,7 +119,7 @@ namespace TEST_F(MapTest, Exec1) { - MultiArray ma1(sr1ptr,sr2ptr,v1); + Array ma1(sr1ptr,sr2ptr,v1); auto ii1 = getIndex( rptr<0>( ma1 ) ); @@ -127,8 +127,8 @@ namespace auto mr = mkMapR( mkMapOp(std::make_shared>(),ii1,ii2) , sr1ptr, sr2ptr ); //auto mr = mkMapR(std::make_shared>(),sr1ptr,sr2ptr); - MultiArray res(mr); - MultiArray res2(mr); + Array res(mr); + Array res2(mr); auto jj = getIndex( mr ); (*jj)(ii1,ii2); ///auto jj = mkMapI( std::make_shared >(), ii1, ii1 ); @@ -137,8 +137,8 @@ namespace auto mult = mr->explMapMultiplicity(); res2(jj) += ma1(ii1,ii2) / staticcast( mult(jj) ); - MultiArray form = res.format(mpr1ptr->outRange()); - MultiArray form2 = res2.format(mpr1ptr->outRange()); + Array form = res.format(mpr1ptr->outRange()); + Array form2 = res2.format(mpr1ptr->outRange()); EXPECT_EQ( jj->range()->outRange()->size(), static_cast( 10 ) ); EXPECT_EQ( jj->range()->mapMultiplicity().at(9), static_cast( 3 ) ); @@ -169,7 +169,7 @@ namespace TEST_F(MetaOp_Test, SimpleCall) { - FunctionalMultiArray,SR,SR> fma(sr1ptr, sr2ptr); + FunctionalArray,SR,SR> fma(sr1ptr, sr2ptr); auto i = fma.begin(); @@ -178,8 +178,8 @@ namespace TEST_F(MetaOp_Test, Operation) { - FunctionalMultiArray,SR,SR> fma(sr1ptr, sr2ptr); - MultiArray res( sr1ptr ); + FunctionalArray,SR,SR> fma(sr1ptr, sr2ptr); + Array res( sr1ptr ); auto i1 = MAT::getIndex(sr1ptr); auto i2 = MAT::getIndex(sr2ptr); @@ -203,14 +203,14 @@ namespace TEST_F(OpTest_Sub, Exec) { - MultiArray ma1(sr1ptr, sr2ptr, sr3ptr, v1); - MultiArray ma2(sr3ptr, sr2ptr, v2); + Array ma1(sr1ptr, sr2ptr, sr3ptr, v1); + Array ma2(sr3ptr, sr2ptr, v2); SubRangeFactory subf(sr2ptr, vector({0,2})); auto subptr = MAT::createExplicit(subf); - MultiArray res(sr3ptr,sr1ptr,0.); - MultiArray,SRange> res2(sr3ptr,subptr,sr1ptr,0.); + Array res(sr3ptr,sr1ptr,0.); + Array,SRange> res2(sr3ptr,subptr,sr1ptr,0.); auto i1 = MAT::getIndex( sr1ptr ); auto i2 = MAT::getIndex( sr2ptr ); diff --git a/src/tests/op3_unit_test.cc b/src/tests/op3_unit_test.cc index e211634..f69213a 100644 --- a/src/tests/op3_unit_test.cc +++ b/src/tests/op3_unit_test.cc @@ -31,9 +31,9 @@ namespace TEST_F(OpTest_Spin, Contract) { - MultiArray ma(sr, sr, sr, sr, sr, sr, sr, sr, data); - MultiArray res1( sr, sr ); - MultiArray res2( sr, sr ); + Array ma(sr, sr, sr, sr, sr, sr, sr, sr, data); + Array res1( sr, sr ); + Array res2( sr, sr ); auto alpha = MAT::getIndex(); auto beta = MAT::getIndex(); @@ -47,7 +47,7 @@ namespace res1(delta, deltap) += ma(delta, alpha, alpha, beta, beta, gamma, gamma, deltap).c(mix); //res1(delta, deltap) += ma(delta, alpha, alpha, beta, beta, gamma, gamma, deltap); std::clock_t end = std::clock(); - std::cout << "MultiArray time: " << static_cast( end - begin ) / CLOCKS_PER_SEC + std::cout << "Array time: " << static_cast( end - begin ) / CLOCKS_PER_SEC << std::endl; res2(delta, deltap).par() += ma(delta, alpha, alpha, beta, beta, gamma, gamma, deltap).c(alpha).c(beta).c(gamma); diff --git a/src/tests/op4_unit_test.cc b/src/tests/op4_unit_test.cc index 0dd6c16..de0436a 100644 --- a/src/tests/op4_unit_test.cc +++ b/src/tests/op4_unit_test.cc @@ -43,13 +43,13 @@ namespace { protected: - MultiArray ma1; - MultiArray ma2; - MultiArray ma3; - MultiArray ma5; + Array ma1; + Array ma2; + Array ma3; + Array ma5; - MultiArray res1; - MultiArray res2; + Array res1; + Array res2; std::map> imap; diff --git a/src/tests/op_perf_test.cc b/src/tests/op_perf_test.cc index 6e32837..6c8bf50 100644 --- a/src/tests/op_perf_test.cc +++ b/src/tests/op_perf_test.cc @@ -165,8 +165,8 @@ namespace { void OpTest_Spin::contract() { - MultiArray ma( sr, sr, sr, sr, sr, sr, sr, sr, data); - MultiArray res1( cr, sr, sr ); + Array ma( sr, sr, sr, sr, sr, sr, sr, sr, data); + Array res1( cr, sr, sr ); auto ii = MAT::getIndex(cr); auto jj = MAT::getIndex(cr); @@ -221,7 +221,7 @@ namespace { //tcast(res1)(ii ,delta, deltap).par() += tcast(ma)(delta, alpha, alpha, beta, beta, gamma, gamma, deltap).c(mix); //} auto end = std::chrono::system_clock::now(); - std::cout << "MultiArray time: " << std::chrono::duration(end-begin).count() + std::cout << "Array time: " << std::chrono::duration(end-begin).count() << std::endl; assert( xround(res1.at(mkts(0,0,0))) == xround(vres[0]) ); @@ -251,9 +251,9 @@ namespace { #ifndef ONLY_SPIN void OpTest_Performance::PCheck() { - MultiArray ma2(mrptr, cv2); - MultiArray ma1(sr1ptr, cv1); - MultiArray res(mrptr); + Array ma2(mrptr, cv2); + Array ma1(sr1ptr, cv1); + Array res(mrptr); auto si1 = MAT::getIndex(sr1ptr); auto si2 = MAT::getIndex(sr2ptr); @@ -265,7 +265,7 @@ namespace { res(mi) = ma2(mi) * ma1(si1); std::clock_t end = std::clock(); - std::cout << "MultiArray time: " << static_cast( end - begin ) / CLOCKS_PER_SEC + std::cout << "Array time: " << static_cast( end - begin ) / CLOCKS_PER_SEC << std::endl; vector res2(vs1*vs2); diff --git a/src/tests/op_unit_test.cc b/src/tests/op_unit_test.cc index c0d0e5d..61e8e8c 100644 --- a/src/tests/op_unit_test.cc +++ b/src/tests/op_unit_test.cc @@ -35,7 +35,7 @@ namespace typedef MRF::oType MRange; typedef AnonymousRange ANO; - typedef MultiArray AMA; + typedef Array AMA; OpTest_MDim() { @@ -77,9 +77,9 @@ namespace TEST_F(OpTest_1Dim, ExecOp) { - MultiArray ma1(srptr, v1); - MultiArray ma2(srptr, v2); - MultiArray res(srptr); + Array ma1(srptr, v1); + Array ma2(srptr, v2); + Array res(srptr); auto i = MAT::getIndex( srptr ); @@ -94,10 +94,10 @@ namespace TEST_F(OpTest_MDim, ExecOp1) { - MultiArray res(sr2ptr,sr4ptr); - MultiArray res2(sr2ptr,sr4ptr); - const MultiArray ma1(sr2ptr, v1); - const MultiArray ma2(sr4ptr, v2); + Array res(sr2ptr,sr4ptr); + Array res2(sr2ptr,sr4ptr); + const Array ma1(sr2ptr, v1); + const Array ma2(sr4ptr, v2); auto i1 = MAT::getIndex( sr2ptr ); auto i2 = MAT::getIndex( sr4ptr ); @@ -127,9 +127,9 @@ namespace TEST_F(OpTest_MDim, ExecContract) { - MultiArray res(sr2ptr); - const MultiArray ma1(sr2ptr, v1); - const MultiArray ma2(sr4ptr, v2); + Array res(sr2ptr); + const Array ma1(sr2ptr, v1); + const Array ma2(sr4ptr, v2); auto i1 = MAT::getIndex( sr2ptr ); auto i2 = MAT::getIndex( sr4ptr ); @@ -143,10 +143,10 @@ namespace TEST_F(OpTest_MDim, ExecOp2) { - MultiArray res(mr1ptr,sr4ptr); - MultiArray ma1(mr1ptr, v3); - MultiArray ma2(sr4ptr, v2); - MultiArray ma3(sr4ptr, v4); + Array res(mr1ptr,sr4ptr); + Array ma1(mr1ptr, v3); + Array ma2(sr4ptr, v2); + Array ma3(sr4ptr, v4); auto i1 = MAT::getIndex( mr1ptr ); auto i2 = MAT::getIndex( sr4ptr ); @@ -171,10 +171,10 @@ namespace TEST_F(OpTest_MDim, ExecOpAnon) { - MultiArray ma1(mr1ptr, v3); - MultiArray maa - = *std::dynamic_pointer_cast>( ma1.anonymous() ); - MultiArray maa2( maa.template getRangePtr<0>() ); + Array ma1(mr1ptr, v3); + Array maa + = *std::dynamic_pointer_cast>( ma1.anonymous() ); + Array maa2( maa.template getRangePtr<0>() ); auto ar = maa.template getRangePtr<0>(); auto i1 = MAT::getIndex( ar ); @@ -188,10 +188,10 @@ namespace TEST_F(OpTest_MDim, ExecFOp) { - MultiArray res(mr1ptr,sr4ptr); - MultiArray ma1(mr1ptr, v3); - MultiArray ma2(sr4ptr, v2); - MultiArray ma3(sr4ptr, v4); + Array res(mr1ptr,sr4ptr); + Array ma1(mr1ptr, v3); + Array ma2(sr4ptr, v2); + Array ma3(sr4ptr, v4); auto i1 = MAT::getIndex( mr1ptr ); auto i2 = MAT::getIndex( sr4ptr ); @@ -216,13 +216,13 @@ namespace TEST_F(OpTest_MDim, ExecDOp) { - //typedef MultiArray AMA; - typedef MultiArray DMA; + //typedef Array AMA; + typedef Array DMA; - MultiArray ma1(mr1ptr,sr4ptr,v5); - MultiArray ma2(sr2ptr,v1); - MultiArray res(sr4ptr,mr1ptr); - MultiArray res2(mr1ptr,sr4ptr); + Array ma1(mr1ptr,sr4ptr,v5); + Array ma2(sr2ptr,v1); + Array res(sr4ptr,mr1ptr); + Array res2(mr1ptr,sr4ptr); DMA dma1 = *std::dynamic_pointer_cast( dynamic( ma1 ) ); DMA dma2 = *std::dynamic_pointer_cast( dynamic( ma2 ) ); @@ -285,13 +285,13 @@ namespace TEST_F(OpTest_MDim, ExecOp3) { - MultiArray res(mr1ptr,sr4ptr); - MultiArray ma1(mr1ptr, v3); - MultiArray ma2(sr2ptr, v1); - MultiArray ma3(sr4ptr, v4); - MultiArray ma4(sr1ptr,sr2ptr,sr3ptr,sr4ptr); - MultiArray ma5(sr1ptr, v3); - MultiArray ma6(sr3ptr, v2); + Array res(mr1ptr,sr4ptr); + Array ma1(mr1ptr, v3); + Array ma2(sr2ptr, v1); + Array ma3(sr4ptr, v4); + Array ma4(sr1ptr,sr2ptr,sr3ptr,sr4ptr); + Array ma5(sr1ptr, v3); + Array ma6(sr3ptr, v2); auto si0 = MAT::getIndex( sr1ptr ); // 'x' auto si1 = MAT::getIndex( sr2ptr ); // '1' @@ -324,9 +324,9 @@ namespace (*si3) = 0; Slice sl(sr4ptr,sr3ptr); sl.define(si3,si2) = ma4(si0,si1,si2,si3); - MultiArrayBase& slb = sl; + ArrayBase& slb = sl; - MultiArray ma8(sr3ptr,sr4ptr); + Array ma8(sr3ptr,sr4ptr); //ma8(si2,si3) = ma4(si0,si1,si2,si3); ma8(si2,si3) = slb(si3,si2);