Loading...
Searching...
No Matches
domainDecompositionTemplates.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2014-2016 OpenFOAM Foundation
9 Copyright (C) 2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "cyclicPolyPatch.H"
30
31// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32
33template<class BinaryOp>
34void Foam::domainDecomposition::processInterCyclics
35(
36 const polyBoundaryMesh& patches,
37 List<DynamicList<DynamicList<label>>>& interPatchFaces,
38 List<Map<label>>& procNbrToInterPatch,
39 List<labelListList>& subPatchIDs,
40 List<labelListList>& subPatchStarts,
41 bool owner,
42 BinaryOp bop
43) const
44{
45 // Processor boundaries from split cyclics
46 forAll(patches, patchi)
47 {
48 const auto& pp = patches[patchi];
49 const auto* cpp = isA<cyclicPolyPatch>(pp);
50
51 if (cpp && cpp->owner() == owner)
52 {
53 // cyclic: check opposite side on this processor
54 const auto& cycPatch = *cpp;
55 const auto& nbrPatch = cycPatch.neighbPatch();
56
57 // cyclic: check opposite side on this processor
58 const labelUList& patchFaceCells = pp.faceCells();
59 const labelUList& nbrPatchFaceCells = nbrPatch.faceCells();
60
61 // Store old sizes. Used to detect which inter-proc patches
62 // have been added to.
63 labelListList oldInterfaceSizes(nProcs_);
64 forAll(oldInterfaceSizes, proci)
65 {
66 labelList& curOldSizes = oldInterfaceSizes[proci];
67
68 curOldSizes.setSize(interPatchFaces[proci].size());
69 forAll(curOldSizes, interI)
70 {
71 curOldSizes[interI] =
72 interPatchFaces[proci][interI].size();
73 }
74 }
75
76 // Add faces with different owner and neighbour processors
77 forAll(patchFaceCells, facei)
78 {
79 const label ownerProc = cellToProc_[patchFaceCells[facei]];
80 const label nbrProc = cellToProc_[nbrPatchFaceCells[facei]];
81 if (bop(ownerProc, nbrProc))
82 {
83 // inter - processor patch face found.
84 addInterProcFace
85 (
86 pp.start()+facei,
87 ownerProc,
88 nbrProc,
89 procNbrToInterPatch,
90 interPatchFaces
91 );
92 }
93 }
94
95 // 1. Check if any faces added to existing interfaces
96 forAll(oldInterfaceSizes, proci)
97 {
98 const labelList& curOldSizes = oldInterfaceSizes[proci];
99
100 forAll(curOldSizes, interI)
101 {
102 label oldSz = curOldSizes[interI];
103 if (interPatchFaces[proci][interI].size() > oldSz)
104 {
105 // Added faces to this interface. Add an entry
106 subPatchIDs[proci][interI].append(patchi);
107 subPatchStarts[proci][interI].append(oldSz);
108 }
109 }
110 }
111
112 // 2. Any new interfaces
113 forAll(subPatchIDs, proci)
114 {
115 label nIntfcs = interPatchFaces[proci].size();
116 subPatchIDs[proci].setSize(nIntfcs, labelList(1, patchi));
117 subPatchStarts[proci].setSize(nIntfcs, labelList(1, Zero));
118 }
119 }
120 }
121}
122
123
124// ************************************************************************* //
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
label size() const noexcept
Definition HashTable.H:358
void setSize(label n)
Alias for resize().
Definition List.H:536
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
const labelUList & owner() const
Internal face owner. Note bypassing virtual mechanism so.
Definition fvMesh.H:572
const polyBoundaryMesh & patches
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
List< label > labelList
A List of labels.
Definition List.H:62
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
Definition typeInfo.H:87
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
UList< label > labelUList
A UList of labels.
Definition UList.H:75
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299