setLayerPairing.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
00028
00029
00030 #include "layerAdditionRemoval.H"
00031 #include "polyMesh.H"
00032 #include "primitiveMesh.H"
00033 #include "polyTopoChange.H"
00034 #include "oppositeFace.H"
00035 #include "polyTopoChanger.H"
00036
00037
00038
00039 bool Foam::layerAdditionRemoval::setLayerPairing() const
00040 {
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 const polyMesh& mesh = topoChanger().mesh();
00057
00058 const labelList& mc =
00059 mesh.faceZones()[faceZoneID_.index()].masterCells();
00060
00061 const labelList& mf = mesh.faceZones()[faceZoneID_.index()];
00062
00063 const boolList& mfFlip =
00064 mesh.faceZones()[faceZoneID_.index()].flipMap();
00065
00066 const faceList& faces = mesh.faces();
00067 const cellList& cells = mesh.cells();
00068
00069
00070 const faceList& mlf =
00071 mesh.faceZones()[faceZoneID_.index()]().localFaces();
00072
00073 const labelList& meshPoints =
00074 mesh.faceZones()[faceZoneID_.index()]().meshPoints();
00075
00076
00077
00078 if (pointsPairingPtr_ || facesPairingPtr_)
00079 {
00080 FatalErrorIn
00081 (
00082 "void Foam::layerAdditionRemoval::setLayerPairing() const"
00083 ) << "Problem with layer pairing data"
00084 << abort(FatalError);
00085 }
00086
00087 pointsPairingPtr_ = new labelList(meshPoints.size(), -1);
00088 labelList& ptc = *pointsPairingPtr_;
00089
00090 facesPairingPtr_ = new labelList(mf.size(), -1);
00091 labelList& ftc = *facesPairingPtr_;
00092
00093
00094
00095
00096 label nPointErrors = 0;
00097 label nFaceErrors = 0;
00098
00099 forAll (mf, faceI)
00100 {
00101
00102 face curLocalFace = mlf[faceI];
00103
00104
00105 if (mfFlip[faceI])
00106 {
00107 curLocalFace = curLocalFace.reverseFace();
00108 }
00109
00110
00111 oppositeFace lidFace =
00112 cells[mc[faceI]].opposingFace(mf[faceI], faces);
00113
00114 if (!lidFace.found())
00115 {
00116
00117 nFaceErrors++;
00118 continue;
00119 }
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 ftc[faceI] = lidFace.oppositeIndex();
00130
00131
00132 forAll (curLocalFace, pointI)
00133 {
00134 const label clp = curLocalFace[pointI];
00135
00136 if (ptc[clp] == -1)
00137 {
00138
00139 ptc[clp] = lidFace[pointI];
00140 }
00141 else
00142 {
00143
00144 if (ptc[clp] != lidFace[pointI])
00145 {
00146 nPointErrors++;
00147
00148
00149
00150
00151
00152
00153
00154 }
00155 }
00156 }
00157
00158 }
00159
00160 reduce(nPointErrors, sumOp<label>());
00161 reduce(nFaceErrors, sumOp<label>());
00162
00163 if (nPointErrors > 0 || nFaceErrors > 0)
00164 {
00165 clearAddressing();
00166
00167 return false;
00168 }
00169 else
00170 {
00171
00172 return true;
00173 }
00174 }
00175
00176
00177 const Foam::labelList& Foam::layerAdditionRemoval::pointsPairing() const
00178 {
00179 if (!pointsPairingPtr_)
00180 {
00181 FatalErrorIn
00182 (
00183 "const labelList& layerAdditionRemoval::pointsPairing() const"
00184 ) << "Problem with layer pairing data for object " << name()
00185 << abort(FatalError);
00186 }
00187
00188 return *pointsPairingPtr_;
00189 }
00190
00191 const Foam::labelList& Foam::layerAdditionRemoval::facesPairing() const
00192 {
00193 if (!facesPairingPtr_)
00194 {
00195 FatalErrorIn
00196 (
00197 "const labelList& layerAdditionRemoval::facesPairing() const"
00198 ) << "Problem with layer pairing data for object " << name()
00199 << abort(FatalError);
00200 }
00201
00202 return *facesPairingPtr_;
00203 }
00204
00205
00206
00207
00208 void Foam::layerAdditionRemoval::modifyMotionPoints
00209 (
00210 pointField& motionPoints
00211 ) const
00212 {
00213 if (debug)
00214 {
00215 Pout<< "void layerAdditionRemoval::modifyMotionPoints("
00216 << "pointField& motionPoints) const for object "
00217 << name() << " : ";
00218 }
00219
00220 if (debug)
00221 {
00222 Pout << "No motion point adjustment" << endl;
00223 }
00224 }
00225
00226
00227
Copyright © 2000-2009 OpenCFD Ltd