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 | Copyright (C) 2011-2016 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  //- Construct as copy
97  inline cellInfo(const cellInfo&);
98 
99 
100  // Member Functions
101 
102  // Access
104  inline label type() const
105  {
106  return type_;
107  }
108 
109 
110  // Needed by meshWave
111 
112  //- Check whether origin has been changed at all or
113  // still contains original (invalid) value.
114  template<class TrackingData>
115  inline bool valid(TrackingData& td) const;
116 
117  //- Check for identical geometrical data. Used for cyclics checking.
118  template<class TrackingData>
119  inline bool sameGeometry
120  (
121  const polyMesh&,
122  const cellInfo&,
123  const scalar,
124  TrackingData& td
125  ) const;
126 
127  //- Convert any absolute coordinates into relative to (patch)face
128  // centre
129  template<class TrackingData>
130  inline void leaveDomain
131  (
132  const polyMesh&,
133  const polyPatch& patch,
134  const label patchFacei,
135  const point& faceCentre,
136  TrackingData& td
137  );
138 
139  //- Reverse of leaveDomain
140  template<class TrackingData>
141  inline void enterDomain
142  (
143  const polyMesh&,
144  const polyPatch& patch,
145  const label patchFacei,
146  const point& faceCentre,
147  TrackingData& td
148  );
149 
150  //- Apply rotation matrix to any coordinates
151  template<class TrackingData>
152  inline void transform
153  (
154  const polyMesh&,
155  const tensor& rotTensor,
156  TrackingData& td
157  );
158 
159  //- Influence of neighbouring face.
160  template<class TrackingData>
161  inline bool updateCell
162  (
163  const polyMesh&,
164  const label thisCelli,
165  const label neighbourFacei,
166  const cellInfo& neighbourInfo,
167  const scalar tol,
168  TrackingData& td
169  );
170 
171  //- Influence of neighbouring cell.
172  template<class TrackingData>
173  inline bool updateFace
174  (
175  const polyMesh&,
176  const label thisFacei,
177  const label neighbourCelli,
178  const cellInfo& neighbourInfo,
179  const scalar tol,
180  TrackingData& td
181  );
182 
183  //- Influence of different value on same face.
184  template<class TrackingData>
185  inline bool updateFace
186  (
187  const polyMesh&,
188  const label thisFacei,
189  const cellInfo& neighbourInfo,
190  const scalar tol,
191  TrackingData& td
192  );
193 
194  //- Same (like operator==)
195  template<class TrackingData>
196  inline bool equal(const cellInfo&, TrackingData& td) const;
197 
198  // Member Operators
199 
200  //Note: Used to determine whether to call update.
201  inline bool operator==(const cellInfo&) const;
202 
203  inline bool operator!=(const cellInfo&) const;
204 
205 
206  // IOstream Operators
207 
208  friend Ostream& operator<<(Ostream&, const cellInfo&);
209  friend Istream& operator>>(Istream&, cellInfo&);
210 };
211 
212 
213 //- Data associated with cellInfo type are contiguous
214 template<>
215 inline bool contiguous<cellInfo>()
216 {
217  return true;
218 }
219 
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 } // End namespace Foam
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #include "cellInfoI.H"
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #endif
232 
233 // ************************************************************************* //
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:103
cellInfo()
Construct null.
Definition: cellInfoI.H:96
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:167
bool equal(const cellInfo &, TrackingData &td) const
Same (like operator==)
Definition: cellInfoI.H:249
bool operator==(const cellInfo &) const
Definition: cellInfoI.H:260
bool contiguous< cellInfo >()
Data associated with cellInfo type are contiguous.
Definition: cellInfo.H:214
friend Ostream & operator<<(Ostream &, const cellInfo &)
bool operator!=(const cellInfo &) const
Definition: cellInfoI.H:266
Istream & operator>>(Istream &, directionInfo &)
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: cellInfoI.H:119
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:180
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:143
bool sameGeometry(const polyMesh &, const cellInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: cellInfoI.H:128
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void transform(const polyMesh &, const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: cellInfoI.H:156
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:204
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.