Go to the documentation of this file.
69 bool Foam::localPointRegion::isDuplicate
76 if (f0.size() != f1.size())
81 label fp1 = f1.find(f0[0]);
90 if (f0[fp0] != f1[fp1])
97 fp1 = f1.fcIndex(fp1);
101 fp1 = f1.rcIndex(fp1);
109 void Foam::localPointRegion::countPointRegions
111 const polyMesh&
mesh,
113 const Map<label>& candidateFace,
121 meshPointMap_.
resize(candidateFace.size()/100);
123 DynamicList<labelList> pointRegions(meshPointMap_.size());
126 meshFaceMap_.resize(meshPointMap_.size());
130 const label facei = iter.key();
136 if (minRegion[facei].empty())
139 <<
"Face from candidateFace without minRegion set." <<
endl
146 const label pointi =
f[fp];
151 if (candidatePoint[pointi])
153 const label region = minRegion[facei][fp];
155 if (minPointRegion[pointi] == -1)
157 minPointRegion[pointi] = region;
159 else if (minPointRegion[pointi] != region)
162 const auto iter = meshPointMap_.cfind(pointi);
165 labelList& regions = pointRegions[iter.val()];
166 if (!regions.found(region))
168 label sz = regions.size();
169 regions.setSize(sz+1);
170 regions[sz] = region;
175 label localPointi = meshPointMap_.size();
176 meshPointMap_.insert(pointi, localPointi);
178 regions[0] = minPointRegion[pointi];
180 pointRegions.append(regions);
183 label meshFaceMapI = meshFaceMap_.size();
184 meshFaceMap_.insert(facei, meshFaceMapI);
190 minPointRegion.clear();
196 const label facei = iter.key();
206 if (candidatePoint[
f[fp]] && meshPointMap_.found(
f[fp]))
208 const label meshFaceMapI = meshFaceMap_.size();
209 meshFaceMap_.insert(facei, meshFaceMapI);
217 pointRegions.shrink();
218 pointRegions_.setSize(pointRegions.size());
221 pointRegions_[i].transfer(pointRegions[i]);
225 faceRegions_.setSize(meshFaceMap_.size());
228 faceRegions_[iter()].labelList::transfer(minRegion[iter.key()]);
250 void Foam::localPointRegion::calcPointRegions
252 const polyMesh&
mesh,
274 Map<label> candidateFace(2*nBnd);
275 label candidateFacei = 0;
277 Map<label> candidateCell(nBnd);
278 label candidateCelli = 0;
286 if (candidatePoint[
f[fp]])
289 if (candidateFace.insert(facei, candidateFacei))
295 if (candidateCell.insert(faceOwner[facei], candidateCelli))
302 label nei = faceNeighbour[facei];
303 if (candidateCell.insert(nei, candidateCelli))
327 label facei = iter.key();
332 label globOwn = globalCells.toGlobal(faceOwner[facei]);
333 label globNei = globalCells.toGlobal(faceNeighbour[facei]);
334 minRegion[facei].setSize(
f.size(),
min(globOwn, globNei));
338 label globOwn = globalCells.toGlobal(faceOwner[facei]);
339 minRegion[facei].setSize(
f.size(), globOwn);
352 Map<label> minPointValue(128);
356 minPointValue.clear();
358 label celli = iter.key();
359 const cell& cFaces =
mesh.
cells()[celli];
364 label facei = cFaces[cFacei];
366 if (minRegion[facei].size())
372 const label pointi =
f[fp];
373 auto iter = minPointValue.find(pointi);
375 if (iter == minPointValue.end())
377 minPointValue.insert(pointi, minRegion[facei][fp]);
381 label currentMin = iter();
382 iter() =
min(currentMin, minRegion[facei][fp]);
391 label facei = cFaces[cFacei];
393 if (minRegion[facei].size())
399 label minVal = minPointValue[
f[fp]];
401 if (minVal != minRegion[facei][fp])
403 minRegion[facei][fp] = minVal;
437 label f0 = baffles[i].first();
438 label f1 = baffles[i].second();
439 minEqOpFace()(minRegion[f0], minRegion[f1]);
440 minRegion[f1] = minRegion[f0];
446 countPointRegions(
mesh, candidatePoint, candidateFace, minRegion);
477 if (!
patches[patchi].coupled())
506 forAll(candidatePoints, i)
508 candidatePoint[candidatePoints[i]] =
true;
530 forAll(candidatePoints, i)
532 candidatePoint[candidatePoints[i]] =
true;
535 calcPointRegions(
mesh, baffles, candidatePoint);
556 labelList duplicateFace(allPatch.size(), -1);
557 label nDuplicateFaces = 0;
562 const face&
f = allPatch.localFaces()[bFacei];
572 if (otherFacei > bFacei)
574 const face& otherF = allPatch.localFaces()[otherFacei];
576 if (isDuplicate(
f, otherF,
true))
580 <<
" has local points:" <<
f <<
" at:"
582 <<
" which are in same order as face:"
584 <<
" with local points:" << otherF
587 else if (isDuplicate(
f, otherF,
false))
594 duplicateFace[bFacei] != -1
595 || duplicateFace[otherFacei] != -1
599 <<
"One of two duplicate faces already marked"
600 <<
" as duplicate." <<
nl
601 <<
"This means that three or more faces share"
602 <<
" the same points and this is illegal." <<
nl
603 <<
"Face:" << meshFace0
604 <<
" with local points:" <<
f <<
" at:"
606 <<
" which are in same order as face:"
608 <<
" with local points:" << otherF
612 duplicateFace[bFacei] = otherFacei;
613 duplicateFace[otherFacei] = bFacei;
620 return duplicateFace;
638 const labelList duplicateFace(findDuplicateFaces(
mesh, testFaces));
645 label otherFacei = duplicateFace[i];
647 if (otherFacei != -1 && i < otherFacei)
649 label meshFace0 = testFaces[i];
651 label meshFace1 = testFaces[otherFacei];
657 (patch0 != -1 && isA<processorPolyPatch>(
patches[patch0]))
658 || (patch1 != -1 && isA<processorPolyPatch>(
patches[patch1]))
662 <<
"One of two duplicate faces is on"
663 <<
" processorPolyPatch."
664 <<
"This is not allowed." <<
nl
665 <<
"Face:" << meshFace0
669 <<
"Face:" << meshFace1
680 return baffles.shrink();
695 newMap.insert(newFacei, iter.val());
List< label > labelList
A List of labels.
virtual const pointField & points() const
Return raw points.
const word & name() const
Return name.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
label nInternalFaces() const
Number of internal faces.
label nFaces() const
Number of mesh faces.
List< labelPair > labelPairList
List of labelPairs.
const cellList & cells() const
List< bool > boolList
A List of bools.
void append(const T &val)
Append an element at the end of the list.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
Pair< label > labelPair
A pair of labels.
localPointRegion(const polyMesh &mesh)
Construct from mesh. Assumes all non-coupled boundary points.
label nCells() const
Number of mesh cells.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::HEX);labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
A patch is a list of labels that address the faces in the global face list.
virtual const labelList & faceOwner() const
Return face owner.
void transfer(List< T > &list)
A List with indirect addressing.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
void resize(const label newSize)
Adjust allocated size of list.
label nBoundaryFaces() const
Number of boundary faces (== nFaces - nInternalFaces)
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
errorManip< error > abort(error &err)
const labelList & reverseFaceMap() const
Reverse face map.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
forAllConstIters(mixture.phases(), phase)
List< face > faceList
A List of faces.
const labelList & reversePointMap() const
Reverse point map.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const vectorField & faceCentres() const
label nPoints() const
Number of mesh points.
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
const polyBoundaryMesh & patches
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A List with indirect addressing.
A face is a list of labels corresponding to mesh vertices.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
defineTypeNameAndDebug(combustionModel, 0)
void operator()(face &x, const face &y) const
virtual const labelList & faceNeighbour() const
Return face neighbour.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
A list of faces which address into the list of points.
Cell-face mesh analysis engine.