Loading...
Searching...
No Matches
distanceSurface Class Reference

A surface defined by a distance from an input searchable surface. Uses an iso-surface algorithm (cell, topo, point) for constructing the distance surface. More...

#include <distanceSurface.H>

Inheritance diagram for distanceSurface:

Public Member Functions

 TypeName ("distanceSurface")
 Runtime type information.
 distanceSurface (const word &defaultSurfaceName, const polyMesh &mesh, const dictionary &dict)
 Construct from dictionary.
 distanceSurface (const polyMesh &mesh, const word &surfaceType, const word &surfaceName, const isoSurfaceParams &params=isoSurfaceParams(), const bool interpolate=false)
 Construct from components with zero-distanced.
 distanceSurface (const polyMesh &mesh, const bool interpolate, const word &surfaceType, const word &surfaceName, const scalar distance, const bool useSignedDistance, const isoSurfaceParams &params=isoSurfaceParams())
 Construct from components.
 distanceSurface (const polyMesh &mesh, const bool interpolate, autoPtr< searchableSurface > &&surface, const scalar distance, const bool useSignedDistance, const isoSurfaceParams &params=isoSurfaceParams())
virtual ~distanceSurface ()=default
 Destructor.
void createGeometry ()
 Create/recreate the distance surface.
const wordsurfaceName () const
 The name of the underlying searchableSurface.
scalar distance () const noexcept
 The distance to the underlying searchableSurface.
const meshedSurfacesurface () const
 The underlying surface.
meshedSurfacesurface ()
 The underlying surface.
const labelListmeshCells () const
 For each face, the original cell in mesh.
labelListmeshCells ()
 For each face, the original cell in mesh.
void print (Ostream &os, int level=0) const
 Print information.

Protected Member Functions

bool hasIsoSurface () const
 Is currently backed by an isoSurfacePtr_.
template<class Type>
tmp< Field< Type > > isoSurfaceInterpolate (const VolumeField< Type > &cellValues, const Field< Type > &pointValues) const
 Interpolate volume field onto surface points.
bool refineBlockedCells (bitSet &ignoreCells, const isoSurfaceBase &isoContext) const
 Re-filter the blocked cells based on the anticipated cuts.
bitSet filterPrepareRegionSplit (const bitSet &ignoreCells) const
 Prepare blockedFaces for region split.
void filterKeepLargestRegion (bitSet &ignoreCells) const
 Keep region with the most cuts (after region split).
void filterKeepNearestRegions (bitSet &ignoreCells) const
 Keep region(s) closest to the nearest points.
void filterRegionProximity (bitSet &ignoreCells) const
 Remove region(s) that have far faces.
void filterFaceProximity ()
 Adjust extracted iso-surface to remove far faces.

Detailed Description

A surface defined by a distance from an input searchable surface. Uses an iso-surface algorithm (cell, topo, point) for constructing the distance surface.

For a zero-distance surface, it performs additional checks and supports filtering to handle the surface boundaries.

Usage
Example of function object partial specification:
surfaces
{
    surface1
    {
        type        distanceSurface;
        surfaceType triSurfaceMesh;
        surfaceName something.obj;
        topology    proximityFaces;
    }

    surface2
    {
        type        distanceSurface;
        surfaceType triSurfaceMesh;
        surfaceName other.obj;

        topology    nearestPoints;
        nearestPoints
        (
            (0 0 0)
            (10 10 0)
        );

        // Max search distance for nearestPoints
        maxDistance 0.005;
    }
}

Dictionary controls:

Property Description Required Default
distance distance from surface no 0
signed Use sign when distance is positive no true
isoMethod Iso-algorithm (cell/topo/point) no default
regularise Face simplification (enum or bool) no true
bounds Limit with bounding box no
surfaceType Type of surface yes
surfaceName Name of surface in triSurface/ no dict name
topology Topology filter name no none
nearestPoints Points for point-based segmentation no
maxDistance Max search distance for nearestPoints no GREAT
absProximity Max proximity of face centres no 1e-5

