53 x[i] =
min(x[i], y[j]);
66 bool Foam::localPointRegion::isDuplicate
82 if (f0[fp0] != f1[fp1])
101 void Foam::localPointRegion::countPointRegions
113 meshPointMap_.
resize(candidateFace.
size()/100);
118 meshFaceMap_.
resize(meshPointMap_.size());
122 label faceI = iter.key();
128 if (minRegion[faceI].empty())
131 <<
"Face from candidateFace without minRegion set." <<
endl 132 <<
"Face:" << faceI <<
" fc:" << mesh.
faceCentres()[faceI]
138 label pointI = f[fp];
143 if (candidatePoint[pointI])
145 label region = minRegion[faceI][fp];
147 if (minPointRegion[pointI] == -1)
149 minPointRegion[pointI] = region;
151 else if (minPointRegion[pointI] != region)
155 if (iter != meshPointMap_.
end())
157 labelList& regions = pointRegions[iter()];
162 regions[sz] = region;
167 label localPointI = meshPointMap_.
size();
168 meshPointMap_.insert(pointI, localPointI);
170 regions[0] = minPointRegion[pointI];
172 pointRegions.
append(regions);
175 label meshFaceMapI = meshFaceMap_.size();
176 meshFaceMap_.insert(faceI, meshFaceMapI);
182 minPointRegion.clear();
188 label faceI = iter.key();
198 if (candidatePoint[f[fp]] && meshPointMap_.found(f[fp]))
200 label meshFaceMapI = meshFaceMap_.size();
201 meshFaceMap_.insert(faceI, meshFaceMapI);
209 pointRegions.shrink();
210 pointRegions_.setSize(pointRegions.size());
213 pointRegions_[i].transfer(pointRegions[i]);
217 faceRegions_.setSize(meshFaceMap_.size());
220 faceRegions_[iter()].labelList::transfer(minRegion[iter.key()]);
242 void Foam::localPointRegion::calcPointRegions
266 label candidateFaceI = 0;
269 label candidateCellI = 0;
277 if (candidatePoint[f[fp]])
280 if (candidateFace.
insert(faceI, candidateFaceI))
286 if (candidateCell.
insert(faceOwner[faceI], candidateCellI))
293 label nei = faceNeighbour[faceI];
294 if (candidateCell.
insert(nei, candidateCellI))
318 label faceI = iter.key();
323 label globOwn = globalCells.toGlobal(faceOwner[faceI]);
324 label globNei = globalCells.toGlobal(faceNeighbour[faceI]);
329 label globOwn = globalCells.toGlobal(faceOwner[faceI]);
347 minPointValue.
clear();
349 label cellI = iter.key();
350 const cell& cFaces = mesh.
cells()[cellI];
355 label faceI = cFaces[cFaceI];
357 if (minRegion[faceI].size())
363 label pointI = f[fp];
366 if (iter == minPointValue.
end())
368 minPointValue.
insert(pointI, minRegion[faceI][fp]);
372 label currentMin = iter();
373 iter() =
min(currentMin, minRegion[faceI][fp]);
382 label faceI = cFaces[cFaceI];
384 if (minRegion[faceI].size())
390 label minVal = minPointValue[f[fp]];
392 if (minVal != minRegion[faceI][fp])
394 minRegion[faceI][fp] = minVal;
430 countPointRegions(mesh, candidatePoint, candidateFace, minRegion);
461 if (!patches[patchI].coupled())
472 calcPointRegions(mesh, candidatePoint);
490 forAll(candidatePoints, i)
492 candidatePoint[candidatePoints[i]] =
true;
495 calcPointRegions(mesh, candidatePoint);
516 labelList duplicateFace(allPatch.size(), -1);
517 label nDuplicateFaces = 0;
522 const face&
f = allPatch.localFaces()[bFaceI];
530 label otherFaceI = pFaces[i];
532 if (otherFaceI > bFaceI)
534 const face& otherF = allPatch.localFaces()[otherFaceI];
536 if (isDuplicate(f, otherF,
true))
540 "findDuplicateFaces(const primitiveMesh&" 541 ", const labelList&)" 543 <<
" has local points:" << f
544 <<
" which are in same order as face:" 546 <<
" with local points:" << otherF
549 else if (isDuplicate(f, otherF,
false))
556 duplicateFace[bFaceI] != -1
557 || duplicateFace[otherFaceI] != -1
562 "findDuplicateFaces(const primitiveMesh&" 563 ", const labelList&)" 564 ) <<
"One of two duplicate faces already marked" 565 <<
" as duplicate." <<
nl 566 <<
"This means that three or more faces share" 567 <<
" the same points and this is illegal." <<
nl 568 <<
"Face:" << meshFace0
569 <<
" with local points:" << f
570 <<
" which are in same order as face:" 572 <<
" with local points:" << otherF
576 duplicateFace[bFaceI] = otherFaceI;
577 duplicateFace[otherFaceI] = bFaceI;
584 return duplicateFace;
610 label otherFaceI = duplicateFace[i];
612 if (otherFaceI != -1 && i < otherFaceI)
614 label meshFace0 = testFaces[i];
616 label meshFace1 = testFaces[otherFaceI];
622 (patch0 != -1 && isA<processorPolyPatch>(patches[patch0]))
623 || (patch1 != -1 && isA<processorPolyPatch>(patches[patch1]))
628 "localPointRegion::findDuplicateFacePairs(const polyMesh&)" 629 ) <<
"One of two duplicate faces is on" 630 <<
" processorPolyPatch." 631 <<
"This is not allowed." <<
nl 632 <<
"Face:" << meshFace0
633 <<
" is on patch:" << patches[patch0].
name()
635 <<
"Face:" << meshFace1
636 <<
" is on patch:" << patches[patch1].
name()
640 baffles.append(
labelPair(meshFace0, meshFace1));
643 return baffles.shrink();
658 newMap.insert(newFaceI, iter());
672 newMap.insert(newPointI, iter());
A List with indirect addressing.
virtual const pointField & points() const =0
Return mesh points.
const labelList & reverseFaceMap() const
Reverse face map.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
A cell is defined as a list of faces with extra functionality.
void operator()(face &x, const face &y) const
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reversePointMap() const
Reverse point map.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
void size(const label)
Override size to be inconsistent with allocated storage.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
const cellList & cells() const
static void syncBoundaryFaceList(const polyMesh &, UList< T > &, const CombineOp &cop, const TransformOp &top)
Synchronize values on boundary faces only.
virtual const faceList & faces() const =0
Return faces.
A patch is a list of labels that address the faces in the global face list.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
A face is a list of labels corresponding to mesh vertices.
Cell-face mesh analysis engine.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void clear()
Clear all entries from table.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
void resize(const label)
Alter the addressed list size.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label size() const
Return number of elements in table.
errorManip< error > abort(error &err)
const word & name() const
Return name.
virtual const labelList & faceOwner() const
Return face owner.
static void syncPointList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A list of faces which address into the list of points.
localPointRegion(const polyMesh &mesh)
Construct from mesh. Assumes all non-coupled boundary points.
label nInternalFaces() const
void resize(const label)
Alias for setSize(const label)
Mesh consisting of general polyhedral cells.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Pair< label > labelPair
Label pair.
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Dummy transform to be used with syncTools.
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
A List obtained as a section of another List.
void append(const T &)
Append an element at the end of the list.
virtual const faceList & faces() const
Return raw faces.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
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]
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual const labelList & faceNeighbour() const
Return face neighbour.
defineTypeNameAndDebug(combustionModel, 0)
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const vectorField & faceCentres() const