From 34161f10cb54aea7252aead3013154ff2a86316f Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Thu, 27 Aug 2020 17:46:30 +0200 Subject: [PATCH] DynamicOuterOp --- src/include/dynamic_operation.cc.h | 50 ++++++++++++++++++++++++++++++ src/include/dynamic_operation.h | 33 ++++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/src/include/dynamic_operation.cc.h b/src/include/dynamic_operation.cc.h index 056628d..227c0ee 100644 --- a/src/include/dynamic_operation.cc.h +++ b/src/include/dynamic_operation.cc.h @@ -40,5 +40,55 @@ namespace MultiArrayTools return std::make_shared>(*this); } + template + DynamicOuterOp::DynamicOuterOp(const Operation& op, + const std::shared_ptr&... inds) + : mOp(op) + { + //...!!! + // setup operations + } + + template + OpH> DynamicOuterOp::get(const DExtT& pos) const + { + mOp.get(pos.expl()); + //... + // execute assignment... care about threads!!! + return OpH>(); // empty + } + + template + DynamicOperationBase>>& + DynamicOuterOp::set(const DExtT& pos) + { + mOp.set(pos.expl()); + return *this; + } + + template + DExtT DynamicOuterOp::rootSteps(std::intptr_t iPtrNum) const + { + return DExtT(mkDExt(mkExtT(mOp.rootSteps(iPtrNum))),None(0)); + } + + template + DynamicExpression DynamicOuterOp::loop(const DynamicExpression& exp) const + { + return mOp.loop(exp); + } + + template + const OpH>* DynamicOuterOp::data() const + { + return &mProto; + } + + template + std::shared_ptr>>> + DynamicOuterOp::deepCopy() const + { + return std::make_shared>(*this); + } } // namespace MultiArrayTools diff --git a/src/include/dynamic_operation.h b/src/include/dynamic_operation.h index 704b3a6..3ba7f86 100644 --- a/src/include/dynamic_operation.h +++ b/src/include/dynamic_operation.h @@ -58,6 +58,39 @@ namespace MultiArrayTools virtual std::shared_ptr> deepCopy() const override final; }; + template + struct OpH + { + Op mOp; + }; + + template + class DynamicOuterOp : public DynamicOperationBase>> + { + private: + Operation mOp; + //ConstOperationRoot mProto; + OpH> mProto; + public: + typedef decltype(mOp.rootSteps()) ET; + //typedef decltype(std::declval().rootSteps()) ET; + + DynamicOuterOp() = default; + DynamicOuterOp(const DynamicOuterOp& in) = default; + DynamicOuterOp(DynamicOuterOp&& in) = default; + DynamicOuterOp& operator=(const DynamicOuterOp& in) = default; + DynamicOuterOp& operator=(DynamicOuterOp&& in) = default; + + DynamicOuterOp(const Operation& op, const std::shared_ptr&... inds); + + virtual OpH> get(const DExtT& pos) const override final; + virtual DynamicOperationBase>>& set(const DExtT& pos) override final; + virtual DExtT rootSteps(std::intptr_t iPtrNum = 0) const override final; + virtual DynamicExpression loop(const DynamicExpression& exp) const override final; + virtual const OpH>* data() const override final; + virtual std::shared_ptr>>> deepCopy() const override final; + }; + template class DynamicO : public OperationTemplate> {