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