patchEdgeFaceRegionI.H
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) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 "polyMesh.H"
30 #include "transform.H"
31 
32 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 
34 // Update this with w2 if w2 nearer to pt.
35 template<class TrackingData>
36 inline bool Foam::patchEdgeFaceRegion::update
37 (
38  const patchEdgeFaceRegion& w2,
39  const scalar tol,
40  TrackingData& td
41 )
42 {
43  if (!w2.valid(td))
44  {
46  << "problem." << abort(FatalError);
47  }
48 
49  if (w2.region_ == -2 || region_ == -2)
50  {
51  // Blocked edge/face
52  return false;
53  }
54 
55  if (!valid(td))
56  {
57  // current not yet set so use any value
58  operator=(w2);
59  return true;
60  }
61  else
62  {
63  if (w2.region_ < region_)
64  {
65  operator=(w2);
66  return true;
67  }
68  else
69  {
70  return false;
71  }
72  }
73 }
74 
75 
76 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
77 
79 :
80  region_(-1)
81 {}
82 
83 
85 (
86  const label regioni
87 )
88 :
89  region_(regioni)
90 {}
91 
92 
93 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
94 
95 template<class TrackingData>
96 inline bool Foam::patchEdgeFaceRegion::valid(TrackingData& td) const
97 {
98  return region_ != -1;
99 }
100 
101 
102 template<class TrackingData>
104 (
105  const polyMesh& mesh,
107  const tensor& rotTensor,
108  const scalar tol,
109  TrackingData& td
110 )
111 {}
112 
113 
114 template<class TrackingData>
116 (
117  const polyMesh& mesh,
119  const label edgeI,
120  const label facei,
121  const patchEdgeFaceRegion& faceInfo,
122  const scalar tol,
123  TrackingData& td
124 )
125 {
126  return update(faceInfo, tol, td);
127 }
128 
129 
130 template<class TrackingData>
132 (
133  const polyMesh& mesh,
135  const patchEdgeFaceRegion& edgeInfo,
136  const bool sameOrientation,
137  const scalar tol,
138  TrackingData& td
139 )
140 {
141  return update(edgeInfo, tol, td);
142 }
143 
144 
145 template<class TrackingData>
147 (
148  const polyMesh& mesh,
150  const label facei,
151  const label edgeI,
152  const patchEdgeFaceRegion& edgeInfo,
153  const scalar tol,
154  TrackingData& td
155 )
156 {
157  return update(edgeInfo, tol, td);
158 }
159 
160 
161 template<class TrackingData>
163 (
164  const patchEdgeFaceRegion& rhs,
165  TrackingData& td
166 ) const
167 {
168  return operator==(rhs);
169 }
170 
171 
172 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
173 
174 inline bool Foam::patchEdgeFaceRegion::operator==
175 (
176  const patchEdgeFaceRegion& rhs
177 ) const
178 {
179  return region_ == rhs.region_;
180 }
181 
182 
183 inline bool Foam::patchEdgeFaceRegion::operator!=
184 (
185  const patchEdgeFaceRegion& rhs
186 ) const
187 {
188  return !(*this == rhs);
189 }
190 
191 
192 // ************************************************************************* //
Foam::Tensor< scalar >
update
mesh update()
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::patchEdgeFaceRegion::equal
bool equal(const patchEdgeFaceRegion &, TrackingData &) const
Test for equality, with TrackingData.
Definition: patchEdgeFaceRegionI.H:163
Foam::patchEdgeFaceRegion::patchEdgeFaceRegion
patchEdgeFaceRegion()
Default construct.
Definition: patchEdgeFaceRegionI.H:78
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::patchEdgeFaceRegion::transform
void transform(const polyMesh &mesh, const indirectPrimitivePatch &patch, const tensor &rotTensor, const scalar tol, TrackingData &td)
Apply rotation matrix.
Definition: patchEdgeFaceRegionI.H:104
Foam::patchEdgeFaceRegion::updateFace
bool updateFace(const polyMesh &mesh, const indirectPrimitivePatch &patch, const label facei, const label edgeI, const patchEdgeFaceRegion &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on face.
Definition: patchEdgeFaceRegionI.H:147
Foam::patchEdgeFaceRegion::valid
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: patchEdgeFaceRegionI.H:96
Foam::FatalError
error FatalError
w2
#define w2
Definition: blockCreate.C:35
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::patchEdgeFaceRegion
Transport of region for use in PatchEdgeFaceWave.
Definition: patchEdgeFaceRegion.H:67
transform.H
3D tensor transformation operations.
Foam::patchEdgeFaceRegion::updateEdge
bool updateEdge(const polyMesh &mesh, const indirectPrimitivePatch &patch, const label edgeI, const label facei, const patchEdgeFaceRegion &faceInfo, const scalar tol, TrackingData &td)
Influence of face on edge.
Definition: patchEdgeFaceRegionI.H:116
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79