38void Foam::conformalVoronoiMesh::calcNeighbourCellCentres
41 const pointField& cellCentres,
45 const label nBoundaryFaces =
mesh.nBoundaryFaces();
47 if (neiCc.size() != nBoundaryFaces)
50 <<
"nBoundaries:" << nBoundaryFaces
51 <<
" neiCc:" << neiCc.size()
55 const polyBoundaryMesh&
patches =
mesh.boundaryMesh();
63 label bFacei =
pp.start() -
mesh.nInternalFaces();
69 neiCc[bFacei] = cellCentres[faceCells[i]];
80void Foam::conformalVoronoiMesh::selectSeparatedCoupledFaces
92 if (cpp && (cpp->separated() || !cpp->parallel()))
100void Foam::conformalVoronoiMesh::findCellZoneInsideWalk
110 selectSeparatedCoupledFaces(
mesh, blockedFace);
112 forAll(faceToSurface, facei)
114 if (faceToSurface[facei] == -1)
116 blockedFace[facei] =
false;
120 blockedFace[facei] =
true;
134 geometryToConformTo().surfZones();
137 forAll(locationSurfaces, i)
139 label surfI = locationSurfaces[i];
141 const Foam::point& insidePoint = surfZones[surfI].zoneInsidePoint();
143 const word& surfName = geometryToConformTo().geometry().names()[surfI];
145 Info<<
" For surface " << surfName
146 <<
" finding inside point " << insidePoint
150 label keepRegionI = -1;
156 keepRegionI = cellRegion[celli];
160 Info<<
" For surface " << surfName
161 <<
" found point " << insidePoint <<
" in cell " << celli
162 <<
" in global region " << keepRegionI
163 <<
" out of " << cellRegion.nRegions() <<
" regions." <<
endl;
165 if (keepRegionI == -1)
168 <<
"Point " << insidePoint
169 <<
" is not inside the mesh." <<
nl
170 <<
"Bounding box of the mesh:" <<
mesh.
bounds()
177 if (cellRegion[celli] == keepRegionI)
179 if (cellToSurface[celli] == -2)
181 cellToSurface[celli] = surfI;
183 else if (cellToSurface[celli] != surfI)
188 <<
" is inside surface " << surfName
189 <<
" but already marked as being in zone "
190 << cellToSurface[celli] <<
endl
191 <<
"This can happen if your surfaces are not"
192 <<
" (sufficiently) closed."
206 labelList cellToSurface(cellCentres.size(), label(-1));
209 geometryToConformTo().surfZones();
217 geometryToConformTo().geometry(),
218 geometryToConformTo().surfaces()
222 forAll(closedNamedSurfaces, i)
224 label surfI = closedNamedSurfaces[i];
227 allGeometry()[geometryToConformTo().surfaces()[surfI]];
230 surfZones[surfI].zoneInside();
240 <<
"Trying to use surface "
242 <<
" which has non-geometric inside selection method "
250 surface.getVolumeType(cellCentres, volType);
252 bool selectInside =
true;
258 pointField(1, surfZones[surfI].zoneInsidePoint()),
264 selectInside =
false;
269 selectInside =
false;
274 if (cellToSurface[pointi] == -1)
288 cellToSurface[pointi] = surfI;
295 return cellToSurface;
299void Foam::conformalVoronoiMesh::calcFaceZones
331 neiFaceOwner[bFacei] = cellToSurface[
faceCells[i]];
341 const label ownerSurfacei = cellToSurface[faceOwner[facei]];
343 if (faceToSurface[facei] >= 0)
350 const label neiSurfacei = cellToSurface[faceNeighbour[facei]];
354 (ownerSurfacei >= 0 || neiSurfacei >= 0)
355 && ownerSurfacei != neiSurfacei
360 ownerSurfacei ==
max(ownerSurfacei, neiSurfacei)
365 faceToSurface[facei] =
max(ownerSurfacei, neiSurfacei);
374 const label neiSurfacei =
379 (ownerSurfacei >= 0 || neiSurfacei >= 0)
380 && ownerSurfacei != neiSurfacei
385 ownerSurfacei ==
max(ownerSurfacei, neiSurfacei)
390 faceToSurface[facei] =
max(ownerSurfacei, neiSurfacei);
395 if (ownerSurfacei >= 0)
397 faceToSurface[facei] = ownerSurfacei;
405 geometryToConformTo().surfZones();
412 geometryToConformTo().geometry(),
413 geometryToConformTo().surfaces()
418 calcNeighbourCellCentres
428 if (faceToSurface[facei] >= 0)
435 const label own = faceOwner[facei];
442 const label nei = faceNeighbour[facei];
444 geometryToConformTo().findSurfaceAllIntersections
454 geometryToConformTo().findSurfaceAllIntersections
465 if (surfHit.size() == 1 && surfHit[0].hit())
467 if (unclosedSurfaces.found(hitSurface[0]))
470 geometryToConformTo().getNormal
479 if ((norm[0] & areaNorm) < 0)
481 flipMap[facei] =
true;
485 flipMap[facei] =
false;
488 faceToSurface[facei] = hitSurface[0];
539void Foam::conformalVoronoiMesh::addZones
545 Info<<
" Adding zones to mesh" <<
endl;
548 geometryToConformTo().surfZones();
550 labelList cellToSurface(calcCellZones(cellCentres));
569 findCellZoneInsideWalk
572 insidePointNamedSurfaces,
583 label surfI = namedSurfaces[i];
584 const wordList& fzNames = surfZones[surfI].faceZoneNames();
587 << geometryToConformTo().geometry().names()[surfI] <<
nl
588 <<
indent <<
" faceZone : "
589 << (fzNames.size() ? fzNames[0] :
"") <<
nl
590 <<
indent <<
" cellZone : "
591 << surfZones[surfI].cellZoneName()
596 labelList surfaceToFaceZone(surfZones.size(), -1);
607 forAll(surfaceToFaceZones, surfi)
609 if (surfaceToFaceZones[surfi].size())
611 surfaceToFaceZone[surfi] = surfaceToFaceZones[surfi][0];
629 forAll(cellToSurface, celli)
631 label surfacei = cellToSurface[celli];
635 label zoneI = surfaceToCellZone[surfacei];
655 forAll(faceToSurface, facei)
657 label surfacei = faceToSurface[facei];
668 label own = faceOwner[facei];
669 label nei = faceNeighbour[facei];
682 surfaceToFaceZone[surfacei],
689 label own = faceOwner[facei];
702 surfaceToFaceZone[surfacei],
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
label size() const noexcept
The number of elements in the list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
A non-owning sub-view of a List (allocated or unallocated storage).
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Smooth ATC in cells next to a set of patches supplied by type.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
virtual const faceList & faces() const
Return raw faces.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
virtual const labelList & faceOwner() const
Return face owner.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
virtual const labelList & faceNeighbour() const
Return face neighbour.
const boundBox & bounds() const noexcept
Return mesh bounding box.
virtual const pointField & points() const
Return raw points.
Class describing modification of a cell.
Class describing modification of a face.
A patch is a list of labels that address the faces in the global face list.
Direct mesh changes based on v1.3 polyTopoChange syntax.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces).
label nInternalFaces() const noexcept
Number of internal faces.
const vectorField & cellCentres() const
label nFaces() const noexcept
Number of mesh faces.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
static labelList getInsidePointNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of surfaces with a cellZone that have 'insidePoint'.
areaSelectionAlgo
Types of selection of area.
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName).
static labelList getAllClosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are closed.
static labelList addCellZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
static labelList getUnclosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are unclosed.
static labelListList addFaceZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
static const Enum< areaSelectionAlgo > areaSelectionAlgoNames
@ OUTSIDE
A location outside the volume.
@ INSIDE
A location inside the volume.
A class for handling words, derived from Foam::string.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
const wordList surface
Standard surface field types (scalar, vector, tensor, etc).
List< word > wordList
List of word.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
List< bool > boolList
A List of bools.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.