Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
peterrum committed May 14, 2022
1 parent 53a836f commit 3941127
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions doc/news/changes/minor/20220514Munch
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
New: We added the possibility to average the contributions to a DoF from
different cells in parallel::distributed::SolutionTransfer. For this purpose,
set the corresponding flag in the constructor.
<br>
(Peter Munch, Magdalena Schreter, 2022/05/14)
9 changes: 5 additions & 4 deletions source/distributed/solution_transfer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,9 @@ namespace parallel
&dof_handler->get_triangulation())));
Assert(tria != nullptr, ExcInternalError());

for (const auto vec : all_out)
*vec = 0.0;
if (average_values)
for (const auto vec : all_out)
*vec = 0.0;

VectorType valence;

Expand All @@ -268,12 +269,12 @@ namespace parallel
// finalize valence: compress and invert
valence.compress(::dealii::VectorOperation::add);
for (const auto i : valence.locally_owned_elements())
valence[i] = valence[i] == 0.0 ? 0.0 : (1.0 / valence[i]);
valence[i] = (valence[i] == 0.0 ? 0.0 : (1.0 / valence[i]));
valence.compress(::dealii::VectorOperation::insert);

for (const auto vec : all_out)
{
// comress and weight with valence
// compress and weight with valence
vec->compress(::dealii::VectorOperation::add);
vec->scale(valence);
}
Expand Down

0 comments on commit 3941127

Please sign in to comment.