resolve merge conflicts

This commit is contained in:
Christian Zimmermann 2017-03-23 21:16:18 +01:00
commit 8c5ae50ac1
4 changed files with 50 additions and 59 deletions

View file

@ -180,6 +180,12 @@ namespace MultiArrayTools
return MAB::operator()(str...);
}
template <class... NameTypes>
ConstMultiArrayOperationRoot<T,Range> operator()(const NameTypes&... str) const;
template <class NameType>
ConstMultiArrayOperationRoot<T,Range> operator()(const NameType& name, bool master) const;
template <class... NameTypes>
MultiArrayOperationRoot<T,Range> operator()(const NameTypes&... str);

View file

@ -46,6 +46,7 @@ namespace MultiArrayTools
for(iref = mArrayRef.beginIndex().pos(); iref != mArrayRef.endIndex(); ++iref){
std::cout << iref.pos() << '\r' << std::flush;
get() = in.get();
//assert(not std::isnan( get() ));
}
//CHECK;
MAOB::mIibPtr->freeLinked();
@ -90,6 +91,19 @@ namespace MultiArrayTools
//mIndex.name(nm);
}
template <typename T, class Range>
MultiArrayOperationRoot<T,Range>::
MultiArrayOperationRoot(const MultiArrayOperationRoot& in) :
MutableMultiArrayOperationBase<T>(),
mArrayRef(in.mArrayRef),
mIndex(mArrayRef.beginIndex()),
mNm(in.mNm)
{
MAOB::mIibPtr = &mIndex;
MAOB::mIibPtr->name(mNm);
//mIndex.name(nm);
}
template <typename T, class Range>
MultiArrayOperationRoot<T,Range>&
MultiArrayOperationRoot<T,Range>::operator=(const MultiArrayOperationRoot<T,Range>& in)
@ -313,14 +327,20 @@ namespace MultiArrayTools
template <typename T, class Range>
T& MultiArrayOperationRoot<T,Range>::get()
{
//CHECK;
//return mArrayRef[mIndex];
assert(MAOB::mIibPtr == &mIndex);
//VCHECK(mArrayRef[*dynamic_cast<IndexType*>(MAOB::mIibPtr)]);
return mArrayRef[*dynamic_cast<IndexType*>(MAOB::mIibPtr)];
}
template <typename T, class Range>
const T& MultiArrayOperationRoot<T,Range>::get() const
{
//CHECK;
//return mArrayRef[mIndex];
assert(MAOB::mIibPtr == &mIndex);
//VCHECK(mArrayRef[*dynamic_cast<IndexType*>(MAOB::mIibPtr)]);
return mArrayRef[*dynamic_cast<IndexType*>(MAOB::mIibPtr)];
}
@ -408,6 +428,19 @@ namespace MultiArrayTools
//mIndex.name(nm);
}
template <typename T, class Range>
ConstMultiArrayOperationRoot<T,Range>::
ConstMultiArrayOperationRoot(const ConstMultiArrayOperationRoot& in) :
MultiArrayOperationBase<T>(),
mArrayRef(in.mArrayRef),
mIndex(mArrayRef.beginIndex()),
mNm(in.mNm)
{
MAOB::mIibPtr = &mIndex;
MAOB::mIibPtr->name(mNm);
//mIndex.name(nm);
}
/*
template <typename T, class Range>
const ConstMultiArrayOperationRoot<T,Range>&
@ -561,6 +594,8 @@ namespace MultiArrayTools
template <typename T, class Range>
const T& ConstMultiArrayOperationRoot<T,Range>::get() const
{
//CHECK;
assert(MAOB::mIibPtr == &mIndex);
return mArrayRef[*dynamic_cast<IndexType*>(MAOB::mIibPtr)];
}
@ -683,13 +718,13 @@ namespace MultiArrayTools
MultiArrayOperation<T,Operation,MAOps...>::
MultiArrayOperation(Operation& op, const MAOps&... args) :
mOp(op),
mArgs(std::make_tuple(args...)) {}
mArgs(std::make_tuple(args...)) { /*CHECK;*/ }
template <typename T, class Operation, class... MAOps>
MultiArrayOperation<T,Operation,MAOps...>::
MultiArrayOperation(const Operation& op, const MAOps&... args) :
mOp(op),
mArgs(std::make_tuple(args...)) {}
mArgs(std::make_tuple(args...)) { /*CHECK;*/ }
template <typename T, class Operation, class... MAOps>
template <class Operation2, class... MAOps2>
@ -777,9 +812,9 @@ namespace MultiArrayTools
template <typename T, class Operation, class... MAOps>
const T& MultiArrayOperation<T,Operation,MAOps...>::get() const
{
//CHECK;
mVal = OperationCall<sizeof...(MAOps)-1>::
template callOperation(mOp, mArgs);
//std::cout << mVal << std::endl;
return mVal;
}
@ -822,9 +857,6 @@ namespace MultiArrayTools
//linkIndicesTo(&mRunIndex);
}
// !!!!!
template <typename T, class ContractOperation, class Range, class... MAOps>
template <class Operation2, class... MAOps2>
MultiArrayOperation<T,Operation2,MultiArrayContraction<T,ContractOperation,Range,MAOps...>,MAOps2...>
@ -921,62 +953,14 @@ namespace MultiArrayTools
template <typename T, class ContractOperation, class Range, class... MAOps>
const T& MultiArrayContraction<T,ContractOperation,Range,MAOps...>::get() const
{
//CHECK;
mOp.reset();
for(mRunIndex.copyPos( mBeginIndex ); mRunIndex.pos() != mEndIndex.pos(); ++mRunIndex){
OperationCall<sizeof...(MAOps)-1>::
template callOperation(mOp, mArgs);
//MAO::mOp(std::get<0>(MAO::mArgs).get() );
}
mOp.endOp();
//std::cout << mOp() << std::endl;
return mOp();
}
/*
template <typename T, class ContractOperation, class Range, class... MAOps>
MultiArrayContraction<T,ContractOperation,Range,MAOps...>::
MultiArrayContraction(const ContractOperation& cop,
const typename Range::IndexType& runIndex,
const MAOps&... mao) :
MultiArrayContraction<T,ContractOperation,MAOps...>(cop, mao...),
mBeginIndex(runIndex), mEndIndex(runIndex),
mRunIndex(runIndex)
{
mBeginIndex.setPos(0);
mEndIndex.setPos(mRunIndex.max());
MAO::linkIndicesTo(&mRunIndex);
}
template <typename T, class ContractOperation, class Range, class... MAOps>
MultiArrayContraction<T,ContractOperation,Range,MAOps...>::
MultiArrayContraction(const ContractOperation& cop,
const typename Range::IndexType& runIndex,
size_t begin,
size_t end,
const MAOps&... mao) :
MultiArrayContraction<T,ContractOperation,MAOps...>(cop, mao...),
mBeginIndex(runIndex), mEndIndex(runIndex),
mRunIndex(runIndex)
{
mBeginIndex.setPos(begin);
mEndIndex.setPos(end);
MAO::linkIndicesTo(&mRunIndex);
}
// for the moment simplest case only:
template <typename T, class ContractOperation, class Range, class... MAOps>
const T& MultiArrayContraction<T,ContractOperation,Range,MAOps...>::get() const
{
MAO::mOp.reset();
for(mRunIndex.copyPos( mBeginIndex ); mRunIndex.pos() != mEndIndex.pos(); ++mRunIndex){
OperationCall<sizeof...(MAOps)-1>::
template callOperation(MAO::mOp, MAO::mArgs);
//MAO::mOp(std::get<0>(MAO::mArgs).get() );
}
MAO::mOp.endOp();
std::cout << MAO::mOp() << std::endl;
return MAO::mOp();
}*/
}

