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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "polyMesh.H"
29 #include "transform.H"
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 // Update this with w2 if w2 nearer to pt.
34 template<class TrackingData>
35 inline bool Foam::patchEdgeFaceRegion::update
36 (
37  const patchEdgeFaceRegion& w2,
38  const scalar tol,
39  TrackingData& td
40 )
41 {
42  if (!w2.valid(td))
43  {
45  << "problem." << abort(FatalError);
46  }
47 
48  if (w2.region_ == -2 || region_ == -2)
49  {
50  // Blocked edge/face
51  return false;
52  }
53 
54  if (!valid(td))
55  {
56  // current not yet set so use any value
57  operator=(w2);
58  return true;
59  }
60  else
61  {
62  if (w2.region_ < region_)
63  {
64  operator=(w2);
65  return true;
66  }
67  else
68  {
69  return false;
70  }
71  }
72 }
73 
74 
75 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
76 
77 // Null constructor
79 :
80  region_(-1)
81 {}
82 
83 
84 // Construct from origin, distance
86 (
87  const label region
88 )
89 :
90  region_(region)
91 {}
92 
93 
94 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95 
97 {
98  return region_;
99 }
100 
101 
102 template<class TrackingData>
103 inline bool Foam::patchEdgeFaceRegion::valid(TrackingData& td) const
104 {
105  return region_ != -1;
106 }
107 
108 
109 template<class TrackingData>
111 (
112  const polyMesh& mesh,
114  const tensor& rotTensor,
115  const scalar tol,
116  TrackingData& td
117 )
118 {}
119 
120 
121 template<class TrackingData>
123 (
124  const polyMesh& mesh,
126  const label edgeI,
127  const label facei,
128  const patchEdgeFaceRegion& faceInfo,
129  const scalar tol,
130  TrackingData& td
131 )
132 {
133  return update(faceInfo, tol, td);
134 }
135 
136 
137 template<class TrackingData>
139 (
140  const polyMesh& mesh,
142  const patchEdgeFaceRegion& edgeInfo,
143  const bool sameOrientation,
144  const scalar tol,
145  TrackingData& td
146 )
147 {
148  return update(edgeInfo, tol, td);
149 }
150 
151 
152 template<class TrackingData>
154 (
155  const polyMesh& mesh,
157  const label facei,
158  const label edgeI,
159  const patchEdgeFaceRegion& edgeInfo,
160  const scalar tol,
161  TrackingData& td
162 )
163 {
164  return update(edgeInfo, tol, td);
165 }
166 
167 
168 template<class TrackingData>
170 (
171  const patchEdgeFaceRegion& rhs,
172  TrackingData& td
173 ) const
174 {
175  return operator==(rhs);
176 }
177 
178 
179 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
180 
181 inline bool Foam::patchEdgeFaceRegion::operator==
182 (
183  const Foam::patchEdgeFaceRegion& rhs
184 ) const
185 {
186  return region() == rhs.region();
187 }
188 
189 
190 inline bool Foam::patchEdgeFaceRegion::operator!=
191 (
192  const Foam::patchEdgeFaceRegion& rhs
193 ) const
194 {
195  return !(*this == rhs);
196 }
197 
198 
199 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::patchEdgeFaceRegion::region
label region() const
Definition: patchEdgeFaceRegionI.H:96
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
Same (like operator==)
Definition: patchEdgeFaceRegionI.H:170
Foam::patchEdgeFaceRegion::patchEdgeFaceRegion
patchEdgeFaceRegion()
Construct null.
Definition: patchEdgeFaceRegionI.H:78
Foam::label
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:62
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:111
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:154
Foam::patchEdgeFaceRegion::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: patchEdgeFaceRegionI.H:103
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:137
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
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:123
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:90