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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "processorCyclicPolyPatch.H"
27 #include "addToRunTimeSelectionTable.H"
29 #include "cyclicPolyPatch.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(processorCyclicPolyPatch, 0);
36 addToRunTimeSelectionTable(polyPatch, processorCyclicPolyPatch, dictionary);
40 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
51 const polyBoundaryMesh& bm,
53 const int neighbProcNo,
54 const word& referPatchName
57 processorPolyPatch(name, size, start, index, bm, myProcNo, neighbProcNo),
60 Pstream::nProcs()*max(myProcNo, neighbProcNo)
61 + min(myProcNo, neighbProcNo)
63 referPatchName_(referPatchName),
68 Pout<< "processorCyclicPolyPatch " << name << " uses tag " << tag_
74 Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
77 const dictionary& dict,
79 const polyBoundaryMesh& bm
82 processorPolyPatch(name, dict, index, bm),
85 Pstream::nProcs()*max(myProcNo(), neighbProcNo())
86 + min(myProcNo(), neighbProcNo())
88 referPatchName_(dict.lookup("referPatch")),
93 Pout<< "processorCyclicPolyPatch " << name << " uses tag " << tag_
99 Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
101 const processorCyclicPolyPatch& pp,
102 const polyBoundaryMesh& bm
105 processorPolyPatch(pp, bm),
107 referPatchName_(pp.referPatchName()),
112 Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
114 const processorCyclicPolyPatch& pp,
115 const polyBoundaryMesh& bm,
118 const label newStart,
119 const word& referPatchName
122 processorPolyPatch(pp, bm, index, newSize, newStart),
124 referPatchName_(referPatchName),
129 Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
131 const processorCyclicPolyPatch& pp,
132 const polyBoundaryMesh& bm,
134 const labelUList& mapAddressing,
138 processorPolyPatch(pp, bm, index, mapAddressing, newStart),
140 referPatchName_(pp.referPatchName()),
145 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
147 Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
151 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
154 void Foam::processorCyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
156 // Send over processorPolyPatch data
157 processorPolyPatch::initGeometry(pBufs);
161 void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
163 // Receive and initialise processorPolyPatch data
164 processorPolyPatch::calcGeometry(pBufs);
166 if (Pstream::parRun())
169 // Where do we store the calculated transformation?
170 // - on the processor patch?
171 // - on the underlying cyclic patch?
172 // - or do we not auto-calculate the transformation but
173 // have option of reading it.
175 // Update underlying cyclic halves. Need to do both since only one
176 // half might be present as a processorCyclic.
177 coupledPolyPatch& pp = const_cast<coupledPolyPatch&>(referPatch());
186 neighbFaceCellCentres()
189 if (isA<cyclicPolyPatch>(pp))
191 const cyclicPolyPatch& cpp = refCast<const cyclicPolyPatch>(pp);
192 const_cast<cyclicPolyPatch&>(cpp.neighbPatch()).calcGeometry
197 neighbFaceCellCentres(),
207 void Foam::processorCyclicPolyPatch::initMovePoints
209 PstreamBuffers& pBufs,
213 // Recalculate geometry
218 void Foam::processorCyclicPolyPatch::movePoints
220 PstreamBuffers& pBufs,
228 void Foam::processorCyclicPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
230 processorPolyPatch::initUpdateMesh(pBufs);
234 void Foam::processorCyclicPolyPatch::updateMesh(PstreamBuffers& pBufs)
237 processorPolyPatch::updateMesh(pBufs);
241 void Foam::processorCyclicPolyPatch::initOrder
243 PstreamBuffers& pBufs,
244 const primitivePatch& pp
247 // For now use the same algorithm as processorPolyPatch
248 processorPolyPatch::initOrder(pBufs, pp);
252 // Return new ordering. Ordering is -faceMap: for every face index
253 // the new face -rotation:for every new face the clockwise shift
254 // of the original face. Return false if nothing changes (faceMap
255 // is identity, rotation is 0)
256 bool Foam::processorCyclicPolyPatch::order
258 PstreamBuffers& pBufs,
259 const primitivePatch& pp,
264 // For now use the same algorithm as processorPolyPatch
265 return processorPolyPatch::order(pBufs, pp, faceMap, rotation);
269 void Foam::processorCyclicPolyPatch::write(Ostream& os) const
271 processorPolyPatch::write(os);
272 os.writeKeyword("referPatch") << referPatchName_
273 << token::END_STATEMENT << nl;
277 // ************************************************************************* //