Skip to content
Snippets Groups Projects
Commit d6d4bc32 authored by wenqing's avatar wenqing
Browse files

[Coupling] Changed the type of an argument of the two functions

about getting the local solutions of an element.
parent 53c6a3d2
No related branches found
No related tags found
No related merge requests found
......@@ -30,30 +30,38 @@ CoupledSolutionsForStaggeredScheme::CoupledSolutionsForStaggeredScheme(
std::vector<std::vector<double>> getPreviousLocalSolutions(
const CoupledSolutionsForStaggeredScheme& cpl_xs,
const std::vector<GlobalIndexType>& indices)
const std::vector<
std::reference_wrapper<const std::vector<GlobalIndexType>>>&
indices)
{
const auto number_of_coupled_solutions = cpl_xs.coupled_xs.size();
std::vector<std::vector<double>> local_xs_t0;
local_xs_t0.reserve(number_of_coupled_solutions);
int coupling_id = 0;
for (auto const& x_t0 : cpl_xs.coupled_xs_t0)
{
local_xs_t0.emplace_back(x_t0->get(indices));
local_xs_t0.emplace_back(x_t0->get(indices[coupling_id].get()));
coupling_id++;
}
return local_xs_t0;
}
std::vector<std::vector<double>> getCurrentLocalSolutions(
const CoupledSolutionsForStaggeredScheme& cpl_xs,
const std::vector<GlobalIndexType>& indices)
const std::vector<
std::reference_wrapper<const std::vector<GlobalIndexType>>>&
indices)
{
const auto number_of_coupled_solutions = cpl_xs.coupled_xs.size();
std::vector<std::vector<double>> local_xs_t1;
local_xs_t1.reserve(number_of_coupled_solutions);
int coupling_id = 0;
for (auto const& x_t1 : cpl_xs.coupled_xs)
{
local_xs_t1.emplace_back(x_t1.get().get(indices));
local_xs_t1.emplace_back(x_t1.get().get(indices[coupling_id].get()));
coupling_id++;
}
return local_xs_t1;
}
......
......@@ -76,9 +76,13 @@ struct LocalCoupledSolutions
std::vector<std::vector<double>> getPreviousLocalSolutions(
const CoupledSolutionsForStaggeredScheme& cpl_xs,
const std::vector<GlobalIndexType>& indices);
const std::vector<
std::reference_wrapper<const std::vector<GlobalIndexType>>>&
indices);
std::vector<std::vector<double>> getCurrentLocalSolutions(
const CoupledSolutionsForStaggeredScheme& cpl_xs,
const std::vector<GlobalIndexType>& indices);
const std::vector<
std::reference_wrapper<const std::vector<GlobalIndexType>>>&
indices);
} // end of ProcessLib
......@@ -13,6 +13,8 @@
#include "StaggeredHTFEM.h"
#include <functional> // for std::reference_wrapper
#include "ProcessLib/CoupledSolutionsForStaggeredScheme.h"
namespace ProcessLib
......@@ -277,8 +279,11 @@ StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
{
auto const indices = NumLib::getIndices(this->_element.getID(), dof_table);
assert(!indices.empty());
auto const local_xs =
getCurrentLocalSolutions(*(this->_coupled_solutions), indices);
std::vector<std::reference_wrapper<const std::vector<GlobalIndexType>>>
indices_of_all_coupled_processes = {std::ref(indices),
std::ref(indices)};
auto const local_xs = getCurrentLocalSolutions(
*(this->_coupled_solutions), indices_of_all_coupled_processes);
return this->getIntPtDarcyVelocityLocal(t, local_xs[0], local_xs[1], cache);
}
......
......@@ -71,17 +71,11 @@ void LocalAssemblerInterface::computeSecondaryVariable(
{
auto const indices = NumLib::getIndices(mesh_item_id, dof_table);
if (coupled_xs == nullptr)
{
auto const local_x = x.get(indices);
computeSecondaryVariableConcrete(t, local_x);
}
else
{
auto const local_coupled_xs =
getCurrentLocalSolutions(*coupled_xs, indices);
computeSecondaryVariableWithCoupledProcessConcrete(t, local_coupled_xs);
}
if (coupled_xs != nullptr)
return;
auto const local_x = x.get(indices);
computeSecondaryVariableConcrete(t, local_x);
}
void LocalAssemblerInterface::preTimestep(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment