im com (cleaning up)

This commit is contained in:
Christian Zimmermann 2017-12-16 20:38:57 +01:00
parent e46abff94c
commit f38b675314
2 changed files with 33 additions and 33 deletions

View file

@ -101,7 +101,7 @@ namespace MultiArrayHelper
{
public:
DEFAULT_MEMBERS(Block);
Block(const std::vector<T>& data, size_t begPos, size_t size, size_t stepSize);
Block(const T* data, size_t begPos, size_t size, size_t stepSize);
BlockType type() const;
const T& operator[](size_t pos) const;
@ -109,7 +109,7 @@ namespace MultiArrayHelper
size_t stepSize() const;
protected:
const std::vector<T>* mData;
const T* mData;
const T* mBegPtr;
size_t mStepSize;
};
@ -119,7 +119,7 @@ namespace MultiArrayHelper
{
public:
DEFAULT_MEMBERS(MBlock);
MBlock(std::vector<T>& data, size_t begPos, size_t size, size_t stepSize);
MBlock(T* data, size_t begPos, size_t size, size_t stepSize);
template <class BlockClass>
MBlock& operator=(const BlockClass& in);
@ -131,7 +131,7 @@ namespace MultiArrayHelper
size_t stepSize() const;
protected:
std::vector<T>* mData;
T* mData;
T* mBegPtr;
size_t mStepSize;
};
@ -229,11 +229,11 @@ namespace MultiArrayHelper
*************/
template <typename T>
Block<T>::Block(const std::vector<T>& data,
Block<T>::Block(const T* data,
size_t begPos, size_t size, size_t stepSize) :
BlockBase<T>(size),
mData(&data),
mBegPtr(data.data() + begPos),
mData(data),
mBegPtr(data + begPos),
mStepSize(stepSize) {}
template <typename T>
@ -253,7 +253,7 @@ namespace MultiArrayHelper
template <typename T>
Block<T>& Block<T>::set(size_t npos)
{
mBegPtr = &(*mData)[npos];
mBegPtr = mData + npos;
return *this;
}
@ -268,11 +268,11 @@ namespace MultiArrayHelper
**************/
template <typename T>
MBlock<T>::MBlock(std::vector<T>& data,
MBlock<T>::MBlock(T* data,
size_t begPos, size_t size, size_t stepSize) :
MutableBlockBase<T>(size),
mData(&data),
mBegPtr(data.data() + begPos),
mData(data),
mBegPtr(data + begPos),
mStepSize(stepSize) {}
template <typename T>
@ -309,7 +309,7 @@ namespace MultiArrayHelper
template <typename T>
MBlock<T>& MBlock<T>::set(size_t npos)
{
mBegPtr = &(*mData)[npos];
mBegPtr = mData + npos;
return *this;
}

View file

@ -43,10 +43,10 @@ namespace MultiArrayTools
bool first, size_t higherStepSize = 1);
template <typename T>
std::shared_ptr<Block<T> > makeBlock(const std::vector<T>& vec, size_t stepSize, size_t blockSize);
Block<T> makeBlock(const T* vec, size_t stepSize, size_t blockSize);
template <typename T>
std::shared_ptr<MBlock<T> > makeBlock(std::vector<T>& vec, size_t stepSize, size_t blockSize);
MBlock<T> makeBlock(T* vec, size_t stepSize, size_t blockSize);
size_t getBTNum(const std::vector<BTSS>& mp, BlockType bt);
@ -113,7 +113,7 @@ namespace MultiArrayTools
OpClass const& mSecond;
MutableMultiArrayBase<T,Ranges...>& mArrayRef;
std::shared_ptr<IndexType> mIndex;
mutable std::shared_ptr<MBlock<T> > mBlockPtr;
mutable MBlock<T> mBlock;
};
@ -141,7 +141,7 @@ namespace MultiArrayTools
MultiArrayBase<T,Ranges...> const& mArrayRef;
std::shared_ptr<IndexType> mIndex;
mutable std::shared_ptr<Block<T> > mBlockPtr;
mutable Block<T> mBlock;
};
template <typename T, class... Ranges>
@ -172,7 +172,7 @@ namespace MultiArrayTools
MutableMultiArrayBase<T,Ranges...>& mArrayRef;
std::shared_ptr<IndexType> mIndex;
mutable std::shared_ptr<MBlock<T> > mBlockPtr;
mutable MBlock<T> mBlock;
};
template <typename T, class OpFunction, class... Ops>
@ -283,15 +283,15 @@ namespace MultiArrayTools
}
template <typename T>
std::shared_ptr<Block<T> > makeBlock(const std::vector<T>& vec, size_t stepSize, size_t blockSize)
Block<T> makeBlock(const T* vec, size_t stepSize, size_t blockSize)
{
return std::make_shared<Block<T> >(vec, 0, blockSize, stepSize);
return Block<T>(vec, 0, blockSize, stepSize);
}
template <typename T>
std::shared_ptr<MBlock<T> > makeBlock(std::vector<T>& vec, size_t stepSize, size_t blockSize)
MBlock<T> makeBlock(T* vec, size_t stepSize, size_t blockSize)
{
return std::make_shared<MBlock<T> >(vec, 0, blockSize, stepSize);
return MBlock<T>(vec, 0, blockSize, stepSize);
}
size_t getBTNum(const std::vector<BTSS>& mp, BlockType bt)
@ -426,28 +426,28 @@ namespace MultiArrayTools
MBlock<T>& OperationMaster<T,OpClass,Ranges...>::get()
{
block();
return *mBlockPtr;
return mBlock;
}
template <typename T, class OpClass, class... Ranges>
const Block<T>& OperationMaster<T,OpClass,Ranges...>::get() const
{
block();
return *mBlockPtr;
return mBlock;
}
template <typename T, class OpClass, class... Ranges>
std::vector<BTSS> OperationMaster<T,OpClass,Ranges...>::block(const std::shared_ptr<VIWB> blockIndex) const
{
std::vector<BTSS> btv(1, getBlockType( make_viwb( mIndex ), blockIndex, true) );
mBlockPtr = makeBlock(mArrayRef.datav(), btv[0].second, blockIndex->max());
mBlock = makeBlock(mArrayRef.data(), btv[0].second, blockIndex->max());
return btv;
}
template <typename T, class OpClass, class... Ranges>
const OperationMaster<T,OpClass,Ranges...>& OperationMaster<T,OpClass,Ranges...>::block() const
{
mBlockPtr->set( mIndex->pos() );
mBlock.set( mIndex->pos() );
return *this;
}
@ -469,21 +469,21 @@ namespace MultiArrayTools
const Block<T>& ConstOperationRoot<T,Ranges...>::get() const
{
block();
return *mBlockPtr;
return mBlock;
}
template <typename T, class... Ranges>
std::vector<BTSS> ConstOperationRoot<T,Ranges...>::block(const std::shared_ptr<VIWB> blockIndex) const
{
std::vector<BTSS> btv(1, getBlockType( make_viwb( mIndex ), blockIndex, true) );
mBlockPtr = makeBlock(mArrayRef.datav(), btv[0].second, blockIndex->max());
mBlock = makeBlock(mArrayRef.data(), btv[0].second, blockIndex->max());
return btv;
}
template <typename T, class... Ranges>
const ConstOperationRoot<T,Ranges...>& ConstOperationRoot<T,Ranges...>::block() const
{
mBlockPtr->set( (*mIndex)().pos() );
mBlock.set( (*mIndex)().pos() );
return *this;
}
@ -512,28 +512,28 @@ namespace MultiArrayTools
const MBlock<T>& OperationRoot<T,Ranges...>::get() const
{
block();
return *mBlockPtr;
return mBlock;
}
template <typename T, class... Ranges>
MBlock<T>& OperationRoot<T,Ranges...>::get()
{
block();
return *mBlockPtr;
return mBlock;
}
template <typename T, class... Ranges>
std::vector<BTSS> OperationRoot<T,Ranges...>::block(const std::shared_ptr<VIWB> blockIndex) const
{
std::vector<BTSS> btv(1, getBlockType( make_viwb( mIndex ), blockIndex, true) );
mBlockPtr = makeBlock(mArrayRef.datav(), btv[0].second, blockIndex->max());
mBlock = makeBlock(mArrayRef.data(), btv[0].second, blockIndex->max());
return btv;
}
template <typename T, class... Ranges>
const OperationRoot<T,Ranges...>& OperationRoot<T,Ranges...>::block() const
{
mBlockPtr->set( (*mIndex)().pos() );
mBlock.set( (*mIndex)().pos() );
return *this;
}
@ -564,7 +564,7 @@ namespace MultiArrayTools
template <typename T, class OpFunction, class... Ops>
const Operation<T,OpFunction,Ops...>& Operation<T,OpFunction,Ops...>::block() const
{
//mBlockPtr->set( mIndex->pos() );
//mBlock.set( mIndex->pos() );
return *this;
}