cellInfo.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019 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 Class
28  Foam::cellInfo
29 
30 Description
31  Holds information regarding type of cell. Used in inside/outside
32  determination in cellClassification.
33 
34 SourceFiles
35  cellInfoI.H
36  cellInfo.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef cellInfo_H
41 #define cellInfo_H
42 
43 #include "point.H"
44 #include "label.H"
45 #include "tensor.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward Declarations
53 class polyPatch;
54 class polyMesh;
55 class cellInfo;
56 
57 Istream& operator>>(Istream&, cellInfo&);
58 Ostream& operator<<(Ostream&, const cellInfo&);
59 
60 
61 /*---------------------------------------------------------------------------*\
62  Class cellInfo Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class cellInfo
66 {
67  // Private data
68 
69  label type_;
70 
71 
72  // Private Member Functions
73 
74  //- Update current cell/face type with neighbouring
75  // type. Return true if information needs to propagate,
76  // false otherwise.
77  template<class TrackingData>
78  inline bool update
79  (
80  const cellInfo& w2,
81  const label thisFacei,
82  const label thisCelli,
83  const label neighbourFacei,
84  const label neighbourCelli,
85  TrackingData& td
86  );
87 
88 public:
89 
90  // Constructors
91 
92  //- Construct null
93  inline cellInfo();
94 
95  //- Construct from cType
96  inline cellInfo(const label);
97 
98  //- Construct as copy
99  inline cellInfo(const cellInfo&);
100 
101 
102  // Member Functions
103 
104  // Access
105 
106  inline label type() const
107  {
108  return type_;
109  }
110 
111 
112  // Needed by meshWave
113 
114  //- Check whether origin has been changed at all or
115  // still contains original (invalid) value.
116  template<class TrackingData>
117  inline bool valid(TrackingData& td) const;
118 
119  //- Check for identical geometrical data. Used for cyclics checking.
120  template<class TrackingData>
121  inline bool sameGeometry
122  (
123  const polyMesh&,
124  const cellInfo&,
125  const scalar,
126  TrackingData& td
127  ) const;
128 
129  //- Convert any absolute coordinates into relative to (patch)face
130  // centre
131  template<class TrackingData>
132  inline void leaveDomain
133  (
134  const polyMesh&,
135  const polyPatch& patch,
136  const label patchFacei,
137  const point& faceCentre,
138  TrackingData& td
139  );
140 
141  //- Reverse of leaveDomain
142  template<class TrackingData>
143  inline void enterDomain
144  (
145  const polyMesh&,
146  const polyPatch& patch,
147  const label patchFacei,
148  const point& faceCentre,
149  TrackingData& td
150  );
151 
152  //- Apply rotation matrix to any coordinates
153  template<class TrackingData>
154  inline void transform
155  (
156  const polyMesh&,
157  const tensor& rotTensor,
158  TrackingData& td
159  );
160 
161  //- Influence of neighbouring face.
162  template<class TrackingData>
163  inline bool updateCell
164  (
165  const polyMesh&,
166  const label thisCelli,
167  const label neighbourFacei,
168  const cellInfo& neighbourInfo,
169  const scalar tol,
170  TrackingData& td
171  );
172 
173  //- Influence of neighbouring cell.
174  template<class TrackingData>
175  inline bool updateFace
176  (
177  const polyMesh&,
178  const label thisFacei,
179  const label neighbourCelli,
180  const cellInfo& neighbourInfo,
181  const scalar tol,
182  TrackingData& td
183  );
184 
185  //- Influence of different value on same face.
186  template<class TrackingData>
187  inline bool updateFace
188  (
189  const polyMesh&,
190  const label thisFacei,
191  const cellInfo& neighbourInfo,
192  const scalar tol,
193  TrackingData& td
194  );
195 
196  //- Same (like operator==)
197  template<class TrackingData>
198  inline bool equal(const cellInfo&, TrackingData& td) const;
199 
200  // Member Operators
201 
202  //Note: Used to determine whether to call update.
203  inline bool operator==(const cellInfo&) const;
204 
205  inline bool operator!=(const cellInfo&) const;
206 
207 
208  // IOstream Operators
209 
210  friend Ostream& operator<<(Ostream&, const cellInfo&);
211  friend Istream& operator>>(Istream&, cellInfo&);
212 };
213 
214 
215 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
216 
217 //- Contiguous data for cellInfo
218 template<> struct is_contiguous<cellInfo> : std::true_type {};
219 
220 //- Contiguous label data for cellInfo
221 template<> struct is_contiguous_label<cellInfo> : std::true_type {};
222 
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 } // End namespace Foam
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #include "cellInfoI.H"
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #endif
235 
236 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::cellInfo::operator<<
friend Ostream & operator<<(Ostream &, const cellInfo &)
point.H
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
Foam::cellInfo::updateCell
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const cellInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: cellInfoI.H:182
Foam::cellInfo::updateFace
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const cellInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: cellInfoI.H:206
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::cellInfo::sameGeometry
bool sameGeometry(const polyMesh &, const cellInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: cellInfoI.H:130
Foam::is_contiguous_label
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:83
Foam::cellInfo::transform
void transform(const polyMesh &, const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: cellInfoI.H:158
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::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::cellInfo::type
label type() const
Definition: cellInfo.H:105
w2
#define w2
Definition: blockCreate.C:35
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cellInfo::enterDomain
void enterDomain(const polyMesh &, const polyPatch &patch, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: cellInfoI.H:169
Foam::cellInfo
Holds information regarding type of cell. Used in inside/outside determination in cellClassification.
Definition: cellInfo.H:64
Foam::cellInfo::operator==
bool operator==(const cellInfo &) const
Definition: cellInfoI.H:262
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
label.H
Foam::cellInfo::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: cellInfoI.H:121
Foam::cellInfo::cellInfo
cellInfo()
Construct null.
Definition: cellInfoI.H:98
Foam::cellInfo::operator>>
friend Istream & operator>>(Istream &, cellInfo &)
cellInfoI.H
Foam::cellInfo::operator!=
bool operator!=(const cellInfo &) const
Definition: cellInfoI.H:268
Foam::cellInfo::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &patch, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
Definition: cellInfoI.H:145
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::cellInfo::equal
bool equal(const cellInfo &, TrackingData &td) const
Same (like operator==)
Definition: cellInfoI.H:251
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75