All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-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::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 Field<PointType>&
89  >
90  patch0Type;
91 
92 
93  // Private Data
94 
95  //- Stored old-time points
96  autoPtr<Field<PointType>> points0Ptr_;
97 
98  //- Reference to global list of old-time points
99  const Field<PointType>& points0_;
100 
101  //- Engine for calculating old-time geometry. Note: Methods that
102  // generate topology should not be called here. The base patch should
103  // have all the necessary topology available. The calculation of some
104  // geometric quantities requires topological data to be available. In
105  // these cases, special steps need to be taken here to make sure that
106  // the old-time patch object does not generate duplicate topology.
107  autoPtr<patch0Type> patch0Ptr_;
108 
109  //- Points local to patch
110  mutable Field<PointType>* localPoints0Ptr_;
111 
112 
113 public:
114 
115  // Constructors
116 
117  //- Construct from components
119  (
120  const FaceList& faces,
121  const Field<PointType>& points,
123  );
124 
125  //- Construct from patch and old-time points
127  (
130  );
131 
132  //- Construct from components without old-time points
134  (
135  const FaceList& faces,
136  const Field<PointType>& points
137  );
138 
139  //- Construct from patch without old-time points
141  (
143  );
144 
145  //- Copy constructor
147 
148  //- Move constructor
150 
151  //- Construct and return a clone
153  {
155  (
157  );
158  }
159 
160 
161  //- Destructor
162  virtual ~PrimitiveOldTimePatch();
163 
164 
165  // Member Functions
166 
167  // Access
168 
169  //- Return whether or not old-time geometry is available
170  bool has0() const
171  {
172  return patch0Ptr_.valid();
173  }
174 
175  //- Return reference to old-time global points
176  const Field<PointType>& points0() const
177  {
178  return points0_;
179  }
180 
181 
182  // Geometry
183 
184  //- Return pointField of old-time points in patch
185  const Field<PointType>& localPoints0() const;
186 
187  //- Return old-time face centres for patch
188  const Field<PointType>& faceCentres0() const;
189 
190  //- Return old-time face areas for patch
191  const Field<PointType>& faceAreas0() const;
192 
193  //- Return old-time face normals for patch
194  const Field<PointType>& faceNormals0() const;
195 
196  //- Return old-time point normals for patch
197  const Field<PointType>& pointNormals0() const;
198 
199 
200  // Edit
201 
202  //- ...
203  void clearOut();
204 
205  //- ...
206  void clearGeom();
207 
208  //- Correct patch after moving points
209  virtual void movePoints0(const Field<PointType>&);
210 
211 
212  // Member Operators
213 
214  //- Disallow default bitwise assignment
215  void operator=(const PrimitiveOldTimePatch&) = delete;
216 };
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 } // End namespace Foam
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #ifdef NoRepository
226  #include "PrimitiveOldTimePatch.C"
227 #endif
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #endif
232 
233 // ************************************************************************* //
A List with indirect addressing.
Definition: IndirectList.H:105
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
const Field< PointType > & pointNormals0() const
Return old-time point normals for patch.
void operator=(const PrimitiveOldTimePatch &)=delete
Disallow default bitwise assignment.
const Field< PointType > & faceAreas0() const
Return old-time face areas for patch.
const Field< PointType > & points0() const
Return reference to old-time global points.
autoPtr< PrimitiveOldTimePatch< FaceList, PointField > > clone() const
Construct and return a clone.
virtual void movePoints0(const Field< PointType > &)
Correct patch after moving points.
virtual ~PrimitiveOldTimePatch()
Destructor.
const Field< PointType > & faceCentres0() const
Return old-time face centres for patch.
PrimitiveOldTimePatch(const FaceList &faces, const Field< PointType > &points, const Field< PointType > &points0)
Construct from components.
const Field< PointType > & faceNormals0() const
Return old-time face normals for patch.
bool has0() const
Return whether or not old-time geometry is available.
const Field< PointType > & localPoints0() const
Return pointField of old-time points in patch.
A list of faces which address into the list of points.
std::remove_reference< PointField >::type::value_type PointType
const Field< PointType > & points() const
Return reference to global points.
std::remove_reference< FaceList >::type::value_type FaceType
A List obtained as a section of another List.
Definition: SubList.H:56
A List with indirect addressing.
Definition: UIndirectList.H:60
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:74
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
Definition: autoPtrI.H:83
Namespace for OpenFOAM.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488