diff --git a/Tests/AssemblerLib/SteadyDiffusion2DExample1.h b/Tests/AssemblerLib/SteadyDiffusion2DExample1.h index 358d0bcd74541ccb733dc5ab79ba7ebabc6a820e..cc15de1588722b0f8be79dc93a7fdb1394546c99 100644 --- a/Tests/AssemblerLib/SteadyDiffusion2DExample1.h +++ b/Tests/AssemblerLib/SteadyDiffusion2DExample1.h @@ -64,25 +64,20 @@ private: LocalVectorType const* _localRhs = nullptr; }; -template <typename LocalMatrixType_, typename LocalVectorType_> -struct LocalDataInitializer -{ - template <typename ...Args_> - void operator()(const MeshLib::Element& e, - LocalAssemblerData<LocalMatrixType_, LocalVectorType_>*& data_ptr, - Args_&&... args) - { - data_ptr = new LocalAssemblerData<LocalMatrixType_, LocalVectorType_>; - data_ptr->init(e, std::forward<Args_>(args)...); - } -}; - - struct SteadyDiffusion2DExample1 { using LocalMatrixType = MathLib::DenseMatrix<double>; using LocalVectorType = MathLib::DenseVector<double>; + static + void initializeLocalData(const MeshLib::Element& e, + LocalAssemblerData<LocalMatrixType, LocalVectorType>*& data_ptr, + SteadyDiffusion2DExample1 const& example) + { + data_ptr = new LocalAssemblerData<LocalMatrixType, LocalVectorType>; + data_ptr->init(e, example._localA, example._localRhs); + } + SteadyDiffusion2DExample1() : _localA(4, 4), _localRhs(4) { diff --git a/Tests/AssemblerLib/TestSerialLinearSolver.cpp b/Tests/AssemblerLib/TestSerialLinearSolver.cpp index 5893dbbc4132818b2a92d056bbfb505b8477af63..790abc6fb57fe2ec6376814e5c3b36baf78bd03e 100644 --- a/Tests/AssemblerLib/TestSerialLinearSolver.cpp +++ b/Tests/AssemblerLib/TestSerialLinearSolver.cpp @@ -104,22 +104,22 @@ TEST(AssemblerLibSerialLinearSolver, Steady2DdiffusionQuadElem) local_assembler_data; local_assembler_data.resize(ex1.msh->getNElements()); - LocalDataInitializer<LocalMatrixType, LocalVectorType> initializer; - typedef AssemblerLib::LocalAssemblerBuilder< MeshLib::Element, - LocalDataInitializer<LocalMatrixType, LocalVectorType> - > GlobalInitializer; + void (const MeshLib::Element &, + LocalAssemblerData<LocalMatrixType, LocalVectorType> *&, + SteadyDiffusion2DExample1 const&) + > LocalAssemblerBuilder; - GlobalInitializer global_initializer(initializer); + LocalAssemblerBuilder local_asm_builder( + SteadyDiffusion2DExample1::initializeLocalData); // Call global initializer for each mesh element. globalSetup.execute( - global_initializer, + local_asm_builder, ex1.msh->getElements(), local_assembler_data, - ex1._localA, - ex1._localRhs); + ex1); // Local and global assemblers. typedef AssemblerLib::VectorMatrixAssembler<