Loading...
Searching...
No Matches
lduPrimitiveMeshTemplates.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) 2013 OpenFOAM Foundation
9 Copyright (C) 2022-2023 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 "lduPrimitiveMesh.H"
30
31// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32
33template<class ProcPatch>
35(
37)
38{
39 lduSchedule schedule(2*interfaces.size());
40
41 label patchEvali = 0;
42 label numProcPatches = 0;
43
44 //
45 // 1. Schedule non-processor patches
46 //
47
48 forAll(interfaces, patchi)
49 {
50 if (interfaces.set(patchi))
51 {
52 if (isA<ProcPatch>(interfaces[patchi]))
53 {
54 ++numProcPatches;
55 }
56 else
57 {
58 schedule[patchEvali++].setInitEvaluate(patchi);
59 schedule[patchEvali++].setEvaluate(patchi);
60 }
61 }
62 }
63
64
65 //
66 // 2. Schedule processor patches
67 //
68
69 if (numProcPatches)
70 {
71 forAll(interfaces, patchi)
72 {
73 if (interfaces.set(patchi) && isA<ProcPatch>(interfaces[patchi]))
74 {
75 schedule[patchEvali].setInitEvaluate(patchi);
76 schedule[patchEvali + numProcPatches].setEvaluate(patchi);
77 ++patchEvali;
78 }
79 }
80 }
81
82 // Caution:
83 // The schedule is only valid for a subset of its range
84 // (where interfaces are defined) but must retain the full list length
85 // for later (external) bookkeeping
86
87 schedule.setSize(patchEvali);
88
89 return schedule;
90}
91
92
93// ************************************************************************* //
void setSize(label n)
Alias for resize().
Definition List.H:536
static lduSchedule nonBlockingSchedule(const lduInterfacePtrsList &)
Get non-scheduled send/receive schedule.
virtual lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch with only those pointing to interfaces being set.
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
List< lduScheduleEntry > lduSchedule
A List of lduSchedule entries.
Definition lduSchedule.H:46
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
Definition typeInfo.H:87
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299