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 -------------------------------------------------------------------------------
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::pointPatch
29 
30 Description
31  Basic pointPatch represents a set of points from the mesh.
32 
33 SourceFiles
34  pointPatch.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_pointPatch_H
39 #define Foam_pointPatch_H
40 
41 #include "labelList.H"
42 #include "vectorField.H"
43 #include "pointField.H"
44 #include "PtrList.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward Declarations
52 class pointBoundaryMesh;
53 class pointConstraint;
54 class pointPatch;
55 class PstreamBuffers;
56 
57 //- Store lists of pointPatch as a PtrList
59 
60 /*---------------------------------------------------------------------------*\
61  Class pointPatch Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class pointPatch
65 {
66  // Private Data
67 
68  //- Reference to boundary mesh
69  const pointBoundaryMesh& boundaryMesh_;
70 
71 
72 protected:
73 
74  // Protected Member Functions
75 
76  // The geometry initialisation is called by pointBoundaryMesh
77  friend class pointBoundaryMesh;
78 
79  //- Initialise the calculation of the patch geometry
80  virtual void initGeometry(PstreamBuffers&)
81  {}
82 
83  //- Calculate the patch geometry
84  virtual void calcGeometry(PstreamBuffers&)
85  {}
86 
87  //- Initialise the patches for moving points
88  virtual void initMovePoints(PstreamBuffers&, const pointField&)
89  {}
90 
91  //- Correct patches after moving points
92  virtual void movePoints(PstreamBuffers&, const pointField&)
93  {}
94 
95  //- Initialise the update of the patch topology
96  virtual void initUpdateMesh(PstreamBuffers&)
97  {}
98 
99  //- Update of the patch topology
100  virtual void updateMesh(PstreamBuffers&)
101  {}
102 
103 
104  //- No copy construct
105  pointPatch(const pointPatch&) = delete;
106 
107  //- No copy assignment
108  void operator=(const pointPatch&) = delete;
109 
110 
111 public:
112 
113  //- Runtime type information
114  TypeName("basePatch");
115 
116 
117  // Constructor
118 
119  //- Construct from boundary mesh
120  explicit pointPatch(const pointBoundaryMesh& bm)
121  :
122  boundaryMesh_(bm)
123  {}
124 
125 
126  //- Destructor
127  virtual ~pointPatch() = default;
128 
129 
130  // Member Functions
131 
132  //- Return name
133  virtual const word& name() const = 0;
134 
135  //- Return size
136  virtual label size() const = 0;
137 
138  //- Return the index of this patch in the pointBoundaryMesh
139  virtual label index() const = 0;
140 
141  //- Return boundaryMesh reference
142  const pointBoundaryMesh& boundaryMesh() const
143  {
144  return boundaryMesh_;
145  }
146 
147  //- Return true if this patch field is coupled
148  virtual bool coupled() const
149  {
150  return false;
151  }
152 
153  //- Return mesh points
154  virtual const labelList& meshPoints() const = 0;
155 
156  //- Return pointField of points in patch
157  virtual const vectorField& localPoints() const = 0;
158 
159  //- Return point unit normals
160  virtual const vectorField& pointNormals() const = 0;
161 
162  //- Return the constraint type this pointPatch implements.
163  virtual const word& constraintType() const
164  {
165  return word::null;
166  }
167 
168  //- Accumulate the effect of constraint direction of this patch
169  virtual void applyConstraint
170  (
171  const label pointi,
173  ) const
174  {}
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
PtrList< pointPatch > pointPatchList
Store lists of pointPatch as a PtrList.
Definition: pointPatch.H:50
pointPatch(const pointPatch &)=delete
No copy construct.
Foam::pointBoundaryMesh.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
Definition: pointPatch.H:111
virtual bool coupled() const
Return true if this patch field is coupled.
Definition: pointPatch.H:179
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
Definition: pointPatch.H:87
virtual void applyConstraint(const label pointi, pointConstraint &) const
Accumulate the effect of constraint direction of this patch.
Definition: pointPatch.H:211
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
Definition: pointPatch.H:105
A class for handling words, derived from Foam::string.
Definition: word.H:63
static const word null
An empty word.
Definition: word.H:84
virtual const word & name() const =0
Return name.
Accumulates point constraints through successive applications of the applyConstraint function...
virtual void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
Definition: pointPatch.H:93
virtual const word & constraintType() const
Return the constraint type this pointPatch implements.
Definition: pointPatch.H:202
TypeName("basePatch")
Runtime type information.
void operator=(const pointPatch &)=delete
No copy assignment.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
virtual const vectorField & pointNormals() const =0
Return point unit normals.
const pointBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: pointPatch.H:171
virtual const vectorField & localPoints() const =0
Return pointField of points in patch.
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
Definition: pointPatch.H:81
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:61
virtual label index() const =0
Return the index of this patch in the pointBoundaryMesh.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
virtual ~pointPatch()=default
Destructor.
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< label > labelList
A List of labels.
Definition: List.H:62
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
Definition: pointPatch.H:99
Namespace for OpenFOAM.
virtual const labelList & meshPoints() const =0
Return mesh points.
virtual label size() const =0
Return size.