mappedPolyPatch.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) 2011-2018 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::mappedPolyPatch
26 
27 Description
28  Determines a mapping between patch face centres and mesh cell or face
29  centres and processors they're on.
30 
31 Note
32  Storage is not optimal. It stores all face centres and cells on all
33  processors to keep the addressing calculation simple.
34 
35 SourceFiles
36  mappedPolyPatch.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef mappedPolyPatch_H
41 #define mappedPolyPatch_H
42 
43 #include "polyPatch.H"
44 #include "mappedPatchBase.H"
45 
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 class polyMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class mappedPolyPatch Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class mappedPolyPatch
59 :
60  public polyPatch,
61  public mappedPatchBase
62 {
63 
64 protected:
65 
66  //- Initialise the calculation of the patch geometry
67  virtual void initGeometry(PstreamBuffers&);
68 
69  //- Calculate the patch geometry
70  virtual void calcGeometry(PstreamBuffers&);
71 
72  //- Initialise the patches for moving points
73  virtual void initMovePoints(PstreamBuffers&, const pointField&);
74 
75  //- Correct patches after moving points
76  virtual void movePoints(PstreamBuffers&, const pointField&);
77 
78  //- Initialise the update of the patch topology
79  virtual void initUpdateMesh(PstreamBuffers&);
80 
81  //- Update of the patch topology
82  virtual void updateMesh(PstreamBuffers&);
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("mappedPatch");
89 
90 
91  // Constructors
92 
93  //- Construct from components
95  (
96  const word& name,
97  const label size,
98  const label start,
99  const label index,
100  const polyBoundaryMesh& bm,
101  const word& patchType
102  );
103 
104  //- Construct from components
106  (
107  const word& name,
108  const label size,
109  const label start,
110  const label index,
111  const word& sampleRegion,
112  const mappedPatchBase::sampleMode mode,
113  const word& samplePatch,
114  const vectorField& offset,
115  const polyBoundaryMesh& bm
116  );
117 
118  //- Construct from components. Uniform offset.
120  (
121  const word& name,
122  const label size,
123  const label start,
124  const label index,
125  const word& sampleRegion,
126  const mappedPatchBase::sampleMode mode,
127  const word& samplePatch,
128  const vector& offset,
129  const polyBoundaryMesh& bm
130  );
131 
132  //- Construct from dictionary
134  (
135  const word& name,
136  const dictionary& dict,
137  const label index,
138  const polyBoundaryMesh& bm,
139  const word& patchType
140  );
141 
142  //- Construct as copy, resetting the boundary mesh
144  (
145  const mappedPolyPatch&,
146  const polyBoundaryMesh&
147  );
148 
149  //- Construct given the original patch and resetting the
150  // face list and boundary mesh information
152  (
153  const mappedPolyPatch& pp,
154  const polyBoundaryMesh& bm,
155  const label index,
156  const label newSize,
157  const label newStart
158  );
159 
160  //- Construct given the original patch and a map
162  (
163  const mappedPolyPatch& pp,
164  const polyBoundaryMesh& bm,
165  const label index,
166  const labelUList& mapAddressing,
167  const label newStart
168  );
169 
170  //- Construct and return a clone, resetting the boundary mesh
171  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
172  {
173  return autoPtr<polyPatch>(new mappedPolyPatch(*this, bm));
174  }
175 
176  //- Construct and return a clone, resetting the face list
177  // and boundary mesh
179  (
180  const polyBoundaryMesh& bm,
181  const label index,
182  const label newSize,
183  const label newStart
184  ) const
185  {
186  return autoPtr<polyPatch>
187  (
188  new mappedPolyPatch(*this, bm, index, newSize, newStart)
189  );
190  }
191 
192  //- Construct and return a clone, resetting the face list
193  // and boundary mesh
195  (
196  const polyBoundaryMesh& bm,
197  const label index,
198  const labelUList& mapAddressing,
199  const label newStart
200  ) const
201  {
202  return autoPtr<polyPatch>
203  (
204  new mappedPolyPatch
205  (
206  *this,
207  bm,
208  index,
209  mapAddressing,
210  newStart
211  )
212  );
213  }
214 
215 
216  //- Destructor
217  virtual ~mappedPolyPatch();
218 
219 
220  // Member functions
221 
222  //- Write the polyPatch data as a dictionary
223  virtual void write(Ostream&) const;
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #endif
234 
235 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Determines a mapping between patch face centres and mesh cell or face centres and processors they&#39;re ...
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
mappedPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from components.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
virtual void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
TypeName("mappedPatch")
Runtime type information.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
A class for handling words, derived from string.
Definition: word.H:59
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
Determines a mapping between patch face centres and mesh cell or face centres and processors they&#39;re ...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:61
Foam::polyBoundaryMesh.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Buffers for inter-processor communications streams (UOPstream, UIPstream).
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
sampleMode
Mesh items to sample.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
virtual ~mappedPolyPatch()
Destructor.
Namespace for OpenFOAM.