PrimitiveOldTimePatch.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) 2022 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::PrimitiveOldTimePatch
26 
27 Description
28 
29 SourceFiles
30  PrimitiveOldTimePatch.C
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef PrimitiveOldTimePatch_H
35 #define PrimitiveOldTimePatch_H
36 
37 #include "PrimitivePatch.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
44 // Trait to determine what face list should be used for the old-time patch
45 template<class Container>
46 struct UFaceList;
47 template<class Face>
48 struct UFaceList<UList<Face>> { typedef UList<Face> type; };
49 template<class Face>
50 struct UFaceList<List<Face>> : public UFaceList<UList<Face>> {};
51 template<class Face>
52 struct UFaceList<SubList<Face>> : public UFaceList<UList<Face>> {};
53 template<class Face>
54 struct UFaceList<UIndirectList<Face>> { typedef UIndirectList<Face> type; };
55 template<class Face>
56 struct UFaceList<IndirectList<Face>> : public UFaceList<UIndirectList<Face>> {};
57 
58 /*---------------------------------------------------------------------------*\
59  Class PrimitiveOldTimePatch Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class FaceList, class PointField>
64 :
65  public PrimitivePatch<FaceList, PointField>
66 {
67 public:
68 
69  // Public Typedefs
70 
72 
74 
76 
78 
79 
80 private:
81 
82  // Private Typedefs
83 
84  typedef
86  <
88  const PointFieldType&
89  >
90  patch0Type;
91 
92 
93  // Private Data
94 
95  //- Reference to global list of old-time points
96  PointField points0_;
97 
98  //- Engine for calculating old-time geometry. Note: Methods that
99  // generate topology should not be called here. The base patch should
100  // have all the necessary topology available. The calculation of some
101  // geometric quantities requires topological data to be available. In
102  // these cases, special steps need to be taken here to make sure that
103  // the old-time patch object does not generate duplicate topology.
104  autoPtr<patch0Type> patch0Ptr_;
105 
106  //- Points local to patch
107  mutable Field<PointType>* localPoints0Ptr_;
108 
109 
110 public:
111 
112  // Constructors
113 
114  //- Construct from components
116  (
117  const FaceList& faces,
118  const Field<PointType>& points,
119  const Field<PointType>& points0
120  );
121 
122  //- Construct from patch and old-time points
124  (
126  const Field<PointType>& points0
127  );
128 
129  //- Construct from components without old-time points
131  (
132  const FaceList& faces,
133  const Field<PointType>& points
134  );
135 
136  //- Construct from patch without old-time points
138  (
140  );
141 
142  //- Copy constructor
144 
145  //- Move constructor
147 
148  //- Construct and return a clone
150  {
152  (
154  );
155  }
156 
157 
158  //- Destructor
159  virtual ~PrimitiveOldTimePatch();
160 
161 
162  // Member Functions
163 
164  // Access
165 
166  //- Return whether or not old-time geometry is available
167  bool has0() const
168  {
169  return patch0Ptr_.valid();
170  }
171 
172  //- Return reference to old-time global points
173  const Field<PointType>& points0() const
174  {
175  return points0_;
176  }
177 
178 
179  // Geometry
180 
181  //- Return pointField of old-time points in patch
182  const Field<PointType>& localPoints0() const;
183 
184  //- Return old-time face centres for patch
185  const Field<PointType>& faceCentres0() const;
186 
187  //- Return old-time face areas for patch
188  const Field<PointType>& faceAreas0() const;
189 
190  //- Return old-time face normals for patch
191  const Field<PointType>& faceNormals0() const;
192 
193  //- Return old-time point normals for patch
194  const Field<PointType>& pointNormals0() const;
195 
196 
197  // Edit
198 
199  //- ...
200  void clearOut();
201 
202  //- ...
203  void clearGeom();
204 
205  //- Correct patch after moving points
206  virtual void movePoints0(const Field<PointType>&);
207 
208 
209  // Member Operators
210 
211  //- Disallow default bitwise assignment
212  void operator=(const PrimitiveOldTimePatch&) = delete;
213 };
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace Foam
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #ifdef NoRepository
223  #include "PrimitiveOldTimePatch.C"
224 #endif
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
A list of faces which address into the list of points.
A List obtained as a section of another List.
Definition: SubList.H:53
T clone(const T &t)
Definition: List.H:54
const pointField & points
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
Definition: autoPtrI.H:83
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
std::remove_reference< FaceList >::type::value_type FaceType
A List with indirect addressing.
Definition: fvMatrix.H:106
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
std::remove_reference< PointField >::type::value_type PointType
A List with indirect addressing.
Definition: IndirectList.H:101
Namespace for OpenFOAM.