52 Foam::channelIndex::vectorComponentsNames_;
58 void Foam::channelIndex::walkOppositeFaces
65 const cellList& cells = mesh.cells();
66 const faceList& faces = mesh.faces();
67 label nBnd = mesh.nFaces() - mesh.nInternalFaces();
69 DynamicList<label> frontFaces(startFaces);
72 label facei = frontFaces[i];
73 blockedFace[facei] =
true;
76 while (
returnReduce(frontFaces.size(), sumOp<label>()) > 0)
79 boolList isFrontBndFace(nBnd,
false);
82 label facei = frontFaces[i];
84 if (!mesh.isInternalFace(facei))
86 isFrontBndFace[facei-mesh.nInternalFaces()] =
true;
94 label facei = mesh.nInternalFaces()+i;
95 if (isFrontBndFace[i] && !blockedFace[facei])
97 blockedFace[facei] =
true;
98 frontFaces.append(facei);
103 DynamicList<label> newFrontFaces(frontFaces.size());
107 label facei = frontFaces[i];
110 const cell& ownCell = cells[mesh.faceOwner()[facei]];
112 label oppositeFacei = ownCell.opposingFaceLabel(facei, faces);
114 if (oppositeFacei == -1)
117 <<
"Face:" << facei <<
" owner cell:" << ownCell
122 if (!blockedFace[oppositeFacei])
124 blockedFace[oppositeFacei] =
true;
125 newFrontFaces.append(oppositeFacei);
130 if (mesh.isInternalFace(facei))
132 const cell& neiCell = mesh.cells()[mesh.faceNeighbour()[facei]];
134 label oppositeFacei = neiCell.opposingFaceLabel(facei, faces);
136 if (oppositeFacei == -1)
139 <<
"Face:" << facei <<
" neighbour cell:" << neiCell
144 if (!blockedFace[oppositeFacei])
146 blockedFace[oppositeFacei] =
true;
147 newFrontFaces.append(oppositeFacei);
153 frontFaces.transfer(newFrontFaces);
159 void Foam::channelIndex::calcLayeredRegions
161 const polyMesh& mesh,
165 boolList blockedFace(mesh.nFaces(),
false);
176 OFstream str(mesh.time().path()/
"blockedFaces.obj");
178 forAll(blockedFace, facei)
180 if (blockedFace[facei])
182 const face& f = mesh.faces()[facei];
190 str <<
' ' << vertI+fp+1;
200 cellRegion_.reset(
new regionSplit(mesh, blockedFace));
202 Info<<
"Detected " << cellRegion_().nRegions() <<
" layers." <<
nl <<
endl;
205 regionCount_ = regionSum(
scalarField(mesh.nCells(), 1.0));
210 regionSum(mesh.cellCentres())
214 SortableList<scalar> sortComponent(regionCc.component(dir_));
216 sortMap_ = sortComponent.indices();
222 y_.setSize(cellRegion_().nRegions()/2);
231 const polyMesh& mesh,
232 const dictionary& dict
236 dir_(vectorComponentsNames_.
read(dict.
lookup(
"component")))
238 const polyBoundaryMesh& patches = mesh.boundaryMesh();
252 <<
". Valid patches are " << patches.name()
256 nFaces += patches[
patchi].size();
268 startFaces[nFaces++] = pp.start()+j;
273 calcLayeredRegions(mesh, startFaces);
279 const polyMesh& mesh,
281 const bool symmetric,
285 symmetric_(symmetric),
289 calcLayeredRegions(mesh, startFaces);
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Initialise the NamedEnum HashTable from the static list of names.
List< bool > boolList
Bool container classes.
bool read(const char *, int32_t &)
vectorField pointField
pointField is a vectorField.
stressControl lookup("compactNormalStress") >> compactNormalStress
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
wordList patchNames(nPatches)
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
channelIndex(const polyMesh &, const dictionary &)
Construct from dictionary.
List< word > wordList
A List of words.
components
Component labeling enumeration.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
List< cell > cellList
list of cells