Topology/Filtering (for zero-distance only). These represent different ways to tackle the "ragged edge" problem.

  • none : No filtering
  • proximityFaces or proximity (post-filter): Checks the resulting faces against the original search surface and rejects faces with a distance greater than absProximity.
  • proximityRegions (post-filter): Checks the distance of the resulting faces against the original search surface. Filters based on the area-weighted distance of each topologically connected region. If the area-weighted distance of a region is greater than absProximity, the entire region is rejected.
  • largestRegion (pre-filter): The cut cells are checked for topological connectivity and the region with the most number of cut cells is retained.
  • nearestPoints (pre-filter): The cut cells split into regions, the regions closest to the user-defined points are retained. Uses maxDistance for additional control.
Note
For distance = 0, some special adjustments.
  • Always signed (ignoring the input value).
  • Use normal distance from surface (for better treatment of open edges).
  • Additional checks for open surfaces edges are used to limit the extend of resulting distance surface. The resulting surface elements will, however, contain partial cell coverage. NB: Not applicable if the point isoMethod is used.

The keyword cell (bool value) which was use in 1906 and earlier to switch between point/cell algorithms is now ignored (2020-12).

Changed default algorithm from cell to topo (2020-12).

Source files

Definition at line 205 of file distanceSurface.H.

Constructor & Destructor Documentation

◆ distanceSurface() [1/4]

distanceSurface ( const word & defaultSurfaceName,
const polyMesh & mesh,
const dictionary & dict )

Construct from dictionary.

Definition at line 234 of file distanceSurface.C.

References dict, e, Foam::equal(), mesh, Foam::New(), and Foam::sqr().

Referenced by distanceSurface(), distanceSurface(), sampledDistanceSurface::sampledDistanceSurface(), and sampledDistanceSurface::sampledDistanceSurface().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distanceSurface() [2/4]

distanceSurface ( const polyMesh & mesh,
const word & surfaceType,
const word & surfaceName,
const isoSurfaceParams & params = isoSurfaceParams(),
const bool interpolate = false )

Construct from components with zero-distanced.

Definition at line 304 of file distanceSurface.C.

References distanceSurface(), mesh, and surfaceName().

Here is the call graph for this function:

◆ distanceSurface() [3/4]

distanceSurface ( const polyMesh & mesh,
const bool interpolate,
const word & surfaceType,
const word & surfaceName,
const scalar distance,
const bool useSignedDistance,
const isoSurfaceParams & params = isoSurfaceParams() )

Construct from components.

Definition at line 326 of file distanceSurface.C.

References distance(), distanceSurface(), mesh, Foam::New(), and surfaceName().

Here is the call graph for this function:

◆ distanceSurface() [4/4]

distanceSurface ( const polyMesh & mesh,
const bool interpolate,
autoPtr< searchableSurface > && surface,
const scalar distance,
const bool useSignedDistance,
const isoSurfaceParams & params = isoSurfaceParams() )

Definition at line 362 of file distanceSurface.C.

References distance(), e, Foam::equal(), mesh, Foam::sqr(), and surface().

Here is the call graph for this function:

◆ ~distanceSurface()

virtual ~distanceSurface ( )
virtualdefault

Destructor.

Member Function Documentation

◆ hasIsoSurface()

bool hasIsoSurface ( ) const
inlineprotected

Is currently backed by an isoSurfacePtr_.

Definition at line 337 of file distanceSurface.H.

Referenced by sampledDistanceSurface::sampleOnIsoSurfacePoints(), and sampledDistanceSurface::sampleOnPoints().

Here is the caller graph for this function:

◆ isoSurfaceInterpolate()

template<class Type>
tmp< Field< Type > > isoSurfaceInterpolate ( const VolumeField< Type > & cellValues,
const Field< Type > & pointValues ) const
inlineprotected

Interpolate volume field onto surface points.

Definition at line 346 of file distanceSurface.H.

Referenced by sampledDistanceSurface::sampleOnIsoSurfacePoints().

Here is the caller graph for this function:

◆ refineBlockedCells()

