layerInfo.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-2023 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::layerInfo
26 
27 Description
28  Class to be used with FaceCellWave which enumerates layers of cells
29 
30 SourceFiles
31  layerInfoI.H
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef layerInfo_H
36 #define layerInfo_H
37 
38 #include "pointField.H"
39 #include "face.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of classes
47 class polyPatch;
48 class polyMesh;
49 class transformer;
50 
51 // Forward declaration of friend functions and operators
52 class layerInfo;
53 inline Ostream& operator<<(Ostream&, const layerInfo&);
54 inline Istream& operator>>(Istream&, layerInfo&);
55 
56 /*---------------------------------------------------------------------------*\
57  Class layerInfo Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class layerInfo
61 {
62  // Private Data
63 
64  //- Layer index
65  label layer_;
66 
67  //- Direction of propagation (+1 or -1) relative to the face normal.
68  // Only valid when on a face. Takes a value of 0 when in a cell.
69  label direction_;
70 
71  //- The previous face index. Only valid when in a cell. Takes a value
72  // of -1 if on a face.
73  label prevFace_;
74 
75 
76  // Private Member Functions
77 
78  //- Generate an error in the event that opposing waves collided
79  void collide() const;
80 
81 
82 public:
83 
84  // Constructors
85 
86  //- Construct null
87  inline layerInfo();
88 
89  //- Construct given the face layer index and direction
90  inline layerInfo(const label faceLayer, const label direction);
91 
92 
93  // Member Functions
94 
95  // Access
96 
97  //- Return the face layer index
98  inline label faceLayer() const;
99 
100  //- Return the cell layer index
101  inline label cellLayer() const;
102 
103 
104  // Needed by FaceCellWave
105 
106  //- Check whether the layerInfo has been changed at all or still
107  // contains original (invalid) value.
108  template<class TrackingData>
109  inline bool valid(TrackingData& td) const;
110 
111  //- Check for identical geometrical data. Used for checking
112  // consistency across cyclics.
113  template<class TrackingData>
114  inline bool sameGeometry
115  (
116  const polyMesh&,
117  const layerInfo&,
118  const scalar,
119  TrackingData& td
120  ) const;
121 
122  //- Transform across an interface
123  template<class TrackingData>
124  inline void transform
125  (
126  const polyPatch& patch,
127  const label patchFacei,
128  const transformer& transform,
129  TrackingData& td
130  );
131 
132  //- Influence of neighbouring face
133  template<class TrackingData>
134  inline bool updateCell
135  (
136  const polyMesh&,
137  const label thisCelli,
138  const label nbrFacei,
139  const layerInfo& nbrInfo,
140  const scalar tol,
141  TrackingData& td
142  );
143 
144  //- Influence of neighbouring cell
145  template<class TrackingData>
146  inline bool updateFace
147  (
148  const polyMesh&,
149  const label thisFacei,
150  const label nbrCelli,
151  const layerInfo& nbrInfo,
152  const scalar tol,
153  TrackingData& td
154  );
155 
156  //- Influence of different value on same face
157  template<class TrackingData>
158  inline bool updateFace
159  (
160  const polyMesh&,
161  const label thisFacei,
162  const layerInfo& nbrInfo,
163  const scalar tol,
164  TrackingData& td
165  );
166 
167  //- Test equality
168  template<class TrackingData>
169  inline bool equal
170  (
171  const layerInfo&,
172  TrackingData& td
173  ) const;
174 
175 
176  // Member Operators
177 
178  inline bool operator==(const layerInfo&) const;
179  inline bool operator!=(const layerInfo&) const;
180 
181 
182  // IOstream Operators
183 
184  inline friend Ostream& operator<<(Ostream&, const layerInfo&);
185  inline friend Istream& operator>>(Istream&, layerInfo&);
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 template<>
192 inline bool contiguous<layerInfo>()
193 {
194  return true;
195 }
196 
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 } // End namespace Foam
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #include "layerInfoI.H"
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Class to be used with FaceCellWave which enumerates layers of cells.
Definition: layerInfo.H:60
friend Istream & operator>>(Istream &, layerInfo &)
layerInfo()
Construct null.
Definition: layerInfoI.H:43
bool operator==(const layerInfo &) const
Definition: layerInfoI.H:218
label faceLayer() const
Return the face layer index.
Definition: layerInfoI.H:61
bool updateCell(const polyMesh &, const label thisCelli, const label nbrFacei, const layerInfo &nbrInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: layerInfoI.H:120
bool updateFace(const polyMesh &, const label thisFacei, const label nbrCelli, const layerInfo &nbrInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: layerInfoI.H:150
bool operator!=(const layerInfo &) const
Definition: layerInfoI.H:224
label cellLayer() const
Return the cell layer index.
Definition: layerInfoI.H:74
bool valid(TrackingData &td) const
Check whether the layerInfo has been changed at all or still.
Definition: layerInfoI.H:88
void transform(const polyPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
Definition: layerInfoI.H:109
bool sameGeometry(const polyMesh &, const layerInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for checking.
Definition: layerInfoI.H:96
friend Ostream & operator<<(Ostream &, const layerInfo &)
bool equal(const layerInfo &, TrackingData &td) const
Test equality.
Definition: layerInfoI.H:207
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Namespace for OpenFOAM.
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
bool contiguous< layerInfo >()
Definition: layerInfo.H:191
Istream & operator>>(Istream &, directionInfo &)
Ostream & operator<<(Ostream &, const ensightPart &)
uint8_t direction
Definition: direction.H:45