meshPointPatch.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) 2016 OpenFOAM Foundation
9  Copyright (C) 2024 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::meshPointPatch
29 
30 Description
31  pointPatch with explicitly provided points instead of using the points
32  of a polyPatch.
33 
34  Note: does not constrain displacement - is not a constraint patch.
35 
36 SourceFiles
37  meshPointPatch.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef meshPointPatch_H
42 #define meshPointPatch_H
43 
44 #include "pointPatch.H"
45 #include "polyPatch.H"
46 #include "autoPtr.H"
47 #include "patchIdentifier.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class meshPointPatch Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class meshPointPatch
59 :
60  public pointPatch
61 {
62 private:
63 
64  // Private Member Functions
65 
66  //- No copy construct
67  meshPointPatch(const meshPointPatch&) = delete;
68 
69  //- No copy assignment
70  void operator=(const meshPointPatch&) = delete;
71 
72 
73 protected:
74 
75  // Protected Member Data
76 
77  //- Explicit mesh points
78  const labelList meshPoints_;
79 
81 
82  //- Demand-driven local points
84 
85  //- Demand-driven local normals (assumes constructed with pointNormals
86  // or normal-only-constraint)
88 
89 
90  // Protected Member Functions
91 
92  //- Correct patches after moving points
93  virtual void movePoints(PstreamBuffers&, const pointField&);
94 
95  //- Update of the patch topology
96  virtual void updateMesh(PstreamBuffers&);
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("meshPoint");
103 
104 
105  // Constructors
106 
107  //- Construct from components
109  (
110  const word& name,
111  const labelUList& meshPoints,
113  const label index,
114  const pointBoundaryMesh& bm,
115  const word& patchType
116  );
117 
118  //- Construct from single-constraint (i.e. slip, provided normals)
120  (
121  const word& name,
122  const labelUList& meshPoints,
123  const vectorField& pointNormals,
124  const label index,
125  const pointBoundaryMesh& bm,
126  const word& patchType
127  );
128 
129  //- Construct from dictionary
131  (
132  const word& name,
133  const dictionary& dict,
134  const label index,
135  const pointBoundaryMesh& bm,
136  const word& patchType
137  );
138 
139  //- Construct given the original patch and a map
141  (
142  const meshPointPatch& pp,
143  const pointBoundaryMesh& bm,
144  const label index,
145  const labelUList& mapAddressing,
146  const labelUList& reversePointMap
147  );
148 
149  //- Construct and return a subset clone,
150  //- resetting the point list and boundary mesh
151  virtual autoPtr<pointPatch> clone
152  (
153  const pointBoundaryMesh& bm,
154  const label index,
155  const labelUList& mapAddressing,
156  const labelUList& reversePointMap
157  ) const
158  {
160  (
161  *this,
162  bm,
163  index,
164  mapAddressing,
165  reversePointMap
166  );
167  }
168 
169 
170  //- Destructor
171  virtual ~meshPointPatch() = default;
172 
173 
174  // Member Functions
175 
176  //- Return size
177  virtual label size() const
178  {
179  return meshPoints().size();
180  }
181 
182  //- Return mesh points
183  virtual const labelList& meshPoints() const
184  {
185  return meshPoints_;
186  }
187 
188  //- Return constraints
189  virtual const List<pointConstraint>& constraints() const
190  {
191  return constraints_;
192  }
193 
194  //- Return pointField of points in patch
195  virtual const pointField& localPoints() const;
196 
197  //- Return point unit normals. Assumes single constraint
198  virtual const vectorField& pointNormals() const;
199 
200  //- Write the pointPatch data as a dictionary
201  virtual void write(Ostream&) const;
202 };
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
virtual ~meshPointPatch()=default
Destructor.
dictionary dict
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:119
pointPatch with explicitly provided points instead of using the points of a polyPatch.
A pointBoundaryMesh is a pointPatch list with registered IO, a reference to the associated pointMesh...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
virtual const labelList & meshPoints() const
Return mesh points.
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
virtual label size() const
Return size.
TypeName("meshPoint")
Runtime type information.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:38
virtual const pointField & localPoints() const
Return pointField of points in patch.
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual autoPtr< pointPatch > clone(const pointBoundaryMesh &bm, const label index, const labelUList &mapAddressing, const labelUList &reversePointMap) const
Construct and return a subset clone, resetting the point list and boundary mesh.
virtual const vectorField & pointNormals() const
Return point unit normals. Assumes single constraint.
virtual const List< pointConstraint > & constraints() const
Return constraints.
const word & name() const noexcept
The patch name.
virtual void write(Ostream &) const
Write the pointPatch data as a dictionary.
autoPtr< pointField > pointNormalsPtr_
Demand-driven local normals (assumes constructed with pointNormals.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:64
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
const labelList meshPoints_
Explicit mesh points.
Field< vector > vectorField
Specialisation of Field<T> for vector.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
label index() const noexcept
The index of this patch in the boundaryMesh.
autoPtr< pointField > localPointsPtr_
Demand-driven local points.
const List< pointConstraint > constraints_
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Namespace for OpenFOAM.