bool refineBlockedCells ( bitSet & ignoreCells,
const isoSurfaceBase & isoContext ) const
protected

Re-filter the blocked cells based on the anticipated cuts.

Uses a lightweight variant of cutting.

Definition at line 29 of file distanceSurfaceFilter.C.

References isoSurfaceBase::ANYCUT, isoSurfaceBase::getCellCutType(), bitSet::set(), and bitSet::test().

Referenced by createGeometry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filterPrepareRegionSplit()

Foam::bitSet filterPrepareRegionSplit ( const bitSet & ignoreCells) const
protected

Prepare blockedFaces for region split.

Definition at line 61 of file distanceSurfaceFilter.C.

References forAll, bitSet::set(), syncTools::syncFaceList(), and bitSet::test().

Referenced by filterKeepLargestRegion(), filterKeepNearestRegions(), and filterRegionProximity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filterKeepLargestRegion()

void filterKeepLargestRegion ( bitSet & ignoreCells) const
protected

Keep region with the most cuts (after region split).

Definition at line 112 of file distanceSurfaceFilter.C.

References UPstream::broadcast, PackedList< Width >::clearStorage(), filterPrepareRegionSplit(), Foam::findMax(), Foam::flatOutput(), forAll, Foam::Info, Pstream::listGather(), UPstream::master(), Foam::nl, regionSplit::nRegions(), bitSet::set(), UList< T >::size(), Foam::sum(), bitSet::test(), UList< T >::test(), and Foam::Zero.

Referenced by createGeometry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filterKeepNearestRegions()

void filterKeepNearestRegions ( bitSet & ignoreCells) const
protected

◆ filterRegionProximity()

◆ filterFaceProximity()

void filterFaceProximity ( )
protected

Adjust extracted iso-surface to remove far faces.

Definition at line 460 of file distanceSurfaceFilter.C.

References Foam::ListOps::createWithValue(), Foam::diff(), Foam::faceMap(), searchableSurface::findNearest(), forAll, searchableSurface::getNormal(), Foam::Info, Foam::mag(), Foam::nl, outputName(), Foam::Pout, List< T >::resize(), bitSet::set(), UList< T >::size(), surfaceName(), and writer().

Referenced by createGeometry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TypeName()

TypeName ( "distanceSurface" )

Runtime type information.

References dict, distance(), mesh, surface(), and surfaceName().

Here is the call graph for this function:

◆ createGeometry()

◆ surfaceName()

const word & surfaceName ( ) const
inline

The name of the underlying searchableSurface.

Definition at line 473 of file distanceSurface.H.

Referenced by distanceSurface(), distanceSurface(), filterFaceProximity(), filterRegionProximity(), print(), and TypeName().

Here is the caller graph for this function:

◆ distance()

scalar distance ( ) const
inlinenoexcept

The distance to the underlying searchableSurface.

Definition at line 481 of file distanceSurface.H.

References Foam::noexcept.

Referenced by distanceSurface(), distanceSurface(), sampledDistanceSurface::sampledDistanceSurface(), TypeName(), and sampledDistanceSurface::TypeName().

Here is the caller graph for this function:

◆ surface() [1/2]

◆ surface() [2/2]

meshedSurface & surface ( )
inline

The underlying surface.

Definition at line 501 of file distanceSurface.H.

◆ meshCells() [1/2]

const labelList & meshCells ( ) const
inline

For each face, the original cell in mesh.

Definition at line 513 of file distanceSurface.H.

Referenced by sampledDistanceSurface::sampleOnFaces(), and sampledDistanceSurface::sampleOnPoints().

Here is the caller graph for this function:

◆ meshCells() [2/2]

labelList & meshCells ( )
inline

For each face, the original cell in mesh.

Definition at line 525 of file distanceSurface.H.

◆ print()

void print ( Ostream & os,
int level = 0 ) const

Print information.

Definition at line 747 of file distanceSurface.C.

References Foam::distance(), os(), surface(), and surfaceName().

Referenced by createGeometry(), and sampledDistanceSurface::print().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: