Loading...
Searching...
No Matches
patchInteractionDataList.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) 2011-2017 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
30#include "emptyPolyPatch.H"
31
32// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
33
35:
37 patchGroupIDs_()
38{}
39
40
42(
43 const polyMesh& mesh,
44 const dictionary& dict
45)
46:
48 patchGroupIDs_(this->size())
49{
50 const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
51 const List<patchInteractionData>& items = *this;
52 forAllReverse(items, i)
53 {
54 const wordRe& patchName = items[i].patchName();
55 labelList ids = bMesh.indices(patchName);
56
57 if (ids.empty())
58 {
60 << "Cannot find any patch names matching "
61 << patchName << endl;
62 }
63
64 patchGroupIDs_[i].transfer(ids);
65 }
66
67 // Check that all patches are specified
68 DynamicList<word> badPatches;
69 for (const polyPatch& pp : bMesh)
70 {
71 if
72 (
73 !pp.coupled()
75 && applyToPatch(pp.index()) < 0
76 )
77 {
78 badPatches.append(pp.name());
79 }
80 }
81
82 if (!badPatches.empty())
83 {
85 << "All patches must be specified when employing local patch "
86 << "interaction. Please specify data for patches:" << nl
87 << badPatches << nl
88 << exit(FatalError);
89 }
90}
91
92
94(
95 const patchInteractionDataList& pidl
96)
97:
99 patchGroupIDs_(pidl.patchGroupIDs_)
100{}
101
102
103// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
104
105Foam::label Foam::patchInteractionDataList::applyToPatch(const label id) const
106{
107 forAll(patchGroupIDs_, groupi)
108 {
109 if (patchGroupIDs_[groupi].found(id))
110 {
111 return groupi;
112 }
113 }
114
115 return -1;
116}
117
118
119// ************************************************************************* //
bool found
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
void append(const T &val)
Copy append an element to the end of this list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
Definition List.C:347
bool empty() const noexcept
True if List is empty (ie, size() is zero).
Definition UList.H:701
void size(const label n)
Definition UList.H:118
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
label applyToPatch(const label id) const
Return label of group containing patch id.
Helper class for the LocalInteraction patch interaction model.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
Lookup type of boundary radiation properties.
Definition lookup.H:60
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition wordRe.H:81
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
#define WarningInFunction
Report a warning using Foam::Warning.
List< label > labelList
A List of labels.
Definition List.H:62
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
Definition typeInfo.H:87
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
PrimitivePatch< List< face >, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points).
Definition bMesh.H:39
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Definition stdFoam.H:315