nonConformalCoupledPolyPatch.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 #include "polyMesh.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
35 }
36 
37 
38 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
39 
41 {
43 
44  errorPatchName_ = word::null;
45  errorPatchID_ = -1;
46 }
47 
48 
50 (
51  const labelUList& newToOldIndex
52 )
53 {
54  nonConformalPolyPatch::reorder(newToOldIndex);
55 
56  errorPatchName_ = word::null;
57  errorPatchID_ = -1;
58 }
59 
60 
61 // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
62 
64 (
65  const polyPatch& patch
66 )
67 :
68  nonConformalPolyPatch(patch),
69  patch_(refCast<const coupledPolyPatch>(patch)),
70  errorPatchName_(word::null),
71  errorPatchID_(-1)
72 {}
73 
74 
76 (
77  const polyPatch& patch,
78  const word& origPatchName
79 )
80 :
81  nonConformalPolyPatch(patch, origPatchName),
82  patch_(refCast<const coupledPolyPatch>(patch)),
83  errorPatchName_(word::null),
84  errorPatchID_(-1)
85 {}
86 
87 
89 (
90  const polyPatch& patch,
91  const dictionary& dict
92 )
93 :
95  patch_(refCast<const coupledPolyPatch>(patch)),
96  errorPatchName_(word::null),
97  errorPatchID_(-1)
98 {}
99 
100 
102 (
103  const polyPatch& patch,
104  const nonConformalCoupledPolyPatch& nccPatch
105 )
106 :
107  nonConformalPolyPatch(patch, nccPatch),
108  patch_(refCast<const coupledPolyPatch>(patch)),
109  errorPatchName_(word::null),
110  errorPatchID_(-1)
111 {}
112 
113 
114 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
115 
117 {}
118 
119 
120 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 
123 {
124  return patch_.owner();
125 }
126 
127 
129 {
130  return patch_.neighbour();
131 }
132 
133 
135 {
136  return patch_.transform();
137 }
138 
139 
141 {
142  return patch_.boundaryMesh()[errorPatchID()].name();
143 }
144 
145 
147 {
148  if (errorPatchID_ == -1)
149  {
150  forAll(patch_.boundaryMesh(), patchi)
151  {
152  const polyPatch& p = patch_.boundaryMesh()[patchi];
153 
154  if
155  (
156  isA<nonConformalErrorPolyPatch>(p)
157  && refCast<const nonConformalErrorPolyPatch>(p).origPatchID()
158  == origPatchID()
159  )
160  {
161  errorPatchID_ = patchi;
162  break;
163  }
164  }
165  }
166 
167  if (errorPatchID_ == -1)
168  {
170  << "No error patch of type "
171  << nonConformalErrorPolyPatch::typeName
172  << " defined for patch " << origPatchName()
173  << exit(FatalError);
174  }
175 
176  return errorPatchID_;
177 }
178 
179 
182 {
183  return
184  refCast<const nonConformalErrorPolyPatch>
185  (
186  patch_.boundaryMesh()[errorPatchID()]
187  );
188 }
189 
190 
192 {
194 }
195 
196 
197 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Non-conformal coupled poly patch. As nonConformalPolyPatch, but this patch is coupled to another non-...
const transformer & transform() const
Return transformation between the coupled patches.
const nonConformalErrorPolyPatch & errorPatch() const
Error patch.
nonConformalCoupledPolyPatch(const polyPatch &patch)
Construct from a patch.
bool owner() const
Does this side own the patch?
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
virtual void rename(const wordList &newNames)
Reset the patch name.
virtual void reorder(const labelUList &newToOldIndex)
Reset the patch index.
const word & errorPatchName() const
Error patch name.
bool neighbour() const
Does the coupled side own the patch?
Non-conformal error poly patch. As nonConformalPolyPatch. This patch is a non-coupled non-conformal p...
Non-conformal poly patch. This patch is a placeholder and must have no faces. This patch is linked to...
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
virtual void rename(const wordList &newNames)
Reset the patch name.
virtual void reorder(const labelUList &newToOldIndex)
Reset the patch index.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Type transform(const Type &) const
Transform the given type.
A class for handling words, derived from string.
Definition: word.H:62
static const word null
An empty word.
Definition: word.H:77
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
label patchi
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:111
defineTypeNameAndDebug(combustionModel, 0)
error FatalError
dictionary dict
volScalarField & p