From f0812cd0c705c894ee13e9741bb28f90c3eb8ba1 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Fri, 26 Sep 2014 12:44:12 +0200 Subject: [PATCH] [T] Move LocalAsmData into SteadyDiffusionExample. --- .../AssemblerLib/SteadyDiffusion2DExample1.h | 71 +++++++++---------- Tests/AssemblerLib/TestSerialLinearSolver.cpp | 4 +- 2 files changed, 34 insertions(+), 41 deletions(-) diff --git a/Tests/AssemblerLib/SteadyDiffusion2DExample1.h b/Tests/AssemblerLib/SteadyDiffusion2DExample1.h index cc15de15887..a5419f0cf47 100644 --- a/Tests/AssemblerLib/SteadyDiffusion2DExample1.h +++ b/Tests/AssemblerLib/SteadyDiffusion2DExample1.h @@ -24,57 +24,50 @@ #include "MeshLib/MeshGenerators/MeshGenerator.h" #include "MeshLib/Node.h" -template <typename LocalMatrixType_, typename LocalVectorType_> -class LocalAssemblerData +struct SteadyDiffusion2DExample1 { -public: - using LocalMatrixType = LocalMatrixType_; - using LocalVectorType = LocalVectorType_; - -public: - - void init(MeshLib::Element const&, - LocalMatrixType const& localA, - LocalVectorType const& localRhs) - { - _localA = &localA; - _localRhs = &localRhs; - } - - void assemble(std::size_t const /*rows*/, std::size_t const /*columns*/) - { - // The local contributions are computed here, usually, but for this - // particular test all contributions are equal for all elements and are - // already stored in the _localA matrix. - } + using LocalMatrixType = MathLib::DenseMatrix<double>; + using LocalVectorType = MathLib::DenseVector<double>; - LocalMatrixType const& getLocalMatrix() const + class LocalAssemblerData { - return *_localA; - } + public: + void init(MeshLib::Element const&, + LocalMatrixType const& localA, + LocalVectorType const& localRhs) + { + _localA = &localA; + _localRhs = &localRhs; + } - LocalVectorType const& getLocalVector() const - { - return *_localRhs; - } + void assemble(std::size_t const /*rows*/, std::size_t const /*columns*/) + { + // The local contributions are computed here, usually, but for this + // particular test all contributions are equal for all elements and are + // already stored in the _localA matrix. + } + LocalMatrixType const& getLocalMatrix() const + { + return *_localA; + } -private: - LocalMatrixType const* _localA = nullptr; - LocalVectorType const* _localRhs = nullptr; -}; + LocalVectorType const& getLocalVector() const + { + return *_localRhs; + } -struct SteadyDiffusion2DExample1 -{ - using LocalMatrixType = MathLib::DenseMatrix<double>; - using LocalVectorType = MathLib::DenseVector<double>; + private: + LocalMatrixType const* _localA = nullptr; + LocalVectorType const* _localRhs = nullptr; + }; static void initializeLocalData(const MeshLib::Element& e, - LocalAssemblerData<LocalMatrixType, LocalVectorType>*& data_ptr, + LocalAssemblerData*& data_ptr, SteadyDiffusion2DExample1 const& example) { - data_ptr = new LocalAssemblerData<LocalMatrixType, LocalVectorType>; + data_ptr = new LocalAssemblerData; data_ptr->init(e, example._localA, example._localRhs); } diff --git a/Tests/AssemblerLib/TestSerialLinearSolver.cpp b/Tests/AssemblerLib/TestSerialLinearSolver.cpp index 790abc6fb57..14c45f6b83b 100644 --- a/Tests/AssemblerLib/TestSerialLinearSolver.cpp +++ b/Tests/AssemblerLib/TestSerialLinearSolver.cpp @@ -100,14 +100,14 @@ TEST(AssemblerLibSerialLinearSolver, Steady2DdiffusionQuadElem) using LocalMatrixType = MathLib::DenseMatrix<double>; using LocalVectorType = MathLib::DenseVector<double>; - std::vector<LocalAssemblerData<LocalMatrixType, LocalVectorType>*> + std::vector<SteadyDiffusion2DExample1::LocalAssemblerData*> local_assembler_data; local_assembler_data.resize(ex1.msh->getNElements()); typedef AssemblerLib::LocalAssemblerBuilder< MeshLib::Element, void (const MeshLib::Element &, - LocalAssemblerData<LocalMatrixType, LocalVectorType> *&, + SteadyDiffusion2DExample1::LocalAssemblerData *&, SteadyDiffusion2DExample1 const&) > LocalAssemblerBuilder; -- GitLab