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