View file

@ -5,6 +5,7 @@
#include <cstdlib>
#include <tuple>
#include <cmath>
#include "base_def.h"
#include "index_base.h"
@ -55,6 +56,7 @@ namespace MultiArrayTools
//typedef decltype(MultiArray<T,Range>().begin()) IndexType;
MultiArrayOperationRoot(MutableMultiArrayBase<T,Range>& ma, const Name& nm);
MultiArrayOperationRoot(const MultiArrayOperationRoot& in);
MultiArrayOperationRoot& operator=(const MultiArrayOperationRoot& in);
MultiArrayOperationRoot& operator=(MultiArrayOperationRoot& in);
@ -175,6 +177,7 @@ namespace MultiArrayTools
ConstMultiArrayOperationRoot(const MultiArrayBase<T,Range>& ma, const Name& nm);
ConstMultiArrayOperationRoot(const MultiArrayOperationRoot<T,Range>& in);
ConstMultiArrayOperationRoot(const ConstMultiArrayOperationRoot& in);
template <class Operation, class... MAOps>
MultiArrayOperation<T,Operation,ConstMultiArrayOperationRoot<T,Range>, MAOps...>
@ -310,7 +313,7 @@ namespace MultiArrayTools
MultiArrayContraction(const ContractOperation& cop,
const typename Range::IndexType& runIndex,
const MAOps&... args);
const MAOps&... mao);
MultiArrayContraction(const ContractOperation& cop,
const typename Range::IndexType& runIndex,
@ -318,7 +321,6 @@ namespace MultiArrayTools
size_t end,
const MAOps&... mao);
template <class Operation2, class... MAOps2>
MultiArrayOperation<T,Operation2,MultiArrayContraction<T,ContractOperation,Range,MAOps...>,MAOps2...>
operator()(Operation2& op, const MAOps2&... secs) const;

View file

@ -191,7 +191,6 @@ namespace {
MultiArray2dAny max;
};
TEST_F(OneDimTest, CorrectExtensions)
{
EXPECT_EQ(ma.size(), 5);