diff --git a/ProcessLib/TES/TESLocalAssembler-impl.h b/ProcessLib/TES/TESLocalAssembler-impl.h index 4fd24c325c93b8c98e8d4788d0e0f55a5df7fc8d..25039e3b45469e9980d30a43669f2ba689367d3c 100644 --- a/ProcessLib/TES/TESLocalAssembler-impl.h +++ b/ProcessLib/TES/TESLocalAssembler-impl.h @@ -132,13 +132,16 @@ TESLocalAssembler< template <typename ShapeFunction_, typename IntegrationMethod_, unsigned GlobalDim> -void TESLocalAssembler<ShapeFunction_, IntegrationMethod_, - GlobalDim>::assemble(const double /*t*/, - std::vector<double> const& local_x) +void TESLocalAssembler<ShapeFunction_, IntegrationMethod_, GlobalDim>::assemble( + std::size_t const id, NumLib::LocalToGlobalIndexMap const& dof_table, + double const /*t*/, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, + GlobalVector& b) { _local_M.setZero(); _local_K.setZero(); _local_b.setZero(); + auto const indices = NumLib::detail::getIndices(id, dof_table); + auto const local_x = NumLib::detail::getLocalNodalDOFs(x, indices); IntegrationMethod_ integration_method(_integration_order); unsigned const n_integration_points = integration_method.getNumberOfPoints(); @@ -182,18 +185,12 @@ void TESLocalAssembler<ShapeFunction_, IntegrationMethod_, ogs5OutVec(_local_b); std::printf("\n"); } -} -template <typename ShapeFunction_, typename IntegrationMethod_, - unsigned GlobalDim> -void TESLocalAssembler<ShapeFunction_, IntegrationMethod_, GlobalDim>:: - addToGlobal( - NumLib::LocalToGlobalIndexMap::RowColumnIndices const& indices, - GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) const -{ - M.add(indices, _local_M); - K.add(indices, _local_K); - b.add(indices.rows, _local_b); + auto const r_c_indices = + NumLib::LocalToGlobalIndexMap::RowColumnIndices(indices, indices); + M.add(r_c_indices, _local_M); + K.add(r_c_indices, _local_K); + b.add(indices, _local_b); } template <typename ShapeFunction_, typename IntegrationMethod_, diff --git a/ProcessLib/TES/TESLocalAssembler.h b/ProcessLib/TES/TESLocalAssembler.h index 9d916a9dadbc4eefb075802d12cf7e6d1cf3c464..a0f159dd2b58cdf5efbca943d765ffe9b1e61ff9 100644 --- a/ProcessLib/TES/TESLocalAssembler.h +++ b/ProcessLib/TES/TESLocalAssembler.h @@ -23,18 +23,12 @@ namespace ProcessLib namespace TES { class TESLocalAssemblerInterface - : public NumLib::Extrapolatable<TESIntPtVariables> + : public ProcessLib::LocalAssemblerInterface, + public NumLib::Extrapolatable<TESIntPtVariables> { public: virtual ~TESLocalAssemblerInterface() = default; - virtual void assemble(double const t, - std::vector<double> const& local_x) = 0; - - virtual void addToGlobal( - NumLib::LocalToGlobalIndexMap::RowColumnIndices const&, - GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) const = 0; - virtual bool checkBounds(std::vector<double> const& local_x, std::vector<double> const& local_x_prev_ts) = 0; }; @@ -54,11 +48,11 @@ public: unsigned const integration_order, AssemblyParams const& asm_params); - void assemble(double const t, std::vector<double> const& local_x) override; - - void addToGlobal( - NumLib::LocalToGlobalIndexMap::RowColumnIndices const& indices, - GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) const override; + void assemble(std::size_t const id, + NumLib::LocalToGlobalIndexMap const& dof_table, + double const t, GlobalVector const& x, + GlobalMatrix& M, GlobalMatrix& K, + GlobalVector& b) override; Eigen::Map<const Eigen::RowVectorXd> getShapeMatrix( const unsigned integration_point) const override diff --git a/ProcessLib/TES/TESProcess.cpp b/ProcessLib/TES/TESProcess.cpp index bad81dea24a0c135bf61a78ff95f77b1a880ea6c..b35eb3c189645aa58fc0ca75b8874d2bc1bbbd69 100644 --- a/ProcessLib/TES/TESProcess.cpp +++ b/ProcessLib/TES/TESProcess.cpp @@ -171,9 +171,6 @@ void TESProcess::initializeConcreteProcess( NumLib::LocalToGlobalIndexMap const& dof_table, MeshLib::Mesh const& mesh, unsigned const integration_order) { - DBUG("Create global assembler."); - _global_assembler.reset(new GlobalAssembler(dof_table)); - ProcessLib::createLocalAssemblers<TESLocalAssembler>( mesh.getDimension(), mesh.getElements(), dof_table, integration_order, _local_assemblers, _assembly_params); @@ -249,9 +246,9 @@ void TESProcess::assembleConcreteProcess(const double t, DBUG("Assemble TESProcess."); // Call global assembler for each local assembly item. - GlobalExecutor::executeMemberDereferenced(*_global_assembler, - &GlobalAssembler::assemble, - _local_assemblers, t, x, M, K, b); + GlobalExecutor::executeMemberOnDereferenced( + &TESLocalAssemblerInterface::assemble, _local_assemblers, + *_local_to_global_index_map, t, x, M, K, b); } void TESProcess::preTimestep(GlobalVector const& x, const double t, diff --git a/ProcessLib/TES/TESProcess.h b/ProcessLib/TES/TESProcess.h index b039058f14f5ac4287cfe8a5038a5129954fee97..987f84be056ade216626e93881447609a1217989 100644 --- a/ProcessLib/TES/TESProcess.h +++ b/ProcessLib/TES/TESProcess.h @@ -52,10 +52,6 @@ public: bool isLinear() const override { return false; } private: - using GlobalAssembler = NumLib::VectorMatrixAssembler< - TESLocalAssemblerInterface, - NumLib::ODESystemTag::FirstOrderImplicitQuasilinear>; - using ExtrapolatorInterface = NumLib::Extrapolator<TESIntPtVariables, TESLocalAssemblerInterface>; using ExtrapolatorImplementation = @@ -85,7 +81,6 @@ private: NumLib::LocalToGlobalIndexMap const& dof_table, std::unique_ptr<GlobalVector>& result_cache); - std::unique_ptr<GlobalAssembler> _global_assembler; std::vector<std::unique_ptr<TESLocalAssemblerInterface>> _local_assemblers; AssemblyParams _assembly_params;