processorPointPatch.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-2013 OpenFOAM Foundation
9  Copyright (C) 2022 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::processorPointPatch
29 
30 Description
31  Processor patch boundary needs to be such that the ordering of
32  points in the patch is the same on both sides.
33 
34  Looking at the creation of the faces on both sides of the processor
35  patch they need to be identical on both sides with the normals pointing
36  in opposite directions. This is achieved by calling the reverseFace
37  function in the decomposition. It is therefore possible to re-create
38  the ordering of patch points on the neighbour side by reversing all the
39  patch faces of the owner.
40 
41 SourceFiles
42  processorPointPatch.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef Foam_processorPointPatch_H
47 #define Foam_processorPointPatch_H
48 
49 #include "coupledFacePointPatch.H"
50 #include "processorPolyPatch.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class processorPointPatch Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 :
64 {
65  // Private Data
66 
67  const processorPolyPatch& procPolyPatch_;
68 
69  mutable labelList reverseMeshPoints_;
70 
71 
72  // Private Member Functions
73 
74  //- Initialise the calculation of the patch geometry
75  virtual void initGeometry(PstreamBuffers&);
76 
77  //- Calculate the patch geometry
78  virtual void calcGeometry(PstreamBuffers&);
79 
80  //- Initialise the patches for moving points
81  virtual void initMovePoints(PstreamBuffers&, const pointField&);
82 
83  //- Correct patches after moving points
84  virtual void movePoints(PstreamBuffers&, const pointField&);
85 
86  //- Initialise the update of the patch topology
87  virtual void initUpdateMesh(PstreamBuffers&);
88 
89  //- Update of the patch topology
90  virtual void updateMesh(PstreamBuffers&);
91 
92 
93  //- No copy construct
95 
96  //- No copy assignment
97  void operator=(const processorPointPatch&) = delete;
98 
99 public:
100 
101  //- Runtime type information
102  TypeName(processorPolyPatch::typeName_());
103 
104 
105  // Constructors
106 
107  //- Construct from components
109  (
110  const polyPatch& patch,
111  const pointBoundaryMesh& bm
112  );
113 
114  //- Construct given the original patch and a map
116  (
117  const processorPointPatch& patch,
118  const pointBoundaryMesh& bm,
119  const label index,
120  const labelUList& mapAddressing,
121  const labelUList& reversePointMap
122  );
123 
124  //- Construct and return a subset clone,
125  //- resetting the point list and boundary mesh
126  virtual autoPtr<pointPatch> clone
127  (
128  const pointBoundaryMesh& bm,
129  const label index,
130  const labelUList& mapAddressing,
131  const labelUList& reversePointMap
132  ) const
133  {
135  (
136  *this,
137  bm,
138  index,
139  mapAddressing,
140  reversePointMap
141  );
142  }
143 
144 
145  //- Destructor
146  virtual ~processorPointPatch() = default;
147 
148 
149  // Member Functions
150 
151  //- Return message tag to use for communication
152  virtual int tag() const
153  {
154  return procPolyPatch_.tag();
155  }
156 
157  //- Return communicator used for communication
158  virtual label comm() const
159  {
160  return procPolyPatch_.comm();
161  }
162 
163  //- Return the constraint type this pointPatch implements.
164  virtual const word& constraintType() const
165  {
166  return type();
167  }
168 
169  //- Return processor number
170  int myProcNo() const noexcept
171  {
172  return procPolyPatch_.myProcNo();
173  }
174 
175  //- Return neighbour processor number
176  int neighbProcNo() const noexcept
177  {
178  return procPolyPatch_.neighbProcNo();
179  }
180 
181  //- Does the processor own the patch ?
182  bool owner() const
183  {
184  return procPolyPatch_.owner();
185  }
186 
187  //- Is the processor the patch neighbour ?
188  bool neighbour() const
189  {
190  return !owner();
191  }
192 
193  //- Return the underlying processorPolyPatch
195  {
196  return procPolyPatch_;
197  }
198 
199  //- Return mesh points in the correct order for the receiving side
200  const labelList& reverseMeshPoints() const noexcept
201  {
202  return reverseMeshPoints_;
203  }
204 };
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #endif
214 
215 // ************************************************************************* //
A pointBoundaryMesh is a pointPatch list with registered IO, a reference to the associated pointMesh...
virtual label comm() const
Return communicator used for communication.
virtual ~processorPointPatch()=default
Destructor.
coupled patch for post-processing. Used as the base class for processor and cyclic pointPatches ...
const processorPolyPatch & procPolyPatch() const noexcept
Return the underlying processorPolyPatch.
int neighbProcNo() const noexcept
Return neighbour processor number.
virtual const polyPatch & patch() const
Return the polyPatch.
Processor patch boundary needs to be such that the ordering of points in the patch is the same on bot...
virtual label index() const
Return the index of this patch in the pointBoundaryMesh.
virtual int tag() const
Return message tag to use for communication.
Neighbour processor patch.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:805
virtual label comm() const
Return communicator used for communication.
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.
const labelList & reverseMeshPoints() const noexcept
Return mesh points in the correct order for the receiving side.
virtual int tag() const
Return message tag to use for communication.
int myProcNo() const noexcept
Return processor number.
const direction noexcept
Definition: scalarImpl.H:265
virtual const word & constraintType() const
Return the constraint type this pointPatch implements.
bool owner() const
Does the processor own the patch ?
bool neighbour() const
Is the processor the patch neighbour ?
Buffers for inter-processor communications streams (UOPstream, UIPstream).
int neighbProcNo() const noexcept
Return neighbour processor number.
TypeName(processorPolyPatch::typeName_())
Runtime type information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
int myProcNo() const noexcept
Return processor number.
Namespace for OpenFOAM.
virtual bool owner() const
Does the processor own the patch ?