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 <<
" has local points:" << f
541 <<
" which are in same order as face:" 543 <<
" with local points:" << otherF
546 else if (isDuplicate(f, otherF,
false))
553 duplicateFace[bFacei] != -1
554 || duplicateFace[otherFacei] != -1
558 <<
"One of two duplicate faces already marked" 559 <<
" as duplicate." <<
nl 560 <<
"This means that three or more faces share" 561 <<
" the same points and this is illegal." <<
nl 562 <<
"Face:" << meshFace0
563 <<
" with local points:" << f
564 <<
" which are in same order as face:" 566 <<
" with local points:" << otherF
570 duplicateFace[bFacei] = otherFacei;
571 duplicateFace[otherFacei] = bFacei;
578 return duplicateFace;
604 label otherFacei = duplicateFace[i];
606 if (otherFacei != -1 && i < otherFacei)
608 label meshFace0 = testFaces[i];
610 label meshFace1 = testFaces[otherFacei];
616 (patch0 != -1 && isA<processorPolyPatch>(patches[patch0]))
617 || (patch1 != -1 && isA<processorPolyPatch>(patches[patch1]))
621 <<
"One of two duplicate faces is on" 622 <<
" processorPolyPatch." 623 <<
"This is not allowed." <<
nl 624 <<
"Face:" << meshFace0
625 <<
" is on patch:" << patches[patch0].
name()
627 <<
"Face:" << meshFace1
628 <<
" is on patch:" << patches[patch1].
name()
632 baffles.append(
labelPair(meshFace0, meshFace1));
635 return baffles.shrink();
650 newMap.insert(newFacei, iter());
664 newMap.insert(newPointi, iter());
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define forAll(list, i)
Loop across all elements in list.
const labelList & reversePointMap() const
Reverse point map.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
void resize(const label)
Alter the addressed list size.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
A face is a list of labels corresponding to mesh vertices.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label nInternalFaces() const
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
virtual const labelList & faceNeighbour() const
Return face neighbour.
Cell-face mesh analysis engine.
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual const pointField & points() const =0
Return mesh points.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
const cellList & cells() const
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
void resize(const label)
Alias for setSize(const label)
label size() const
Return number of elements in table.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
A list of faces which address into the list of points.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
A List obtained as a section of another List.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
void clear()
Clear the list, i.e. set size to zero.
void clear()
Clear all entries from table.
localPointRegion(const polyMesh &mesh)
Construct from mesh. Assumes all non-coupled boundary points.
void append(const T &)
Append an element at the end of the list.
virtual const labelList & faceOwner() const
Return face owner.
Pair< label > labelPair
Label pair.
virtual const faceList & faces() const
Return raw faces.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
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, &mergedCyclicPolyPatch::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]
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const vectorField & faceCentres() const
void setSize(const label)
Reset size of List.
void operator()(face &x, const face &y) const
A cell is defined as a list of faces with extra functionality.
virtual const faceList & faces() const =0
Return faces.
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
A List with indirect addressing.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
const labelList & reverseFaceMap() const
Reverse face map.