Go to the documentation of this file.
31 #include "indirectPrimitivePatch.H"
73 if (f0.
size() !=
f1.size())
87 if (f0[fp0] !=
f1[fp1])
94 fp1 =
f1.fcIndex(fp1);
98 fp1 =
f1.rcIndex(fp1);
118 meshPointMap_.resize(candidateFace.size()/100);
123 meshFaceMap_.resize(meshPointMap_.size());
127 label faceI = iter.key();
129 if (!
mesh.isInternalFace(faceI))
133 if (minRegion[faceI].empty())
136 <<
"Face from candidateFace without minRegion set." <<
endl
137 <<
"Face:" << faceI <<
" fc:" <<
mesh.faceCentres()[faceI]
148 if (candidatePoint[pointI])
150 label region = minRegion[faceI][fp];
152 if (minPointRegion[pointI] == -1)
154 minPointRegion[pointI] = region;
156 else if (minPointRegion[pointI] != region)
160 if (iter != meshPointMap_.end())
162 labelList& regions = pointRegions[iter()];
167 regions[sz] = region;
172 label localPointI = meshPointMap_.
size();
173 meshPointMap_.insert(pointI, localPointI);
175 regions[0] = minPointRegion[pointI];
177 pointRegions.
append(regions);
180 label meshFaceMapI = meshFaceMap_.size();
181 meshFaceMap_.insert(faceI, meshFaceMapI);
187 minPointRegion.
clear();
193 label faceI = iter.key();
195 if (
mesh.isInternalFace(faceI))
203 if (candidatePoint[
f[fp]] && meshPointMap_.found(
f[fp]))
205 label meshFaceMapI = meshFaceMap_.size();
206 meshFaceMap_.insert(faceI, meshFaceMapI);
215 pointRegions_.setSize(pointRegions.size());
218 pointRegions_[i].transfer(pointRegions[i]);
222 faceRegions_.setSize(meshFaceMap_.size());
225 faceRegions_[iter()].labelList::transfer(minRegion[iter.key()]);
259 syncTools::syncPointList
272 label candidateFaceI = 0;
275 label candidateCellI = 0;
283 if (candidatePoint[
f[fp]])
286 if (candidateFace.insert(faceI, candidateFaceI))
292 if (candidateCell.insert(faceOwner[faceI], candidateCellI))
297 if (
mesh.isInternalFace(faceI))
299 label nei = faceNeighbour[faceI];
300 if (candidateCell.insert(nei, candidateCellI))
324 label faceI = iter.key();
327 if (
mesh.isInternalFace(faceI))
331 minRegion[faceI].
setSize(
f.size(),
min(globOwn, globNei));
336 minRegion[faceI].
setSize(
f.size(), globOwn);
353 minPointValue.clear();
355 label cellI = iter.key();
356 const cell& cFaces =
mesh.cells()[cellI];
361 label faceI = cFaces[cFaceI];
363 if (minRegion[faceI].size())
372 if (iter == minPointValue.end())
374 minPointValue.insert(pointI, minRegion[faceI][fp]);
378 label currentMin = iter();
379 iter() =
min(currentMin, minRegion[faceI][fp]);
388 label faceI = cFaces[cFaceI];
390 if (minRegion[faceI].size())
396 label minVal = minPointValue[
f[fp]];
398 if (minVal != minRegion[faceI][fp])
400 minRegion[faceI][fp] = minVal;
422 mesh.nFaces()-
mesh.nInternalFaces(),
423 mesh.nInternalFaces()
425 syncTools::syncBoundaryFaceList
434 label f0 = baffles[i].first();
435 label f1 = baffles[i].second();
437 minRegion[
f1] = minRegion[f0];
443 countPointRegions(
mesh, candidatePoint, candidateFace, minRegion);
474 if (!
patches[patchI].coupled())
503 forAll(candidatePoints, i)
505 candidatePoint[candidatePoints[i]] =
true;
527 forAll(candidatePoints, i)
529 candidatePoint[candidatePoints[i]] =
true;
532 calcPointRegions(
mesh, baffles, candidatePoint);
553 labelList duplicateFace(allPatch.size(), -1);
554 label nDuplicateFaces = 0;
569 if (otherFaceI > bFaceI)
573 if (isDuplicate(
f, otherF,
true))
577 <<
" has local points:" <<
f
578 <<
" which are in same order as face:"
580 <<
" with local points:" << otherF
583 else if (isDuplicate(
f, otherF,
false))
590 duplicateFace[bFaceI] != -1
591 || duplicateFace[otherFaceI] != -1
595 <<
"One of two duplicate faces already marked"
596 <<
" as duplicate." <<
nl
597 <<
"This means that three or more faces share"
598 <<
" the same points and this is illegal." <<
nl
599 <<
"Face:" << meshFace0
600 <<
" with local points:" <<
f
601 <<
" which are in same order as face:"
603 <<
" with local points:" << otherF
607 duplicateFace[bFaceI] = otherFaceI;
608 duplicateFace[otherFaceI] = bFaceI;
615 return duplicateFace;
634 const labelList duplicateFace(findDuplicateFaces(
mesh, testFaces));
641 label otherFaceI = duplicateFace[i];
643 if (otherFaceI != -1 && i < otherFaceI)
645 label meshFace0 = testFaces[i];
647 label meshFace1 = testFaces[otherFaceI];
653 (patch0 != -1 && isA<processorPolyPatch>(
patches[patch0]))
654 || (patch1 != -1 && isA<processorPolyPatch>(
patches[patch1]))
658 <<
"One of two duplicate faces is on"
659 <<
" processorPolyPatch."
660 <<
"This is not allowed." <<
nl
661 <<
"Face:" << meshFace0
663 <<
" is on patch:" <<
patches[patch0].name()
665 <<
"Face:" << meshFace1
667 <<
" is on patch:" <<
patches[patch1].name()
691 newMap.insert(newFaceI, iter());
694 meshFaceMap_.transfer(newMap);
705 newMap.insert(newPointI, iter());
709 meshPointMap_.transfer(newMap);
static bool isDuplicate(const face &f0, const face &f1, const bool forward)
Check if two faces are equal. If forward = false checks f1 in.
virtual const pointField & points() const
Return raw points.
const labelListList & pointFaces() const
Return point-face addressing.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A List obtained as a section of another List.
List< labelPair > labelPairList
List of labelPairs.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void calcPointRegions(const polyMesh &mesh, const labelPairList &baffles, boolList &candidatePoint)
Do all: calculate points that need to be duplicated.
Mesh consisting of general polyhedral cells.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("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]
localPointRegion(const polyMesh &mesh)
Construct from mesh. Assumes all non-coupled boundary points.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void countPointRegions(const polyMesh &mesh, const boolList &candidatePoint, const Map< label > &candidateFace, faceList &minRegion)
Given minimum cell the points on a face are connected to.
A patch is a list of labels that address the faces in the global face list.
A List with indirect addressing.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label nInternalFaces() const
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
errorManip< error > abort(error &err)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
const labelList & reverseFaceMap() const
Reverse face map.
void setSize(const label)
Reset size of List.
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.
const labelList & reversePointMap() const
Reverse point map.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const vectorField & faceCentres() const
void clear()
Clear the list, i.e. set size to zero.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
A face is a list of labels corresponding to mesh vertices.
void size(const label)
Override size to be inconsistent with allocated storage.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
A cell is defined as a list of faces with extra functionality.
void operator()(face &x, const face &y) const
Pair< label > labelPair
Label pair.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
label toGlobal(const label i) const
From local to global.
A list of faces which address into the list of points.
Cell-face mesh analysis engine.