From 1d77098670f108b7b670aa874f3810e1a52db978 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Mon, 22 Apr 2024 01:03:26 +0200 Subject: [PATCH] fixes --- src/opt/mpi/include/rarray.cc.h | 10 +++++----- src/opt/mpi/include/rarray.h | 8 +++++--- src/opt/mpi/tests/roperation_unit_test.cc | 5 ++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/opt/mpi/include/rarray.cc.h b/src/opt/mpi/include/rarray.cc.h index 054837e..d404198 100644 --- a/src/opt/mpi/include/rarray.cc.h +++ b/src/opt/mpi/include/rarray.cc.h @@ -49,7 +49,7 @@ namespace CNORXZ template template - RCArray::RCArray(const RRange& range) : + RCArray::RCArray(const Sptr>& range) : mA(std::make_unique(range->local())), mGeom(range->geom()), mGlobal(range) @@ -258,9 +258,9 @@ namespace CNORXZ return imap; } - /*===============+ - | RCArray | - +===============*/ + /*==============+ + | RArray | + +==============*/ template RArray::RArray(const RArray& a) : @@ -278,7 +278,7 @@ namespace CNORXZ template template - RArray::RArray(const RRange& range) : + RArray::RArray(const Sptr>& range) : RCArray(range), mB(dynamic_cast*>(RCA::mA.get())) {} diff --git a/src/opt/mpi/include/rarray.h b/src/opt/mpi/include/rarray.h index 62c9cd3..0f2013e 100644 --- a/src/opt/mpi/include/rarray.h +++ b/src/opt/mpi/include/rarray.h @@ -38,7 +38,7 @@ namespace CNORXZ @param range The range. */ template - RCArray(const RRange& range); + RCArray(const Sptr>& range); /** Construct from local array object. @param a Local array. @@ -142,10 +142,12 @@ namespace CNORXZ template Sptr> load(const Sptr& lpi, const F& f) const; - private: + protected: ObjHandle> mA; RangePtr mGeom; RangePtr mGlobal; + + private: mutable Vector mBuf; // data from other ranks mutable Vector mMap; // point to positions in mA or mBuf }; @@ -181,7 +183,7 @@ namespace CNORXZ @param range The range. */ template - RArray(const RRange& range); + RArray(const Sptr>& range); /** Construct from local array object. @param a Local array. diff --git a/src/opt/mpi/tests/roperation_unit_test.cc b/src/opt/mpi/tests/roperation_unit_test.cc index 9611154..236683d 100644 --- a/src/opt/mpi/tests/roperation_unit_test.cc +++ b/src/opt/mpi/tests/roperation_unit_test.cc @@ -45,6 +45,7 @@ namespace RangePtr g1 = CRangeFactory(1).create(); RangePtr g2 = CRangeFactory(2).create(); mGeom = g2*g1*g1*g2*g1; + mGeom2 = g2*g1*g1*g2; mRXRange = rrange(mXRange, g2*g1*g1*g2); RangePtr scr = mSpRange*mSpRange; @@ -88,6 +89,7 @@ namespace RangePtr mSpRange; RangePtr mMRange; RangePtr mGeom; + RangePtr mGeom2; RCArray mM1; RCArray mM2; @@ -103,7 +105,8 @@ namespace TEST_F(ROp_Test, Contract) { Vector comp(mRXRange->size()); - //RArray res( MArray(mMRange), mGeom ); + RArray res( MArray(mRXRange->sub(1)), mGeom2 ); + EXPECT_EQ(res.size(), comp.size()); typedef UIndex UI; RIndex,MIndex> x(mRXRange); RIndex,MIndex> y(mRXRange);