1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "cyclicPointPatch.H"
28 #include "pointBoundaryMesh.H"
29 #include "addToRunTimeSelectionTable.H"
30 #include "pointMesh.H"
31 #include "globalPointPatch.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 defineTypeNameAndDebug(cyclicPointPatch, 0);
43 addToRunTimeSelectionTable
51 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
53 void Foam::cyclicPointPatch::initGeometry()
55 transformPairs_.setSize(0);
59 void Foam::cyclicPointPatch::calcGeometry()
61 const edgeList& cp = cyclicPolyPatch_.coupledPoints();
62 const labelList& mp = cyclicPolyPatch_.meshPoints();
64 // If there are no global points create a 1->1 map
65 if (!boundaryMesh().mesh().globalData().nGlobalPoints())
67 nonGlobalPatchPoints_.setSize(mp.size());
68 forAll(nonGlobalPatchPoints_, i)
70 nonGlobalPatchPoints_[i] = i;
73 meshPoints_ = cyclicPolyPatch_.meshPoints();
78 // Get reference to shared points
79 const labelList& sharedPoints =
80 boundaryMesh().globalPatch().meshPoints();
82 nonGlobalPatchPoints_.setSize(mp.size());
83 meshPoints_.setSize(mp.size());
85 labelList pointMap(mp.size(), -1);
87 label noFiltPoints = 0;
91 label curP = mp[pointI];
95 forAll (sharedPoints, sharedI)
97 if (sharedPoints[sharedI] == curP)
106 pointMap[pointI] = noFiltPoints;
107 nonGlobalPatchPoints_[noFiltPoints] = pointI;
108 meshPoints_[noFiltPoints] = curP;
113 nonGlobalPatchPoints_.setSize(noFiltPoints);
114 meshPoints_.setSize(noFiltPoints);
117 transformPairs_.setSize(cp.size());
119 label noFiltPointPairs = 0;
123 if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] != -1)
125 transformPairs_[noFiltPointPairs][0] = pointMap[cp[i][0]];
126 transformPairs_[noFiltPointPairs][1] = pointMap[cp[i][1]];
129 else if (pointMap[cp[i][0]] == -1 && pointMap[cp[i][1]] != -1)
131 FatalErrorIn("cyclicPointPatch::calcGeometry() const")
132 << "Point " << cp[i][0] << "of point-pair " << i
133 << " is a global point but the other point "
134 << cp[i][1] << " is not"
137 else if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] == -1)
139 FatalErrorIn("cyclicPointPatch::calcGeometry() const")
140 << "Point " << cp[i][1] << "of point-pair " << i
141 << " is a global point but the other point "
142 << cp[i][0] << " is not"
147 transformPairs_.setSize(noFiltPointPairs);
152 void cyclicPointPatch::initMovePoints(const pointField&)
156 void cyclicPointPatch::movePoints(const pointField&)
160 void cyclicPointPatch::initUpdateMesh()
162 facePointPatch::initUpdateMesh();
163 cyclicPointPatch::initGeometry();
167 void cyclicPointPatch::updateMesh()
169 facePointPatch::updateMesh();
170 cyclicPointPatch::calcGeometry();
174 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
176 cyclicPointPatch::cyclicPointPatch
178 const polyPatch& patch,
179 const pointBoundaryMesh& bm
182 coupledFacePointPatch(patch, bm),
183 cyclicPolyPatch_(refCast<const cyclicPolyPatch>(patch))
187 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
189 cyclicPointPatch::~cyclicPointPatch()
193 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
195 const edgeList& cyclicPointPatch::transformPairs() const
197 return transformPairs_;
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 } // End namespace Foam
205 // ************************************************************************* //