diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp index a00794cb1bfbeb131f9a85c79c1093d75d757338..0d8a1a4eb2d357d8a6ddb0c833f7fd825f9e284a 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp +++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp @@ -64,10 +64,12 @@ void ComponentTransportProcess::assembleConcreteProcess( { DBUG("Assemble ComponentTransportProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } void ComponentTransportProcess::assembleWithJacobianConcreteProcess( @@ -77,11 +79,13 @@ void ComponentTransportProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian ComponentTransportProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } } // namespace ComponentTransport diff --git a/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp b/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp index a594ca6f3906b53e62af33c479fc0ad1504d36e4..9706bcfeaf594878154dccd259a0509e7b10836c 100644 --- a/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp +++ b/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp @@ -30,9 +30,7 @@ CoupledSolutionsForStaggeredScheme::CoupledSolutionsForStaggeredScheme( std::vector<std::vector<double>> getPreviousLocalSolutions( const CoupledSolutionsForStaggeredScheme& cpl_xs, - const std::vector< - std::reference_wrapper<const std::vector<GlobalIndexType>>>& - indices) + const std::vector<std::vector<GlobalIndexType>>& indices) { if (cpl_xs.coupled_xs_t0.empty()) return {}; @@ -44,7 +42,7 @@ std::vector<std::vector<double>> getPreviousLocalSolutions( int coupling_id = 0; for (auto const& x_t0 : cpl_xs.coupled_xs_t0) { - local_xs_t0.emplace_back(x_t0->get(indices[coupling_id].get())); + local_xs_t0.emplace_back(x_t0->get(indices[coupling_id])); coupling_id++; } return local_xs_t0; @@ -52,9 +50,7 @@ std::vector<std::vector<double>> getPreviousLocalSolutions( std::vector<std::vector<double>> getCurrentLocalSolutions( const CoupledSolutionsForStaggeredScheme& cpl_xs, - const std::vector< - std::reference_wrapper<const std::vector<GlobalIndexType>>>& - indices) + const std::vector<std::vector<GlobalIndexType>>& indices) { const auto number_of_coupled_solutions = cpl_xs.coupled_xs.size(); std::vector<std::vector<double>> local_xs_t1; @@ -63,7 +59,7 @@ std::vector<std::vector<double>> getCurrentLocalSolutions( int coupling_id = 0; for (auto const& x_t1 : cpl_xs.coupled_xs) { - local_xs_t1.emplace_back(x_t1.get().get(indices[coupling_id].get())); + local_xs_t1.emplace_back(x_t1.get().get(indices[coupling_id])); coupling_id++; } return local_xs_t1; diff --git a/ProcessLib/CoupledSolutionsForStaggeredScheme.h b/ProcessLib/CoupledSolutionsForStaggeredScheme.h index f38f95095630eea0f87d7a37bfa1b6bd1e0f1464..ee800490f717959e84898cb0e8dfc5ade65c26a4 100644 --- a/ProcessLib/CoupledSolutionsForStaggeredScheme.h +++ b/ProcessLib/CoupledSolutionsForStaggeredScheme.h @@ -12,7 +12,6 @@ #pragma once -#include <functional> #include <utility> #include <vector> @@ -83,9 +82,7 @@ struct LocalCoupledSolutions */ std::vector<std::vector<double>> getPreviousLocalSolutions( const CoupledSolutionsForStaggeredScheme& cpl_xs, - const std::vector< - std::reference_wrapper<const std::vector<GlobalIndexType>>>& - indices); + const std::vector<std::vector<GlobalIndexType>>& indices); /** * Fetch the nodal solutions of all coupled processes of the current time step @@ -96,7 +93,5 @@ std::vector<std::vector<double>> getPreviousLocalSolutions( */ std::vector<std::vector<double>> getCurrentLocalSolutions( const CoupledSolutionsForStaggeredScheme& cpl_xs, - const std::vector< - std::reference_wrapper<const std::vector<GlobalIndexType>>>& - indices); + const std::vector<std::vector<GlobalIndexType>>& indices); } // end of ProcessLib diff --git a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp index 4cc79a226476e1e7542072a2c46edceeb3e8a591..24c16c7fba114ff7935d9e830cd15a392d602ff1 100644 --- a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp +++ b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp @@ -67,10 +67,12 @@ void GroundwaterFlowProcess::assembleConcreteProcess(const double t, { DBUG("Assemble GroundwaterFlowProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } void GroundwaterFlowProcess::assembleWithJacobianConcreteProcess( @@ -80,11 +82,13 @@ void GroundwaterFlowProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian GroundwaterFlowProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } } // namespace GroundwaterFlow diff --git a/ProcessLib/HT/HTProcess.cpp b/ProcessLib/HT/HTProcess.cpp index ac379c210ab6611b0509d4b025586ad3b9ec2676..96db34147059bd7b994d4d4b372a3fb2a01af6d2 100644 --- a/ProcessLib/HT/HTProcess.cpp +++ b/ProcessLib/HT/HTProcess.cpp @@ -85,9 +85,12 @@ void HTProcess::assembleConcreteProcess(const double t, GlobalMatrix& K, GlobalVector& b) { + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_tables; if (_use_monolithic_scheme) { DBUG("Assemble HTProcess."); + dof_tables.emplace_back(std::ref(*_local_to_global_index_map)); } else { @@ -104,12 +107,14 @@ void HTProcess::assembleConcreteProcess(const double t, "fluid flow process within HTProcess."); } setCoupledSolutionsOfPreviousTimeStep(); + dof_tables.emplace_back(std::ref(*_local_to_global_index_map)); + dof_tables.emplace_back(std::ref(*_local_to_global_index_map)); } // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_tables, t, x, M, K, b, _coupled_solutions); } void HTProcess::assembleWithJacobianConcreteProcess( @@ -119,16 +124,24 @@ void HTProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian HTProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_tables; if (!_use_monolithic_scheme) { setCoupledSolutionsOfPreviousTimeStep(); + dof_tables.emplace_back(std::ref(*_local_to_global_index_map)); + } + else + { + dof_tables.emplace_back(std::ref(*_local_to_global_index_map)); + dof_tables.emplace_back(std::ref(*_local_to_global_index_map)); } // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_tables, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } void HTProcess::preTimestepConcreteProcess(GlobalVector const& x, diff --git a/ProcessLib/HT/StaggeredHTFEM-impl.h b/ProcessLib/HT/StaggeredHTFEM-impl.h index bdd0c2074bb4844587f2587c1b28ac32115e5fdf..7c12558ec2bf51da46ad34b52f92f7c62832457a 100644 --- a/ProcessLib/HT/StaggeredHTFEM-impl.h +++ b/ProcessLib/HT/StaggeredHTFEM-impl.h @@ -13,8 +13,6 @@ #include "StaggeredHTFEM.h" -#include <functional> // for std::reference_wrapper - #include "ProcessLib/CoupledSolutionsForStaggeredScheme.h" namespace ProcessLib @@ -25,10 +23,10 @@ template <typename ShapeFunction, typename IntegrationMethod, unsigned GlobalDim> void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>:: assembleForStaggeredScheme(double const t, - std::vector<double>& local_M_data, - std::vector<double>& local_K_data, - std::vector<double>& local_b_data, - LocalCoupledSolutions const& coupled_xs) + std::vector<double>& local_M_data, + std::vector<double>& local_K_data, + std::vector<double>& local_b_data, + LocalCoupledSolutions const& coupled_xs) { if (coupled_xs.process_id == 0) { @@ -279,9 +277,8 @@ StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>:: { auto const indices = NumLib::getIndices(this->_element.getID(), dof_table); assert(!indices.empty()); - std::vector<std::reference_wrapper<const std::vector<GlobalIndexType>>> - indices_of_all_coupled_processes = {std::ref(indices), - std::ref(indices)}; + std::vector<std::vector<GlobalIndexType>> indices_of_all_coupled_processes = + {indices, indices}; auto const local_xs = getCurrentLocalSolutions( *(this->_coupled_solutions), indices_of_all_coupled_processes); diff --git a/ProcessLib/HeatConduction/HeatConductionProcess.cpp b/ProcessLib/HeatConduction/HeatConductionProcess.cpp index 09db5281523eac700a3250c3a1ece0cb9953917d..6213e31ffc242739fd3368446deb4ed243f947a6 100644 --- a/ProcessLib/HeatConduction/HeatConductionProcess.cpp +++ b/ProcessLib/HeatConduction/HeatConductionProcess.cpp @@ -78,10 +78,12 @@ void HeatConductionProcess::assembleConcreteProcess(const double t, { DBUG("Assemble HeatConductionProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } void HeatConductionProcess::assembleWithJacobianConcreteProcess( @@ -91,11 +93,13 @@ void HeatConductionProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian HeatConductionProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } void HeatConductionProcess::computeSecondaryVariableConcrete( diff --git a/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h b/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h index a48f5a440eae2c57b8ccee14b3c832cb0c67e4c1..0fabb9d555b6a46554e0a04870b8b2954e0a5066 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h +++ b/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h @@ -1,6 +1,6 @@ /** * \copyright - * Copyright (c) 2012-2017, OpenGeoSys Community (http://www.opengeosys.org) + * Copyright (c) 2012-2018, OpenGeoSys Community (http://www.opengeosys.org) * Distributed under a Modified BSD License. * See accompanying file LICENSE.txt or * http://www.opengeosys.org/project/license diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess-impl.h b/ProcessLib/HydroMechanics/HydroMechanicsProcess-impl.h index 07c3a78e3b1ab9b82d164ccd10dfc718b6b19142..65f9fd4657abb55e701a76f8223097b7e28ddd16 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsProcess-impl.h +++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess-impl.h @@ -235,7 +235,7 @@ void HydroMechanicsProcess<DisplacementDim>::initializeBoundaryConditions() { const int process_id_of_up = 0; initializeProcessBoundaryCondition(*_local_to_global_index_map, - process_id_of_up); + process_id_of_up); return; } @@ -248,7 +248,7 @@ void HydroMechanicsProcess<DisplacementDim>::initializeBoundaryConditions() // for the equations of deformation. const int process_id_of_u = 1; initializeProcessBoundaryCondition(*_local_to_global_index_map, - process_id_of_u); + process_id_of_u); } template <int DisplacementDim> @@ -262,10 +262,12 @@ void HydroMechanicsProcess<DisplacementDim>::assembleConcreteProcess( // only the Newton-Raphson method is employed to simulate coupled HM // processes in this class, this function is actually not used so far. + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } template <int DisplacementDim> @@ -283,11 +285,13 @@ void HydroMechanicsProcess<DisplacementDim>:: DBUG( "Assemble the Jacobian of HydroMechanics for the monolithic" " scheme."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, - dxdot_dx, dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, dx_dx, M, K, b, + Jac, _coupled_solutions); return; } @@ -305,13 +309,13 @@ void HydroMechanicsProcess<DisplacementDim>:: "HydroMechanics for the staggered scheme."); } - // Note: _local_to_global_index_map_with_base_nodes is asserted in - // constructDofTable(). + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_tables = {std::ref(*_local_to_global_index_map_with_base_nodes), + std::ref(*_local_to_global_index_map)}; GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, - _local_to_global_index_map_with_base_nodes.get()); + _local_assemblers, dof_tables, t, x, xdot, dxdot_dx, dx_dx, M, K, b, + Jac, _coupled_solutions); } template <int DisplacementDim> diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp index 13cfc632538babaa8e36b42fa3f4dac99532208d..549ff8016ad799fa54a150be4963899bbe493d5c 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp @@ -508,10 +508,12 @@ void HydroMechanicsProcess<GlobalDim>::assembleConcreteProcess( { DBUG("Assemble HydroMechanicsProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } template <int GlobalDim> @@ -523,10 +525,12 @@ void HydroMechanicsProcess<GlobalDim>::assembleWithJacobianConcreteProcess( DBUG("AssembleWithJacobian HydroMechanicsProcess."); // Call global assembler for each local assembly item. + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } template <int GlobalDim> diff --git a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp index 209fdcc943a64a1f0106da806c9e920329f71528..0a570a64bab61c19c22e9c99a1bd17e5e1b48230 100644 --- a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp +++ b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp @@ -417,10 +417,12 @@ void SmallDeformationProcess<DisplacementDim>::assembleConcreteProcess( { DBUG("Assemble SmallDeformationProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } template <int DisplacementDim> void SmallDeformationProcess<DisplacementDim>:: @@ -434,10 +436,12 @@ void SmallDeformationProcess<DisplacementDim>:: DBUG("AssembleWithJacobian SmallDeformationProcess."); // Call global assembler for each local assembly item. + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } template <int DisplacementDim> void SmallDeformationProcess<DisplacementDim>::preTimestepConcreteProcess( diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp index 3815f637d3b7398b16eefea0c357fc59dcb85187..8c04ad6d3c694ddf6aed3ec7fffc903b057f01c4 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp +++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp @@ -85,10 +85,13 @@ void LiquidFlowProcess::assembleConcreteProcess(const double t, GlobalVector& b) { DBUG("Assemble LiquidFlowProcess."); + + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } void LiquidFlowProcess::assembleWithJacobianConcreteProcess( @@ -98,11 +101,13 @@ void LiquidFlowProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian LiquidFlowProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } void LiquidFlowProcess::computeSecondaryVariableConcrete(const double t, diff --git a/ProcessLib/PhaseField/PhaseFieldProcess-impl.h b/ProcessLib/PhaseField/PhaseFieldProcess-impl.h index 6ea0104b3617df0042a8902666d71fc22927b708..a12755269c4ee1fdf2266fd412ab2957218cb407 100644 --- a/ProcessLib/PhaseField/PhaseFieldProcess-impl.h +++ b/ProcessLib/PhaseField/PhaseFieldProcess-impl.h @@ -142,10 +142,12 @@ void PhaseFieldProcess<DisplacementDim>::assembleConcreteProcess( { DBUG("Assemble PhaseFieldProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } template <int DisplacementDim> @@ -156,11 +158,13 @@ void PhaseFieldProcess<DisplacementDim>::assembleWithJacobianConcreteProcess( { // DBUG("AssembleJacobian PhaseFieldProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } template <int DisplacementDim> diff --git a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp index b555c827ac8a4e946637b8e820b47c660428da9c..e15b9e5e26cadf6b81e2dc7ffadae69cbd88e1a2 100644 --- a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp +++ b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp @@ -71,10 +71,12 @@ void RichardsComponentTransportProcess::assembleConcreteProcess( { DBUG("Assemble RichardsComponentTransportProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } void RichardsComponentTransportProcess::assembleWithJacobianConcreteProcess( @@ -84,11 +86,13 @@ void RichardsComponentTransportProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian RichardsComponentTransportProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } } // namespace RichardsComponentTransport diff --git a/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp b/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp index 81c24f18de353d2c77e4bc4ad7f4742e9f21ce34..a3a49cf9df33715ddcaa7564d6783f536b917a2b 100644 --- a/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp +++ b/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp @@ -72,10 +72,12 @@ void RichardsFlowProcess::assembleConcreteProcess( { DBUG("Assemble RichardsFlowProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } void RichardsFlowProcess::assembleWithJacobianConcreteProcess( @@ -85,11 +87,13 @@ void RichardsFlowProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian RichardsFlowProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } } // namespace RichardsFlow diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess-impl.h b/ProcessLib/SmallDeformation/SmallDeformationProcess-impl.h index 368e052e70b4b112db66eb49055e08385bdafbcf..cb19a67400a17ce7743f7219621fd436e83e6cdb 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationProcess-impl.h +++ b/ProcessLib/SmallDeformation/SmallDeformationProcess-impl.h @@ -148,10 +148,12 @@ void SmallDeformationProcess<DisplacementDim>::assembleConcreteProcess( { DBUG("Assemble SmallDeformationProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } template <int DisplacementDim> @@ -163,11 +165,13 @@ void SmallDeformationProcess<DisplacementDim>:: { DBUG("AssembleWithJacobian SmallDeformationProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); b.copyValues(*_nodal_forces); std::transform(_nodal_forces->begin(), _nodal_forces->end(), diff --git a/ProcessLib/TES/TESProcess.cpp b/ProcessLib/TES/TESProcess.cpp index 45db3b7bad8325ec498edf8d41fc02e4d472b1ac..217001080fd296e08e30c825982d4f03bd35675b 100644 --- a/ProcessLib/TES/TESProcess.cpp +++ b/ProcessLib/TES/TESProcess.cpp @@ -231,10 +231,12 @@ void TESProcess::assembleConcreteProcess(const double t, { DBUG("Assemble TESProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } void TESProcess::assembleWithJacobianConcreteProcess( @@ -242,10 +244,13 @@ void TESProcess::assembleWithJacobianConcreteProcess( const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; + // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } void TESProcess::preTimestepConcreteProcess(GlobalVector const& x, diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp index 2a425087d52b77d230a210364aabc59c1e3d0d6e..fcb75282219c1950008e43ecc95642adcf53a08d 100644 --- a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp +++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp @@ -79,10 +79,13 @@ void ThermalTwoPhaseFlowWithPPProcess::assembleConcreteProcess( GlobalVector& b) { DBUG("Assemble ThermalTwoPhaseFlowWithPPProcess."); + + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } void ThermalTwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( @@ -92,11 +95,13 @@ void ThermalTwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian ThermalTwoPhaseFlowWithPPProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } void ThermalTwoPhaseFlowWithPPProcess::preTimestepConcreteProcess( GlobalVector const& x, double const t, double const delta_t, diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess-impl.h b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess-impl.h index 4e056c74ca51261b6544ed7e462b74f78e9420fc..120310b627c0c6f3ec897ddf128cf88753690118 100644 --- a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess-impl.h +++ b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess-impl.h @@ -154,10 +154,12 @@ void ThermoMechanicsProcess<DisplacementDim>::assembleConcreteProcess( { DBUG("Assemble ThermoMechanicsProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } template <int DisplacementDim> @@ -171,11 +173,13 @@ void ThermoMechanicsProcess<DisplacementDim>:: { DBUG("AssembleJacobian ThermoMechanicsProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } template <int DisplacementDim> diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp index 83d84df8102d0e0d4cc70494838ce84771e7396b..4a6b65f77e02ced0322d2e6161447d0602c2b720 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp @@ -77,10 +77,13 @@ void TwoPhaseFlowWithPPProcess::assembleConcreteProcess(const double t, GlobalVector& b) { DBUG("Assemble TwoPhaseFlowWithPPProcess."); + + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } void TwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( @@ -90,11 +93,13 @@ void TwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian TwoPhaseFlowWithPPProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } } // end of namespace diff --git a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp index 4ff49bdb54395e275111bf6985ef20fe74a62d50..1b878fe50e3ad763b2f745feacf24f423300f57d 100644 --- a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp +++ b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp @@ -77,10 +77,13 @@ void TwoPhaseFlowWithPrhoProcess::assembleConcreteProcess(const double t, GlobalVector& b) { DBUG("Assemble TwoPhaseFlowWithPrhoProcess."); + + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions); + dof_table, t, x, M, K, b, _coupled_solutions); } void TwoPhaseFlowWithPrhoProcess::assembleWithJacobianConcreteProcess( @@ -90,11 +93,13 @@ void TwoPhaseFlowWithPrhoProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian TwoPhaseFlowWithPrhoProcess."); + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> + dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, _coupled_solutions, nullptr); + _local_assemblers, dof_table, t, x, xdot, dxdot_dx, + dx_dx, M, K, b, Jac, _coupled_solutions); } void TwoPhaseFlowWithPrhoProcess::preTimestepConcreteProcess( GlobalVector const& x, double const t, double const dt, diff --git a/ProcessLib/VectorMatrixAssembler.cpp b/ProcessLib/VectorMatrixAssembler.cpp index f5b7aaae34136b881c0345a38592c2a6b1001c07..e81523fec811c83215660902eb09f67477d74311 100644 --- a/ProcessLib/VectorMatrixAssembler.cpp +++ b/ProcessLib/VectorMatrixAssembler.cpp @@ -40,12 +40,22 @@ void VectorMatrixAssembler::preAssemble( void VectorMatrixAssembler::assemble( const std::size_t mesh_item_id, LocalAssemblerInterface& local_assembler, - const NumLib::LocalToGlobalIndexMap& dof_table, const double t, - const GlobalVector& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - CoupledSolutionsForStaggeredScheme const* const cpl_xs) + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> const& + dof_tables, + const double t, const GlobalVector& x, GlobalMatrix& M, GlobalMatrix& K, + GlobalVector& b, CoupledSolutionsForStaggeredScheme const* const cpl_xs) { - auto const indices = NumLib::getIndices(mesh_item_id, dof_table); + std::vector<std::vector<GlobalIndexType>> indices_of_processes; + indices_of_processes.reserve(dof_tables.size()); + for (std::size_t i = 0; i < dof_tables.size(); i++) + { + indices_of_processes.emplace_back( + NumLib::getIndices(mesh_item_id, dof_tables[i].get())); + } + auto const& indices = (dof_tables.size() == 1 && cpl_xs == nullptr) + ? indices_of_processes[0] + : indices_of_processes[cpl_xs->process_id]; _local_M_data.clear(); _local_K_data.clear(); _local_b_data.clear(); @@ -58,24 +68,10 @@ void VectorMatrixAssembler::assemble( } else { - // Different processes in a staggered loop are allowed to use different - // orders of element. That means that the global indices can be - // different among different processes. The following vector stores the - // reference of the vectors of the global indices of all processes, and - // it is used to fetch the nodal solutions of all processes of the - // current element. - std::vector<std::reference_wrapper<const std::vector<GlobalIndexType>>> - indices_of_all_coupled_processes; - indices_of_all_coupled_processes.reserve(cpl_xs->coupled_xs.size()); - for (std::size_t i = 0; i < cpl_xs->coupled_xs.size(); i++) - { - indices_of_all_coupled_processes.emplace_back(std::ref(indices)); - } - - auto local_coupled_xs0 = getPreviousLocalSolutions( - *cpl_xs, indices_of_all_coupled_processes); + auto local_coupled_xs0 = + getPreviousLocalSolutions(*cpl_xs, indices_of_processes); auto local_coupled_xs = - getCurrentLocalSolutions(*cpl_xs, indices_of_all_coupled_processes); + getCurrentLocalSolutions(*cpl_xs, indices_of_processes); ProcessLib::LocalCoupledSolutions local_coupled_solutions( cpl_xs->dt, cpl_xs->process_id, std::move(local_coupled_xs0), @@ -109,22 +105,24 @@ void VectorMatrixAssembler::assemble( void VectorMatrixAssembler::assembleWithJacobian( std::size_t const mesh_item_id, LocalAssemblerInterface& local_assembler, - NumLib::LocalToGlobalIndexMap const& dof_table, const double t, - GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, - const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac, CoupledSolutionsForStaggeredScheme const* const cpl_xs, - NumLib::LocalToGlobalIndexMap const* const base_dof_table) + std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> const& + dof_tables, + const double t, GlobalVector const& x, GlobalVector const& xdot, + const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, + GlobalVector& b, GlobalMatrix& Jac, + CoupledSolutionsForStaggeredScheme const* const cpl_xs) { - // If base_dof_table != nullptr, it means that the staggered scheme is - // applied for coupling, meanwhile DOF tables of different are different - // as well. - auto const indices = - ((base_dof_table == nullptr) || - (cpl_xs->process_id == - static_cast<int>(cpl_xs->coupled_xs.size()) - 1 && - cpl_xs != nullptr)) - ? NumLib::getIndices(mesh_item_id, dof_table) - : NumLib::getIndices(mesh_item_id, *base_dof_table); + std::vector<std::vector<GlobalIndexType>> indices_of_processes; + indices_of_processes.reserve(dof_tables.size()); + for (std::size_t i = 0; i < dof_tables.size(); i++) + { + indices_of_processes.emplace_back( + NumLib::getIndices(mesh_item_id, dof_tables[i].get())); + } + + auto const& indices = (dof_tables.size() == 1 && cpl_xs == nullptr) + ? indices_of_processes[0] + : indices_of_processes[cpl_xs->process_id]; auto const local_xdot = xdot.get(indices); _local_M_data.clear(); @@ -141,32 +139,19 @@ void VectorMatrixAssembler::assembleWithJacobian( } else { - if (base_dof_table == nullptr) - { - local_assembleWithJacobianForStaggeredScheme( - t, indices, indices, local_xdot, local_assembler, dxdot_dx, - dx_dx, cpl_xs); - } - else - { - if (cpl_xs->process_id == - static_cast<int>(cpl_xs->coupled_xs.size()) - 1) - { - const auto base_indices = - NumLib::getIndices(mesh_item_id, *base_dof_table); - local_assembleWithJacobianForStaggeredScheme( - t, base_indices, indices, local_xdot, local_assembler, - dxdot_dx, dx_dx, cpl_xs); - } - else - { - const auto full_indices = - NumLib::getIndices(mesh_item_id, dof_table); - local_assembleWithJacobianForStaggeredScheme( - t, indices, full_indices, local_xdot, local_assembler, - dxdot_dx, dx_dx, cpl_xs); - } - } + auto local_coupled_xs0 = + getPreviousLocalSolutions(*cpl_xs, indices_of_processes); + auto local_coupled_xs = + getCurrentLocalSolutions(*cpl_xs, indices_of_processes); + + ProcessLib::LocalCoupledSolutions local_coupled_solutions( + cpl_xs->dt, cpl_xs->process_id, std::move(local_coupled_xs0), + std::move(local_coupled_xs)); + + _jacobian_assembler->assembleWithJacobianForStaggeredScheme( + local_assembler, t, local_xdot, dxdot_dx, dx_dx, _local_M_data, + _local_K_data, _local_b_data, _local_Jac_data, + local_coupled_solutions); } auto const num_r_c = indices.size(); @@ -202,36 +187,4 @@ void VectorMatrixAssembler::assembleWithJacobian( } } -void VectorMatrixAssembler::local_assembleWithJacobianForStaggeredScheme( - const double t, std::vector<GlobalIndexType> const& base_indices, - std::vector<GlobalIndexType> const& full_indices, - std::vector<double> const& local_xdot, - LocalAssemblerInterface& local_assembler, const double dxdot_dx, - const double dx_dx, CoupledSolutionsForStaggeredScheme const* const cpl_xs) -{ - // The vector has the same purpose as that in assemble(..) in this file. - // For the detailed description, please see the comment inside assemble(..). - std::vector<std::reference_wrapper<const std::vector<GlobalIndexType>>> - indices_of_all_coupled_processes; - indices_of_all_coupled_processes.reserve(cpl_xs->coupled_xs.size()); - for (std::size_t i = 0; i < cpl_xs->coupled_xs.size() - 1; i++) - { - indices_of_all_coupled_processes.emplace_back(std::ref(base_indices)); - } - indices_of_all_coupled_processes.emplace_back(std::ref(full_indices)); - - auto local_coupled_xs0 = - getPreviousLocalSolutions(*cpl_xs, indices_of_all_coupled_processes); - auto local_coupled_xs = - getCurrentLocalSolutions(*cpl_xs, indices_of_all_coupled_processes); - - ProcessLib::LocalCoupledSolutions local_coupled_solutions( - cpl_xs->dt, cpl_xs->process_id, std::move(local_coupled_xs0), - std::move(local_coupled_xs)); - - _jacobian_assembler->assembleWithJacobianForStaggeredScheme( - local_assembler, t, local_xdot, dxdot_dx, dx_dx, _local_M_data, - _local_K_data, _local_b_data, _local_Jac_data, local_coupled_solutions); -} - } // namespace ProcessLib diff --git a/ProcessLib/VectorMatrixAssembler.h b/ProcessLib/VectorMatrixAssembler.h index 7961e7256c1da0f63687899cc9c082edd240e4cf..69ef7eec01a9270aa14d1fe549b7f646ee79235f 100644 --- a/ProcessLib/VectorMatrixAssembler.h +++ b/ProcessLib/VectorMatrixAssembler.h @@ -44,7 +44,8 @@ public: //! \remark Jacobian is not assembled here, see assembleWithJacobian(). void assemble(std::size_t const mesh_item_id, LocalAssemblerInterface& local_assembler, - NumLib::LocalToGlobalIndexMap const& dof_table, + std::vector<std::reference_wrapper< + NumLib::LocalToGlobalIndexMap>> const& dof_tables, double const t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, CoupledSolutionsForStaggeredScheme const* const cpl_xs); @@ -54,12 +55,13 @@ public: void assembleWithJacobian( std::size_t const mesh_item_id, LocalAssemblerInterface& local_assembler, - NumLib::LocalToGlobalIndexMap const& dof_table, const double t, - GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, - const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac, - CoupledSolutionsForStaggeredScheme const* const cpl_xs, - NumLib::LocalToGlobalIndexMap const* const base_dof_table); + std::vector< + std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> const& + dof_tables, + const double t, GlobalVector const& x, GlobalVector const& xdot, + const double dxdot_dx, const double dx_dx, GlobalMatrix& M, + GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, + CoupledSolutionsForStaggeredScheme const* const cpl_xs); private: // temporary data only stored here in order to avoid frequent memory @@ -71,14 +73,6 @@ private: //! Used to assemble the Jacobian. std::unique_ptr<AbstractJacobianAssembler> _jacobian_assembler; - - void local_assembleWithJacobianForStaggeredScheme( - const double t, std::vector<GlobalIndexType> const& base_indices, - std::vector<GlobalIndexType> const& full_indices, - std::vector<double> const& local_xdot, - LocalAssemblerInterface& local_assembler, const double dxdot_dx, - const double dx_dx, - CoupledSolutionsForStaggeredScheme const* const cpl_xs); }; } // namespace ProcessLib