From d3123a1107e11dbaf78f8d0b4e22899942b2e688 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Wed, 7 Sep 2022 16:00:54 +0200
Subject: [PATCH] BUG: redistributePar fails with some area fields (fixes
 #2574)

- this is especially evident in -reconstruct mode when
  the fields have several processor boundaries.

  Testing for an existing patch edge mapping must use the `test`
  method (with range-checking) instead of the more common `set`
  method since the source field will likely have many more boundaries
  than physical edge mappings.
---
 src/finiteArea/distributed/faMeshDistributorTemplates.C | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/finiteArea/distributed/faMeshDistributorTemplates.C b/src/finiteArea/distributed/faMeshDistributorTemplates.C
index 6f556f3dab5..9fb026451c6 100644
--- a/src/finiteArea/distributed/faMeshDistributorTemplates.C
+++ b/src/finiteArea/distributed/faMeshDistributorTemplates.C
@@ -93,7 +93,7 @@ Foam::faMeshDistributor::distributeField
 
     forAll(bfld, patchi)
     {
-        if (patchEdgeMaps_.set(patchi))
+        if (patchEdgeMaps_.test(patchi))
         {
             // Clone local patch field
 
@@ -203,7 +203,7 @@ Foam::faMeshDistributor::distributeField
 
     forAll(bfld, patchi)
     {
-        if (patchEdgeMaps_.set(patchi))
+        if (patchEdgeMaps_.test(patchi))
         {
             // Clone local patch field
 
-- 
GitLab