meshToMeshData.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) 2017-2020 OpenCFD Ltd.
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 Class
27  Foam::meshToMeshData
28 
29 Description
30  Transfers refinement levels such that slow transition between levels is
31  maintained. Used in FaceCellWave.
32 
33 SourceFiles
34  meshToMeshDataI.H
35  meshToMeshData.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef meshToMeshData_H
40 #define meshToMeshData_H
41 
42 #include "point.H"
43 #include "tensor.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward Declarations
51 class polyPatch;
52 class polyMesh;
53 class meshToMeshData;
54 
55 Istream& operator>>(Istream&, meshToMeshData&);
56 Ostream& operator<<(Ostream&, const meshToMeshData&);
57 
58 
59 /*---------------------------------------------------------------------------*\
60  Class meshToMeshData Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class meshToMeshData
64 {
65  // Private Data
66 
67  //- Corresponding cell in tgtMesh
68  label tgtCelli_;
69 
70 
71 public:
72 
73  // Public Classes
74 
75  //- Class used to pass non-cell data to the update function
76  class trackData
77  {
78  public:
79 
80  const polyMesh& tgtMesh_;
81 
82  trackData(const polyMesh& tgtMesh)
83  :
84  tgtMesh_(tgtMesh)
85  {}
86  };
87 
88 
89  // Constructors
90 
91  //- Default construct
92  inline meshToMeshData();
93 
94  //- Construct from target cell
95  inline meshToMeshData(const label tgtCelli);
96 
97 
98  // Member Functions
99 
100  // Access
101 
102  label tgtCell() const
103  {
104  return tgtCelli_;
105  }
106  label& tgtCell()
107  {
108  return tgtCelli_;
109  }
110 
111 
112  // Needed by FaceCellWave
113 
114  //- Changed or contains original (invalid) value
115  template<class TrackingData>
116  inline bool valid(TrackingData&) const;
117 
118  //- Check for identical geometrical data (eg, cyclics checking)
119  template<class TrackingData>
120  inline bool sameGeometry
121  (
122  const polyMesh&,
123  const meshToMeshData&,
124  const scalar,
125  TrackingData&
126  ) const;
127 
128  //- Convert absolute coordinates into relative
129  //- to (patch)face centre
130  template<class TrackingData>
131  inline void leaveDomain
132  (
133  const polyMesh&,
134  const polyPatch&,
135  const label patchFacei,
136  const point& faceCentre,
137  TrackingData&
138  );
139 
140  //- Reverse of leaveDomain
141  template<class TrackingData>
142  inline void enterDomain
143  (
144  const polyMesh&,
145  const polyPatch&,
146  const label patchFacei,
147  const point& faceCentre,
148  TrackingData&
149  );
150 
151  //- Apply rotation matrix to any coordinates
152  template<class TrackingData>
153  inline void transform
154  (
155  const polyMesh&,
156  const tensor&,
157  TrackingData&
158  );
159 
160  //- Influence of neighbouring face.
161  template<class TrackingData>
162  inline bool updateCell
163  (
164  const polyMesh&,
165  const label thisCelli,
166  const label neighbourFacei,
167  const meshToMeshData& neighbourInfo,
168  const scalar tol,
169  TrackingData&
170  );
171 
172  //- Influence of neighbouring cell.
173  template<class TrackingData>
174  inline bool updateFace
175  (
176  const polyMesh&,
177  const label thisFacei,
178  const label neighbourCelli,
179  const meshToMeshData& neighbourInfo,
180  const scalar tol,
181  TrackingData&
182  );
183 
184  //- Influence of different value on same face.
185  template<class TrackingData>
186  inline bool updateFace
187  (
188  const polyMesh&,
189  const label thisFacei,
190  const meshToMeshData& neighbourInfo,
191  const scalar tol,
192  TrackingData&
193  );
194 
195  //- Test for equality, with TrackingData
196  template<class TrackingData>
197  inline bool equal
198  (
199  const meshToMeshData&,
200  TrackingData&
201  ) const;
202 
203 
204  // Member Operators
205 
206  //- Test for equality
207  inline bool operator==(const meshToMeshData&) const;
208 
209  //- Test for inequality
210  inline bool operator!=(const meshToMeshData&) const;
211 
212 
213  // IOstream Operators
214 
215  friend Ostream& operator<<(Ostream&, const meshToMeshData&);
216  friend Istream& operator>>(Istream&, meshToMeshData&);
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
221 
222 //- Contiguous data for meshToMeshData
223 template<> struct is_contiguous<meshToMeshData> : std::true_type {};
224 
225 //- Contiguous label data for meshToMeshData
226 template<> struct is_contiguous_label<meshToMeshData> : std::true_type {};
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 } // End namespace Foam
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #include "meshToMeshDataI.H"
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #endif
240 
241 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::meshToMeshData::transform
void transform(const polyMesh &, const tensor &, TrackingData &)
Apply rotation matrix to any coordinates.
Definition: meshToMeshDataI.H:81
point.H
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::meshToMeshData
Transfers refinement levels such that slow transition between levels is maintained....
Definition: meshToMeshData.H:62
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::is_contiguous_label
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:83
meshToMeshDataI.H
Foam::meshToMeshData::tgtCell
label tgtCell() const
Definition: meshToMeshData.H:101
Foam::meshToMeshData::trackData::tgtMesh_
const polyMesh & tgtMesh_
Definition: meshToMeshData.H:79
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::meshToMeshData::trackData::trackData
trackData(const polyMesh &tgtMesh)
Definition: meshToMeshData.H:81
Foam::meshToMeshData::operator<<
friend Ostream & operator<<(Ostream &, const meshToMeshData &)
Foam::meshToMeshData::trackData
Class used to pass non-cell data to the update function.
Definition: meshToMeshData.H:75
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:68
Foam::meshToMeshData::operator!=
bool operator!=(const meshToMeshData &) const
Test for inequality.
Definition: meshToMeshDataI.H:220
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::meshToMeshData::updateFace
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const meshToMeshData &neighbourInfo, const scalar tol, TrackingData &)
Influence of neighbouring cell.
Definition: meshToMeshDataI.H:150
Foam::meshToMeshData::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &)
Definition: meshToMeshDataI.H:69
Foam::Vector< scalar >
Foam::meshToMeshData::valid
bool valid(TrackingData &) const
Changed or contains original (invalid) value.
Definition: meshToMeshDataI.H:47
Foam::meshToMeshData::sameGeometry
bool sameGeometry(const polyMesh &, const meshToMeshData &, const scalar, TrackingData &) const
Check for identical geometrical data (eg, cyclics checking)
Definition: meshToMeshDataI.H:56
Foam::meshToMeshData::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &)
Reverse of leaveDomain.
Definition: meshToMeshDataI.H:92
Foam::meshToMeshData::meshToMeshData
meshToMeshData()
Default construct.
Definition: meshToMeshDataI.H:32
Foam::meshToMeshData::equal
bool equal(const meshToMeshData &, TrackingData &) const
Test for equality, with TrackingData.
Definition: meshToMeshDataI.H:192
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::meshToMeshData::tgtCell
label & tgtCell()
Definition: meshToMeshData.H:105
Foam::tensor
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
Definition: symmTensor.H:61
Foam::meshToMeshData::updateCell
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const meshToMeshData &neighbourInfo, const scalar tol, TrackingData &)
Influence of neighbouring face.
Definition: meshToMeshDataI.H:105
Foam::meshToMeshData::operator==
bool operator==(const meshToMeshData &) const
Test for equality.
Definition: meshToMeshDataI.H:211
Foam::meshToMeshData::operator>>
friend Istream & operator>>(Istream &, meshToMeshData &)
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75