OpTest_MDim.ExecOp2 works... OpTest_MDim.ExecOp3 does not but at least compiles...

This commit is contained in:
Christian Zimmermann 2017-09-11 13:55:56 +02:00
parent 7a17aba37d
commit bb6f18cf1c
2 changed files with 18 additions and 22 deletions

View file

@ -33,12 +33,9 @@ namespace MultiArrayHelper
class BlockBase
{
public:
BlockBase() = default;
DEFAULT_MEMBERS(BlockBase);
BlockBase(size_t size);
BlockBase(BlockBase&& res) = default;
BlockBase& operator=(BlockBase&& res) = default;
virtual BlockType type() const = 0;
virtual size_t stepSize() const = 0;
@ -74,14 +71,11 @@ namespace MultiArrayHelper
{
public:
MutableBlockBase() = default;
DEFAULT_MEMBERS(MutableBlockBase);
MutableBlockBase(size_t size);
MutableBlockBase& operator=(const BlockBase<T>& in);
MutableBlockBase(MutableBlockBase&& res) = default;
MutableBlockBase& operator=(MutableBlockBase&& res) = default;
virtual T& operator[](size_t pos) = 0;
};
@ -90,7 +84,7 @@ namespace MultiArrayHelper
class Block : public BlockBase<T>
{
public:
Block() = default;
DEFAULT_MEMBERS(Block);
Block(const std::vector<T>& data, size_t begPos, size_t size);
virtual BlockType type() const override;
@ -107,7 +101,7 @@ namespace MultiArrayHelper
class MBlock : public MutableBlockBase<T>
{
public:
MBlock() = default;
DEFAULT_MEMBERS(MBlock);
MBlock(std::vector<T>& data, size_t begPos, size_t size);
virtual BlockType type() const override;
@ -125,7 +119,8 @@ namespace MultiArrayHelper
class BlockValue : public BlockBase<T>
{
public:
BlockValue() = default;
DEFAULT_MEMBERS(BlockValue);
BlockValue(const std::vector<T>& data,
size_t pos, size_t size);
@ -143,7 +138,8 @@ namespace MultiArrayHelper
class MBlockValue : public MutableBlockBase<T>
{
public:
MBlockValue() = default;
DEFAULT_MEMBERS(MBlockValue);
MBlockValue(std::vector<T>& data,
size_t pos, size_t size);
@ -163,7 +159,8 @@ namespace MultiArrayHelper
{
public:
SplitBlock() = default;
DEFAULT_MEMBERS(SplitBlock);
SplitBlock(const std::vector<T>& data, size_t begPos,
size_t stepSize, size_t size);
@ -183,7 +180,8 @@ namespace MultiArrayHelper
{
public:
MSplitBlock() = default;
DEFAULT_MEMBERS(MSplitBlock);
MSplitBlock(std::vector<T>& data, size_t begPos,
size_t stepSize, size_t size);
@ -204,11 +202,9 @@ namespace MultiArrayHelper
class BlockResult : public MutableBlockBase<T>
{
public:
BlockResult() = default;
BlockResult(size_t size);
DEFAULT_MEMBERS(BlockResult);
BlockResult(BlockResult&& res) = default;
BlockResult& operator=(BlockResult&& res) = default;
BlockResult(size_t size);
virtual BlockType type() const override;
virtual const T& operator[](size_t pos) const override;

View file

@ -132,7 +132,7 @@ namespace {
EXPECT_EQ( fabs( res.at(mkt('3','B')) - (0.373 * 4.790) ) < 0.0001, true );
}
/*
TEST_F(OpTest_MDim, ExecOp2)
{
MultiArray<double,MRange,SRange> res(mr1ptr,sr4ptr);
@ -143,7 +143,7 @@ namespace {
auto i1 = std::dynamic_pointer_cast<MRange::IndexType>( mr1ptr->index() );
auto i2 = std::dynamic_pointer_cast<SRange::IndexType>( sr4ptr->index() );
res(i1,i2) = ma1(i1) + ma2(i2) - ma3(i2);
res(i1,i2) = ( ma1(i1) + ma2(i2) ) - ma3(i2);
EXPECT_EQ( fabs( res.at(mkt(mkt('1','a'),'A')) - (0.353 + 8.870 - 1.470) ) < 0.0001, true );
EXPECT_EQ( fabs( res.at(mkt(mkt('1','a'),'B')) - (0.353 + 4.790 - 2.210) ) < 0.0001, true );
@ -191,7 +191,7 @@ namespace {
EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'A')) - (2.911 + 0.373 + 1.470) ) < 0.0001, true );
EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'B')) - (2.911 + 0.373 + 2.210) ) < 0.0001, true );
}
*/
} // anonymous namspace
int main(int argc, char** argv)