Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "cyclicPointPatch.H"
00027 #include <OpenFOAM/pointBoundaryMesh.H>
00028 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00029 #include <OpenFOAM/pointMesh.H>
00030 #include <OpenFOAM/globalPointPatch.H>
00031 #include <OpenFOAM/edgeList.H>
00032
00033
00034
00035 namespace Foam
00036 {
00037
00038
00039
00040 defineTypeNameAndDebug(cyclicPointPatch, 0);
00041
00042 addToRunTimeSelectionTable
00043 (
00044 facePointPatch,
00045 cyclicPointPatch,
00046 polyPatch
00047 );
00048
00049
00050
00051
00052 void Foam::cyclicPointPatch::initGeometry()
00053 {
00054 transformPairs_.setSize(0);
00055 }
00056
00057
00058 void Foam::cyclicPointPatch::calcGeometry()
00059 {
00060 const edgeList& cp = cyclicPolyPatch_.coupledPoints();
00061 const labelList& mp = cyclicPolyPatch_.meshPoints();
00062
00063
00064 if (!boundaryMesh().mesh().globalData().nGlobalPoints())
00065 {
00066 nonGlobalPatchPoints_.setSize(mp.size());
00067 forAll(nonGlobalPatchPoints_, i)
00068 {
00069 nonGlobalPatchPoints_[i] = i;
00070 }
00071
00072 meshPoints_ = cyclicPolyPatch_.meshPoints();
00073 transformPairs_ = cp;
00074 }
00075 else
00076 {
00077
00078 const labelList& sharedPoints =
00079 boundaryMesh().globalPatch().meshPoints();
00080
00081 nonGlobalPatchPoints_.setSize(mp.size());
00082 meshPoints_.setSize(mp.size());
00083
00084 labelList pointMap(mp.size(), -1);
00085
00086 label noFiltPoints = 0;
00087
00088 forAll (mp, pointI)
00089 {
00090 label curP = mp[pointI];
00091
00092 bool found = false;
00093
00094 forAll (sharedPoints, sharedI)
00095 {
00096 if (sharedPoints[sharedI] == curP)
00097 {
00098 found = true;
00099 break;
00100 }
00101 }
00102
00103 if (!found)
00104 {
00105 pointMap[pointI] = noFiltPoints;
00106 nonGlobalPatchPoints_[noFiltPoints] = pointI;
00107 meshPoints_[noFiltPoints] = curP;
00108 noFiltPoints++;
00109 }
00110 }
00111
00112 nonGlobalPatchPoints_.setSize(noFiltPoints);
00113 meshPoints_.setSize(noFiltPoints);
00114
00115
00116 transformPairs_.setSize(cp.size());
00117
00118 label noFiltPointPairs = 0;
00119
00120 forAll(cp, i)
00121 {
00122 if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] != -1)
00123 {
00124 transformPairs_[noFiltPointPairs][0] = pointMap[cp[i][0]];
00125 transformPairs_[noFiltPointPairs][1] = pointMap[cp[i][1]];
00126 noFiltPointPairs++;
00127 }
00128 else if (pointMap[cp[i][0]] == -1 && pointMap[cp[i][1]] != -1)
00129 {
00130 FatalErrorIn("cyclicPointPatch::calcGeometry() const")
00131 << "Point " << cp[i][0] << "of point-pair " << i
00132 << " is a global point but the other point "
00133 << cp[i][1] << " is not"
00134 << exit(FatalError);
00135 }
00136 else if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] == -1)
00137 {
00138 FatalErrorIn("cyclicPointPatch::calcGeometry() const")
00139 << "Point " << cp[i][1] << "of point-pair " << i
00140 << " is a global point but the other point "
00141 << cp[i][0] << " is not"
00142 << exit(FatalError);
00143 }
00144 }
00145
00146 transformPairs_.setSize(noFiltPointPairs);
00147 }
00148 }
00149
00150
00151 void cyclicPointPatch::initMovePoints(const pointField&)
00152 {}
00153
00154
00155 void cyclicPointPatch::movePoints(const pointField&)
00156 {}
00157
00158
00159 void cyclicPointPatch::initUpdateMesh()
00160 {
00161 facePointPatch::initUpdateMesh();
00162 cyclicPointPatch::initGeometry();
00163 }
00164
00165
00166 void cyclicPointPatch::updateMesh()
00167 {
00168 facePointPatch::updateMesh();
00169 cyclicPointPatch::calcGeometry();
00170 }
00171
00172
00173
00174
00175 cyclicPointPatch::cyclicPointPatch
00176 (
00177 const polyPatch& patch,
00178 const pointBoundaryMesh& bm
00179 )
00180 :
00181 coupledFacePointPatch(patch, bm),
00182 cyclicPolyPatch_(refCast<const cyclicPolyPatch>(patch))
00183 {}
00184
00185
00186
00187
00188 cyclicPointPatch::~cyclicPointPatch()
00189 {}
00190
00191
00192
00193
00194 const edgeList& cyclicPointPatch::transformPairs() const
00195 {
00196 return transformPairs_;
00197 }
00198
00199
00200
00201
00202 }
00203
00204