Go to the documentation of this file.
48 for (label celli = 0; celli < mesh_.nCells(); ++celli)
50 if (ignoreCells.
test(celli))
56 if (!(
cut & isoSurfaceBase::ANYCUT))
58 ignoreCells.
set(celli);
74 bitSet blockedFaces(mesh_.nFaces());
76 const labelList& faceOwn = mesh_.faceOwner();
77 const labelList& faceNei = mesh_.faceNeighbour();
80 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
87 ignoreCells.
test(faceOwn[facei])
88 != ignoreCells.
test(faceNei[facei])
91 blockedFaces.
set(facei);
104 const label facei =
patch.start() + patchFacei;
105 if (ignoreCells.
test(faceOwn[facei]))
107 blockedFaces.set(facei);
124 bitSet blockedFaces(filterPrepareRegionSplit(ignoreCells));
136 forAll(regionColour, celli)
138 if (!ignoreCells.
test(celli))
140 ++nCutsPerRegion[regionColour[celli]];
151 if (Pstream::master())
153 const label largest =
findMax(nCutsPerRegion);
162 keepRegion[largest] =
true;
167 Info<<
"Had " <<
sum(nCutsPerRegion) <<
" cuts, in "
168 << nCutsPerRegion.size() <<
" regions, largest is "
173 Pstream::scatter(keepRegion);
175 forAll(regionColour, celli)
177 if (!keepRegion.test(regionColour[celli]))
179 ignoreCells.
set(celli);
190 if (nearestPoints_.empty())
193 <<
"Ignoring nearestPoints - no points provided" <<
nl
199 bitSet blockedFaces(filterPrepareRegionSplit(ignoreCells));
220 if (ignoreCells.
test(celli))
225 const point& pt = cc[celli];
226 const label regioni = regionColour[celli];
228 ++nCutsPerRegion[regioni];
231 for (nearInfo& near : nearest)
233 const scalar distSqr =
magSqr(nearPts[pointi] - pt);
236 if (distSqr < near.first())
238 near.first() = distSqr;
239 near.second() = regioni;
255 if (Pstream::master())
257 const label largest =
findMax(nCutsPerRegion);
259 for (
const nearInfo& near : nearest)
261 const scalar distSqr = near.first();
262 const label regioni = near.second();
264 if (regioni != -1 && distSqr < maxDistanceSqr_)
266 keepRegion[regioni] =
true;
272 Info<<
"Had " <<
sum(nCutsPerRegion) <<
" cuts, in "
273 << nCutsPerRegion.size() <<
" regions, largest is "
276 Info<<
"nearestPoints (max distance = "
277 <<
sqrt(maxDistanceSqr_) <<
")" <<
nl;
281 const scalar dist =
sqrt(nearest[pointi].first());
282 const label regioni = nearest[pointi].second();
284 Info<<
" " << nearPts[pointi] <<
" region "
285 << regioni <<
" distance "
288 if (!keepRegion.test(regioni))
297 Pstream::scatter(keepRegion);
299 forAll(regionColour, celli)
301 if (!keepRegion.test(regionColour[celli]))
303 ignoreCells.
set(celli);
314 const pointField& fc = surface_.faceCentres();
332 calcAbsoluteDistance(faceDistance, fc, nearest);
340 faceNormalDistance.resize(fc.size());
361 forAll(faceDistance, facei)
363 if (faceDistance[facei] <= absProximity_)
373 Pout<<
"trim reject: "
374 << faceDistance[facei] <<
nl;
387 faceFilterStatus[facei] = 1;
392 Info<<
"Writing debug surface: " << outputName <<
nl;
402 writer.
write(
"normal-distance", faceNormalDistance);
int debug
Static debugging option.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Low-level components common to various iso-surface algorithms.
A class for handling file names.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const =0
From a set of points and indices get the normal.
static constexpr const zero Zero
Global zero (0)
cutType getCellCutType(const label celli) const
virtual void write(const coordSet &, const wordList &, const List< const Field< Type > * > &, Ostream &) const =0
General entry point for writing.
void set(const bitSet &bitset)
Set specified bits from another bitset.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void filterKeepNearestRegions(bitSet &ignoreCells) const
Keep region(s) closest to the nearest points.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
bool test(const label pos) const
Test value at specified position, never auto-vivify entries.
Face selection method for createBaffles.
#define forAll(list, i)
Loop across all elements in list.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
bool refineBlockedCells(bitSet &ignoreCells, const isoSurfaceBase &isoContext) const
Re-filter the blocked cells based on the anticipated cuts.
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
A surfaceWriter for VTK legacy (.vtk) or XML (.vtp) format.
void transfer(pointField &pointLst, List< Face > &faceLst)
Transfer the components.
vtk::internalMeshWriter writer(topoMesh, topoCells, writeOpts, runTime.path()/"blockTopology")
messageStream Info
Information stream (uses stdout - output is on the master only)
A patch is a list of labels that address the faces in the global face list.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Assign tuple-like container to use the one with the smaller value of first.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
label nRegions() const
Return total number of regions.
const word & surfaceName() const
The name of the underlying searchableSurface.
Patchify triangles based on orientation w.r.t other (triangulated or triangulatable) surfaces.
Base class for graphics format writing. Entry points are.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
const std::string patch
OpenFOAM patch number as a std::string.
label findMax(const ListType &input, label start=0)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
void clearStorage()
Clear the list and delete storage.
void filterKeepLargestRegion(bitSet &ignoreCells) const
Keep region with the most cuts (after region split)
A List with indirect addressing.
bitSet filterPrepareRegionSplit(const bitSet &ignoreCells) const
Prepare blockedFaces for region split.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
vector point
Point is a vector.
void filterByProximity()
Adjust extracted iso-surface to remove far faces.
#define WarningInFunction
Report a warning using Foam::Warning.
MeshedSurface subsetMesh(const UList< bool > &include, labelList &pointMap, labelList &faceMap) const
Return a new surface subsetted on the selected faces.