1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
25 Foam::processorCyclicPolyPatch
28 Neighbour processor patch.
30 Note: morph patch face ordering is geometric.
33 processorCyclicPolyPatch.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef processorCyclicPolyPatch_H
38 #define processorCyclicPolyPatch_H
40 #include "processorPolyPatch.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class processorCyclicPolyPatch Declaration
49 \*---------------------------------------------------------------------------*/
51 class processorCyclicPolyPatch
53 public processorPolyPatch
57 //- Message tag to use for communication
60 //- Name of originating patch
61 const word referPatchName_;
63 //- Index of originating patch
64 mutable label referPatchID_;
66 // Private member functions
71 // Protected Member functions
73 //- Initialise the calculation of the patch geometry
74 void initGeometry(PstreamBuffers&);
76 //- Calculate the patch geometry
77 void calcGeometry(PstreamBuffers&);
79 //- Calculate the patch geometry with externally
81 virtual void calcGeometry
83 const primitivePatch& referPatch,
84 const pointField& thisCtrs,
85 const vectorField& thisAreas,
86 const pointField& thisCc,
87 const pointField& nbrCtrs,
88 const vectorField& nbrAreas,
89 const pointField& nbrCc
92 notImplemented("processorCyclicPolyPatch::calcGeometry(..)");
95 //- Initialise the patches for moving points
96 void initMovePoints(PstreamBuffers&, const pointField&);
98 //- Correct patches after moving points
99 void movePoints(PstreamBuffers&, const pointField&);
101 //- Initialise the update of the patch topology
102 virtual void initUpdateMesh(PstreamBuffers&);
104 //- Update of the patch topology
105 virtual void updateMesh(PstreamBuffers&);
110 //- Runtime type information
111 TypeName("processorCyclic");
116 //- Construct from components
117 processorCyclicPolyPatch
123 const polyBoundaryMesh& bm,
125 const int neighbProcNo,
126 const word& referPatchName
129 //- Construct from dictionary
130 processorCyclicPolyPatch
133 const dictionary& dict,
135 const polyBoundaryMesh&
138 //- Construct as copy, resetting the boundary mesh
139 processorCyclicPolyPatch
141 const processorCyclicPolyPatch&,
142 const polyBoundaryMesh&
145 //- Construct as given the original patch and resetting the
146 // face list and boundary mesh information
147 processorCyclicPolyPatch
149 const processorCyclicPolyPatch& pp,
150 const polyBoundaryMesh& bm,
153 const label newStart,
154 const word& referPatchName
157 //- Construct given the original patch and a map
158 processorCyclicPolyPatch
160 const processorCyclicPolyPatch& pp,
161 const polyBoundaryMesh& bm,
163 const labelUList& mapAddressing,
168 //- Construct and return a clone, resetting the boundary mesh
169 virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
171 return autoPtr<polyPatch>(new processorCyclicPolyPatch(*this, bm));
174 //- Construct and return a clone, resetting the face list
176 virtual autoPtr<polyPatch> clone
178 const polyBoundaryMesh& bm,
181 const label newStart,
182 const word& referPatchName
185 return autoPtr<polyPatch>
187 new processorCyclicPolyPatch
199 //- Construct and return a clone, resetting the face list
201 virtual autoPtr<polyPatch> clone
203 const polyBoundaryMesh& bm,
205 const labelUList& mapAddressing,
209 return autoPtr<polyPatch>
211 new processorCyclicPolyPatch
225 virtual ~processorCyclicPolyPatch();
230 const word& referPatchName() const
232 return referPatchName_;
235 //- Referring patchID.
236 label referPatchID() const
238 if (referPatchID_ == -1)
240 referPatchID_ = this->boundaryMesh().findPatchID
244 if (referPatchID_ == -1)
248 "processorCyclicPolyPatch::referPatchID() const"
249 ) << "Illegal referPatch name " << referPatchName_
250 << endl << "Valid patch names are "
251 << this->boundaryMesh().names()
255 return referPatchID_;
258 const coupledPolyPatch& referPatch() const
260 const polyPatch& pp = this->boundaryMesh()[referPatchID()];
261 return refCast<const coupledPolyPatch>(pp);
264 //- Return message tag to use for communication
265 virtual int tag() const
270 //- Does this side own the patch ?
271 virtual bool owner() const
273 return referPatch().owner();
276 //- Transform a patch-based position from other side to this side
277 virtual void transformPosition(pointField& l) const
279 referPatch().transformPosition(l);
282 //- Transform a patch-based position from other side to this side
283 virtual void transformPosition(point& l, const label facei) const
285 referPatch().transformPosition(l, facei);
288 //- Are the planes separated.
289 virtual bool separated() const
291 return referPatch().separated();
294 //- If the planes are separated the separation vector.
295 virtual const vectorField& separation() const
297 return referPatch().separation();
300 //- Are the cyclic planes parallel.
301 virtual bool parallel() const
303 return referPatch().parallel();
306 //- Return face transformation tensor.
307 virtual const tensorField& forwardT() const
309 return referPatch().forwardT();
312 //- Return neighbour-cell transformation tensor.
313 virtual const tensorField& reverseT() const
315 return referPatch().reverseT();
318 //- Are faces collocated. Either size 0,1 or length of patch
319 virtual const boolList& collocated() const
321 return referPatch().collocated();
325 //- Initialize ordering for primitivePatch. Does not
326 // refer to *this (except for name() and type() etc.)
327 virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;
329 //- Return new ordering for primitivePatch.
330 // Ordering is -faceMap: for every face
331 // index of the new face -rotation:for every new face the clockwise
332 // shift of the original face. Return false if nothing changes
333 // (faceMap is identity, rotation is 0), true otherwise.
337 const primitivePatch&,
343 //- Write the polyPatch data as a dictionary
344 virtual void write(Ostream&) const;
348 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
350 } // End namespace Foam
352 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
356 // ************************************************************************* //