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 {
34  defineTypeNameAndDebug(nonConformalCoupledPolyPatch, 0);
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 :
94  nonConformalPolyPatch(patch, dict),
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
Non-conformal coupled poly patch. As nonConformalPolyPatch, but this patch is coupled to another non-...
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
const transformer & transform() const
Return transformation between the coupled patches.
virtual void rename(const wordList &newNames)
Reset the patch name.
bool neighbour() const
Does the coupled side own the patch?
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
const nonConformalErrorPolyPatch & errorPatch() const
Error patch.
bool owner() const
Does this side own the patch?
A class for handling words, derived from string.
Definition: word.H:59
nonConformalCoupledPolyPatch(const polyPatch &patch)
Construct from a patch.
static const word null
An empty word.
Definition: word.H:77
Non-conformal poly patch. This patch is a placeholder and must have no faces. This patch is linked to...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual void rename(const wordList &newNames)
Reset the patch name.
Non-conformal error poly patch. As nonConformalPolyPatch. This patch is a non-coupled non-conformal p...
defineTypeNameAndDebug(combustionModel, 0)
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
label patchi
virtual void reorder(const labelUList &newToOldIndex)
Reset the patch index.
const word & errorPatchName() const
Error patch name.
Type transform(const Type &) const
Transform the given type.
volScalarField & p
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
virtual void reorder(const labelUList &newToOldIndex)
Reset the patch index.
Namespace for OpenFOAM.