Loading...
Searching...
No Matches
pointPatch.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) 2011-2012 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::pointPatch
29
30Description
31 Basic pointPatch represents a set of points from the mesh.
32
33SourceFiles
34 pointPatch.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_pointPatch_H
39#define Foam_pointPatch_H
40
41#include "patchIdentifier.H"
42#include "labelList.H"
43#include "vectorField.H"
44#include "pointField.H"
45#include "PtrList.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52// Forward Declarations
54class pointConstraint;
55class pointPatch;
56class PstreamBuffers;
57
59
60//- Store lists of pointPatch as a PtrList
62
63/*---------------------------------------------------------------------------*\
64 Class pointPatch Declaration
65\*---------------------------------------------------------------------------*/
66
67class pointPatch
68:
69 public patchIdentifier
70{
71 // Private Data
72
73 //- Reference to boundary mesh
74 const pointBoundaryMesh& boundaryMesh_;
75
76
77protected:
78
79 // Protected Member Functions
80
81 // The geometry initialisation is called by pointBoundaryMesh
82 friend class pointBoundaryMesh;
83
84 //- Initialise the calculation of the patch geometry
85 virtual void initGeometry(PstreamBuffers&)
86 {}
87
88 //- Calculate the patch geometry
89 virtual void calcGeometry(PstreamBuffers&)
90 {}
91
92 //- Initialise the patches for moving points
93 virtual void initMovePoints(PstreamBuffers&, const pointField&)
94 {}
95
96 //- Correct patches after moving points
97 virtual void movePoints(PstreamBuffers&, const pointField&)
98 {}
99
100 //- Initialise the update of the patch topology
101 virtual void initUpdateMesh(PstreamBuffers&)
102 {}
103
104 //- Update of the patch topology
105 virtual void updateMesh(PstreamBuffers&)
106 {}
107
108
109 //- No copy construct
110 pointPatch(const pointPatch&) = delete;
111
112 //- No copy assignment
113 void operator=(const pointPatch&) = delete;
114
115
116public:
117
118 //- Runtime type information
119 TypeName("basePatch");
120
121
122 // Declare run-time constructor selection tables
125 (
126 autoPtr,
129 (
130 const word& name,
131 const dictionary& dict,
132 const label index,
133 const pointBoundaryMesh& bm,
134 const word& patchType
135 ),
136 (name, dict, index, bm, patchType)
137 );
138
139
140 // Constructor
142 //- Construct from components
143 explicit pointPatch
144 (
145 const word& name,
146 const label index,
147 const pointBoundaryMesh& bm,
148 const word& physicalType,
149 const wordList& inGroups
150 )
151 :
153 boundaryMesh_(bm)
154 {}
155
156 //- Construct from dictionary
157 explicit pointPatch
158 (
159 const word& name,
160 const dictionary& dict,
161 const label index,
163 )
164 :
166 boundaryMesh_(bm)
167 {}
168
169 //- Construct given the original patch and a map
170 explicit pointPatch
171 (
172 const pointPatch& pp,
173 const pointBoundaryMesh& bm,
174 const label index,
175 const labelUList& mapAddressing,
176 const labelUList& reversePointMap
177 )
180 boundaryMesh_(bm)
181 {}
182
183 //- Construct and return a subset clone,
184 //- resetting the point list and boundary mesh
186 (
187 const pointBoundaryMesh& bm,
188 const label index,
189 const labelUList& mapAddressing,
190 const labelUList& reversePointMap
191 ) const = 0;
192
194 // Selectors
195
196 //- Return a pointer to a new patch created on freestore. Returns
197 //- null if not found
199 (
200 const word& name,
201 const dictionary& dict,
202 const label index,
203 const pointBoundaryMesh&
204 );
205
206
207 //- Destructor
208 virtual ~pointPatch() = default;
209
211 // Member Functions
212
213 //- Return size
214 virtual label size() const = 0;
215
216 //- Return boundaryMesh reference
217 const pointBoundaryMesh& boundaryMesh() const
218 {
219 return boundaryMesh_;
220 }
221
222 //- Return true if this patch field is coupled
223 virtual bool coupled() const
224 {
225 return false;
226 }
227
228 //- Return mesh points
229 virtual const labelList& meshPoints() const = 0;
230
231 //- Return pointField of points in patch
232 virtual const vectorField& localPoints() const = 0;
233
234 //- Return point unit normals
235 virtual const vectorField& pointNormals() const = 0;
236
237 //- Return the constraint type this pointPatch implements.
238 virtual const word& constraintType() const
239 {
240 return word::null;
241 }
242
243 //- Accumulate the effect of constraint direction of this patch
244 virtual void applyConstraint
246 const label pointi,
248 ) const
249 {}
251 //- Write the pointPatch data as a dictionary
252 virtual void write(Ostream&) const;
253
254
255 // Ostream Operator
256
257 friend Ostream& operator<<(Ostream&, const pointPatch&);
259
260
261// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262
263} // End namespace Foam
264
265// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267#endif
268
269// ************************************************************************* //
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Buffers for inter-processor communications streams (UOPstream, UIPstream).
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const word & physicalType() const noexcept
The (optional) physical type of the patch.
const wordList & inGroups() const noexcept
The (optional) groups that the patch belongs to.
label index() const noexcept
The index of this patch in the boundaryMesh.
const word & name() const noexcept
The patch name.
patchIdentifier(const patchIdentifier &)=default
Copy construct.
A pointBoundaryMesh is a pointPatch list with registered IO, a reference to the associated pointMesh,...
Accumulates point constraints through successive applications of the applyConstraint function.
Basic pointPatch represents a set of points from the mesh.
Definition pointPatch.H:67
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
Definition pointPatch.H:104
virtual void applyConstraint(const label pointi, pointConstraint &) const
Accumulate the effect of constraint direction of this patch.
Definition pointPatch.H:290
virtual const labelList & meshPoints() const =0
Return mesh points.
pointPatch(const word &name, const dictionary &dict, const label index, const pointBoundaryMesh &bm)
Construct from dictionary.
Definition pointPatch.H:179
friend Ostream & operator<<(Ostream &, const pointPatch &)
virtual bool coupled() const
Return true if this patch field is coupled.
Definition pointPatch.H:258
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
Definition pointPatch.H:86
virtual autoPtr< pointPatch > clone(const pointBoundaryMesh &bm, const label index, const labelUList &mapAddressing, const labelUList &reversePointMap) const =0
Construct and return a subset clone, resetting the point list and boundary mesh.
virtual const word & constraintType() const
Return the constraint type this pointPatch implements.
Definition pointPatch.H:281
virtual const vectorField & localPoints() const =0
Return pointField of points in patch.
pointPatch(const word &name, const label index, const pointBoundaryMesh &bm, const word &physicalType, const wordList &inGroups)
Construct from components.
Definition pointPatch.H:163
declareRunTimeSelectionTable(autoPtr, pointPatch, dictionary,(const word &name, const dictionary &dict, const label index, const pointBoundaryMesh &bm, const word &patchType),(name, dict, index, bm, patchType))
const pointBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition pointPatch.H:250
friend class pointBoundaryMesh
Definition pointPatch.H:81
TypeName("basePatch")
Runtime type information.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
Definition pointPatch.H:110
virtual ~pointPatch()=default
Destructor.
virtual label size() const =0
Return size.
pointPatch(const pointPatch &)=delete
No copy construct.
pointPatch(const pointPatch &pp, const pointBoundaryMesh &bm, const label index, const labelUList &mapAddressing, const labelUList &reversePointMap)
Construct given the original patch and a map.
Definition pointPatch.H:194
void operator=(const pointPatch &)=delete
No copy assignment.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
Definition pointPatch.H:92
static autoPtr< pointPatch > New(const word &name, const dictionary &dict, const label index, const pointBoundaryMesh &)
Return a pointer to a new patch created on freestore. Returns null if not found.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
Definition pointPatch.H:116
virtual void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
Definition pointPatch.H:98
virtual const vectorField & pointNormals() const =0
Return point unit normals.
A class for handling words, derived from Foam::string.
Definition word.H:66
static const word null
An empty word.
Definition word.H:84
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
List< label > labelList
A List of labels.
Definition List.H:62
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
PtrList< pointPatch > pointPatchList
Store lists of pointPatch as a PtrList.
Definition pointPatch.H:58
Field< vector > vectorField
Specialisation of Field<T> for vector.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
Definition UList.H:75
runTime write()
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68