45 Foam::channelIndex::vectorComponentsNames_;
51 void Foam::channelIndex::walkOppositeFaces
59 const faceList& faces = mesh.faces();
60 label nBnd = mesh.nFaces() - mesh.nInternalFaces();
62 DynamicList<label> frontFaces(startFaces);
65 label faceI = frontFaces[i];
66 blockedFace[faceI] =
true;
69 while (
returnReduce(frontFaces.size(), sumOp<label>()) > 0)
72 boolList isFrontBndFace(nBnd,
false);
75 label faceI = frontFaces[i];
77 if (!mesh.isInternalFace(faceI))
79 isFrontBndFace[faceI-mesh.nInternalFaces()] =
true;
87 label faceI = mesh.nInternalFaces()+i;
88 if (isFrontBndFace[i] && !blockedFace[faceI])
90 blockedFace[faceI] =
true;
91 frontFaces.append(faceI);
96 DynamicList<label> newFrontFaces(frontFaces.size());
100 label faceI = frontFaces[i];
103 const cell& ownCell = cells[mesh.faceOwner()[faceI]];
105 label oppositeFaceI = ownCell.opposingFaceLabel(faceI, faces);
107 if (oppositeFaceI == -1)
110 <<
"Face:" << faceI <<
" owner cell:" << ownCell
115 if (!blockedFace[oppositeFaceI])
117 blockedFace[oppositeFaceI] =
true;
118 newFrontFaces.append(oppositeFaceI);
123 if (mesh.isInternalFace(faceI))
125 const cell& neiCell = mesh.cells()[mesh.faceNeighbour()[faceI]];
127 label oppositeFaceI = neiCell.opposingFaceLabel(faceI, faces);
129 if (oppositeFaceI == -1)
132 <<
"Face:" << faceI <<
" neighbour cell:" << neiCell
137 if (!blockedFace[oppositeFaceI])
139 blockedFace[oppositeFaceI] =
true;
140 newFrontFaces.append(oppositeFaceI);
146 frontFaces.transfer(newFrontFaces);
152 void Foam::channelIndex::calcLayeredRegions
154 const polyMesh& mesh,
158 boolList blockedFace(mesh.nFaces(),
false);
169 OFstream str(mesh.time().path()/
"blockedFaces.obj");
171 forAll(blockedFace, faceI)
173 if (blockedFace[faceI])
175 const face&
f = mesh.faces()[faceI];
183 str <<
' ' << vertI+fp+1;
193 cellRegion_.reset(
new regionSplit(mesh, blockedFace));
195 Info<<
"Detected " << cellRegion_().nRegions() <<
" layers." <<
nl <<
endl;
198 regionCount_ = regionSum(
scalarField(mesh.nCells(), 1.0));
203 regionSum(mesh.cellCentres())
207 SortableList<scalar> sortComponent(regionCc.component(dir_));
209 sortMap_ = sortComponent.indices();
215 y_.setSize(cellRegion_().nRegions()/2);
222 Foam::channelIndex::channelIndex
224 const polyMesh& mesh,
225 const dictionary& dict
228 symmetric_(
readBool(dict.lookup(
"symmetric"))),
229 dir_(vectorComponentsNames_.read(dict.lookup(
"component")))
231 const polyBoundaryMesh&
patches = mesh.boundaryMesh();
239 label patchI = patches.findPatchID(
patchNames[i]);
243 FatalErrorIn(
"channelIndex::channelIndex(const polyMesh&)")
245 <<
". Valid patches are " << patches.name()
249 nFaces += patches[patchI].size();
257 const polyPatch& pp = patches[patches.findPatchID(
patchNames[i])];
261 startFaces[nFaces++] = pp.start()+j;
266 calcLayeredRegions(mesh, startFaces);
270 Foam::channelIndex::channelIndex
272 const polyMesh& mesh,
274 const bool symmetric,
278 symmetric_(symmetric),
282 calcLayeredRegions(mesh, startFaces);