Go to the documentation of this file.
48 Foam::distanceSurface::topologyFilterType
50 Foam::distanceSurface::topoFilterNames_
52 { topologyFilterType::NONE,
"none" },
53 { topologyFilterType::LARGEST_REGION,
"largestRegion" },
54 { topologyFilterType::NEAREST_POINTS,
"nearestPoints" },
55 { topologyFilterType::PROXIMITY,
"proximity" },
79 <<
"Had " << notHit <<
" from " << nearest.size()
80 <<
" without a point hit" <<
endl
110 const scalar normDist = (
diff & norm);
161 const bitSet& ignoreLocation,
169 if (ignoreLocation.
test(i))
190 template<
bool WantPo
intFilter = false>
212 const point& pt = nearest[celli].point();
224 ignoreCells.
set(celli);
226 else if (WantPointFilter)
229 pointFilter.
set(cPoints);
247 const word& defaultSurfaceName,
260 dict.getOrDefault(
"surfaceName", defaultSurfaceName),
261 mesh.time().constant(),
270 distance_(
dict.getOrDefault<scalar>(
"distance", 0)),
271 withZeroDistance_(
equal(distance_, 0)),
276 ||
dict.getOrDefault<
bool>(
"signed",
true)
281 isoSurfaceParams::ALGO_TOPO,
282 isoSurfaceParams::filterType::DIAGCELL
286 topoFilterNames_.getOrDefault
290 topologyFilterType::NONE
295 absProximity_(
dict.getOrDefault<scalar>(
"absProximity", 1
e-5)),
296 cellDistancePtr_(
nullptr),
300 isoSurfacePtr_(
nullptr)
302 if (topologyFilterType::NEAREST_POINTS == topoFilter_)
304 dict.readEntry(
"nearestPoints", nearestPoints_);
307 if (
dict.readIfPresent(
"maxDistance", maxDistanceSqr_))
309 maxDistanceSqr_ =
Foam::sqr(maxDistanceSqr_);
317 const word& surfaceType,
318 const word& surfaceName,
340 const word& surfaceType,
341 const word& surfaceName,
343 const bool useSignedDistance,
356 mesh.time().constant(),
366 withZeroDistance_(
equal(distance_, 0)),
374 topoFilter_(topologyFilterType::NONE),
378 cellDistancePtr_(
nullptr),
382 isoSurfacePtr_(
nullptr)
392 Pout<<
"distanceSurface::createGeometry updating geometry." <<
endl;
396 isoSurfacePtr_.reset(
nullptr);
403 const fvMesh& fvmesh =
static_cast<const fvMesh&
>(mesh_);
408 cellDistancePtr_.reset
414 "distanceSurface.cellDistance",
425 auto& cellDistance = *cellDistancePtr_;
433 bitSet ignoreCells, ignoreCellPoints;
435 const bool filterCells =
461 simpleGeometricFilter<false>(ignoreCells, nearest, fvmesh);
464 if (withSignDistance_)
481 else if (withZeroDistance_)
492 calcAbsoluteDistance(
fld, cc, nearest);
513 if (withSignDistance_)
518 if (withZeroDistance_)
534 calcAbsoluteDistance(
fld, cc, nearest);
545 pointDistance_.resize(fvmesh.
nPoints());
546 pointDistance_ = GREAT;
561 if (withSignDistance_)
578 else if (withZeroDistance_)
589 calcAbsoluteDistance(
fld, pts, nearest);
595 if (ignoreCells.
none())
599 else if (filterCells && topologyFilterType::NONE != topoFilter_)
610 if (topologyFilterType::LARGEST_REGION == topoFilter_)
615 else if (topologyFilterType::NEAREST_POINTS == topoFilter_)
628 Pout<<
"Writing cell distance:" << cellDistance.objectPath() <<
endl;
629 cellDistance.
write();
634 "distanceSurface.pointDistance",
646 Pout<<
"Writing point distance:" << pDist.objectPath() <<
endl;
670 || topologyFilterType::PROXIMITY == topoFilter_
674 meshCells_.
transfer(isoSurfacePtr_->meshCells());
676 isoSurfacePtr_.reset(
nullptr);
677 cellDistancePtr_.reset(
nullptr);
678 pointDistance_.clear();
681 if (topologyFilterType::PROXIMITY == topoFilter_)
696 os <<
" surface:" << surfaceName()
698 <<
" faces:" << surface().surfFaces().size()
699 <<
" points:" << surface().points().size();
int debug
Static debugging option.
virtual const pointField & points() const
Return raw points.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
static autoPtr< isoSurfaceBase > New(const isoSurfaceParams ¶ms, const volScalarField &cellValues, const scalarField &pointValues, const scalar iso, const bitSet &ignoreCells=bitSet())
Create for specified algorithm type.
A class for handling words, derived from Foam::string.
Low-level components common to various iso-surface algorithms.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const =0
From a set of points and indices get the normal.
const labelListList & cellPoints() const
static constexpr const zero Zero
Global zero (0)
void inflate(const scalar s)
Inflate box by factor*mag(span) in all dimensions.
algorithmType algorithm() const noexcept
Get current algorithm.
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
static word timeName(const scalar t, const int precision=precision_)
distanceSurface(const word &defaultSurfaceName, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
void set(const bitSet &bitset)
Set specified bits from another bitset.
static void calcNormalDistance_filtered(scalarField &distance, const bitSet &ignoreLocation, const pointField &points, const List< pointIndexHit > &nearest, const vectorField &normals)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void calcNormalDistance_zero(scalarField &distance, const pointField &points, const List< pointIndexHit > &nearest, const vectorField &normals)
static bitSet simpleGeometricFilter(bitSet &ignoreCells, const List< pointIndexHit > &nearest, const polyMesh &mesh)
virtual void clear()
Clear all storage.
void filterKeepNearestRegions(bitSet &ignoreCells) const
Keep region(s) closest to the nearest points.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
dimensionedScalar sign(const dimensionedScalar &ds)
bool test(const label pos) const
Test value at specified position, never auto-vivify entries.
void resize(const label nElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
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 surface defined by a distance from an input searchable surface. Uses an iso-surface algorithm (cell...
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label nCells() const
Number of mesh cells.
bool hit() const noexcept
Is there a hit?
static scalar normalDistance_zero(const point &pt, const pointIndexHit &pHit, const vector &norm)
void transfer(pointField &pointLst, List< Face > &faceLst)
Transfer the components.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
void transfer(List< T > &list)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const volVectorField & C() const
Return cell centres as volVectorField.
void flip()
Invert all bits in the addressable region.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Preferences for controlling iso-surface algorithms.
Macros for easy insertion into run-time selection tables.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Mesh data needed to do the Finite Volume discretisation.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
errorManip< error > abort(error &err)
scalar distance(const vector &p1, const vector &p2)
void clear()
Clear bounding box and make it an inverted box.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
bool contains(const point &pt) const
Contains point? (inside or on edge)
void print(Ostream &os) const
Print information.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
bool none() const
True if no bits in this bitset are set.
static void checkAllHits(const UList< pointIndexHit > &nearest)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const dimensionedScalar e
Elementary charge.
label nPoints() const
Number of mesh points.
void clear()
Clear the list, i.e. set size to zero.
const point_type & point() const noexcept
Return point, no checks.
void clearStorage()
Clear the list and delete storage.
void filterKeepLargestRegion(bitSet &ignoreCells) const
Keep region with the most cuts (after region split)
A bounding box defined in terms of min/max extrema points.
const Time & time() const
Return the top-level database.
void createGeometry()
Create/recreate the distance surface.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void filterByProximity()
Adjust extracted iso-surface to remove far faces.
defineTypeNameAndDebug(combustionModel, 0)
static scalar normalDistance_nonzero(const point &pt, const pointIndexHit &pHit, const vector &norm)
static void calcNormalDistance_nonzero(scalarField &distance, const pointField &points, const List< pointIndexHit > &nearest, const vectorField &normals)
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &tvf, const edgeScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void add(const boundBox &bb)
Extend to include the second box.