faceSet.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 "faceSet.H"
00028 #include "mapPolyMesh.H"
00029 #include "polyMesh.H"
00030 #include "processorPolyPatch.H"
00031 #include "cyclicPolyPatch.H"
00032
00033 #include "addToRunTimeSelectionTable.H"
00034
00035
00036
00037 namespace Foam
00038 {
00039
00040
00041
00042 defineTypeNameAndDebug(faceSet, 0);
00043
00044 addToRunTimeSelectionTable(topoSet, faceSet, word);
00045 addToRunTimeSelectionTable(topoSet, faceSet, size);
00046
00047
00048
00049
00050 faceSet::faceSet(const IOobject& obj)
00051 :
00052 topoSet(obj, typeName)
00053 {}
00054
00055
00056 faceSet::faceSet
00057 (
00058 const polyMesh& mesh,
00059 const word& name,
00060 readOption r,
00061 writeOption w
00062 )
00063 :
00064 topoSet(mesh, typeName, name, r, w)
00065 {
00066 check(mesh.nFaces());
00067 }
00068
00069
00070 faceSet::faceSet
00071 (
00072 const polyMesh& mesh,
00073 const word& name,
00074 const label size,
00075 writeOption w
00076 )
00077 :
00078 topoSet(mesh, name, size, w)
00079 {}
00080
00081
00082 faceSet::faceSet
00083 (
00084 const polyMesh& mesh,
00085 const word& name,
00086 const labelHashSet& set,
00087 writeOption w
00088 )
00089 :
00090 topoSet(mesh, name, set, w)
00091 {}
00092
00093
00094
00095
00096 faceSet::~faceSet()
00097 {}
00098
00099
00100
00101
00102 void faceSet::sync(const polyMesh& mesh)
00103 {
00104 const polyBoundaryMesh& patches = mesh.boundaryMesh();
00105
00106 label nAdded = 0;
00107
00108 if (Pstream::parRun())
00109 {
00110
00111
00112 forAll(patches, patchI)
00113 {
00114 const polyPatch& pp = patches[patchI];
00115
00116 if (isType<processorPolyPatch>(pp))
00117 {
00118 const processorPolyPatch& procPatch =
00119 refCast<const processorPolyPatch>(pp);
00120
00121
00122 DynamicList<label> setFaces(pp.size());
00123
00124 forAll(pp, i)
00125 {
00126 if (found(pp.start() + i))
00127 {
00128 setFaces.append(i);
00129 }
00130 }
00131 setFaces.shrink();
00132
00133 OPstream toNeighbour
00134 (
00135 Pstream::blocking,
00136 procPatch.neighbProcNo()
00137 );
00138
00139 toNeighbour << setFaces;
00140 }
00141 }
00142
00143
00144 forAll(patches, patchI)
00145 {
00146 const polyPatch& pp = patches[patchI];
00147
00148 if (isType<processorPolyPatch>(pp))
00149 {
00150 const processorPolyPatch& procPatch =
00151 refCast<const processorPolyPatch>(pp);
00152
00153 IPstream fromNeighbour
00154 (
00155 Pstream::blocking,
00156 procPatch.neighbProcNo()
00157 );
00158
00159 labelList setFaces(fromNeighbour);
00160
00161 forAll(setFaces, i)
00162 {
00163 if (insert(pp.start() + setFaces[i]))
00164 {
00165 nAdded++;
00166 }
00167 }
00168 }
00169 }
00170 }
00171
00172
00173 forAll (patches, patchI)
00174 {
00175 const polyPatch& pp = patches[patchI];
00176
00177 if (typeid(pp) == typeid(cyclicPolyPatch))
00178 {
00179 const cyclicPolyPatch& cycPatch =
00180 refCast<const cyclicPolyPatch>(pp);
00181
00182 forAll (cycPatch, i)
00183 {
00184 label thisFaceI = cycPatch.start() + i;
00185 label otherFaceI = cycPatch.transformGlobalFace(thisFaceI);
00186
00187 if (found(thisFaceI))
00188 {
00189 if (insert(otherFaceI))
00190 {
00191 nAdded++;
00192 }
00193 }
00194 else if (found(otherFaceI))
00195 {
00196 if (insert(thisFaceI))
00197 {
00198 nAdded++;
00199 }
00200 }
00201 }
00202 }
00203 }
00204
00205
00206 reduce(nAdded, sumOp<label>());
00207
00208
00209
00210
00211
00212
00213
00214 }
00215
00216
00217 label faceSet::maxSize(const polyMesh& mesh) const
00218 {
00219 return mesh.nFaces();
00220 }
00221
00222
00223 void faceSet::updateMesh(const mapPolyMesh& morphMap)
00224 {
00225 updateLabels(morphMap.reverseFaceMap());
00226 }
00227
00228
00229 void faceSet::writeDebug
00230 (
00231 Ostream& os,
00232 const primitiveMesh& mesh,
00233 const label maxLen
00234 ) const
00235 {
00236 topoSet::writeDebug(os, mesh.faceCentres(), maxLen);
00237 }
00238
00239
00240
00241
00242 }
00243
00244
Copyright © 2000-2009 OpenCFD Ltd