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...

Inheritance diagram for distanceSurface:
[legend]

Public Member Functions

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

Protected Member Functions

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

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 209 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 249 of file distanceSurface.C.

References dict, Foam::New(), dictionary::readEntry(), dictionary::readIfPresent(), and Foam::sqr().

Here is the call 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 319 of file distanceSurface.C.

◆ 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 341 of file distanceSurface.C.

◆ 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 377 of file distanceSurface.C.

◆ ~distanceSurface()

virtual ~distanceSurface ( )
virtualdefault

Destructor.

Member Function Documentation

◆ hasIsoSurface()

bool hasIsoSurface ( ) const
inlineprotected

Is currently backed by an isoSurfacePtr_.

Definition at line 302 of file distanceSurface.H.

References bool.

◆ isoSurfaceInterpolate()

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

Interpolate volume field onto surface points.

Definition at line 309 of file distanceSurface.H.

◆ 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 36 of file distanceSurfaceFilter.C.

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

Here is the call graph for this function:

◆ filterPrepareRegionSplit()

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

Prepare blockedFaces for region split.

Definition at line 68 of file distanceSurfaceFilter.C.

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

Here is the call graph for this function:

◆ filterKeepLargestRegion()

void filterKeepLargestRegion ( bitSet ignoreCells) const
protected

Keep region with the most cuts (after region split)

Definition at line 119 of file distanceSurfaceFilter.C.

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

Here is the call graph for this function:

◆ filterKeepNearestRegions()

void filterKeepNearestRegions ( bitSet ignoreCells) const
protected

Keep region(s) closest to the nearest points.

Definition at line 186 of file distanceSurfaceFilter.C.

References Pstream::broadcast(), PackedList< Width >::clearStorage(), Foam::endl(), Foam::findMax(), Foam::flatOutput(), forAll, Foam::Info, Pstream::listCombineGather(), Foam::magSqr(), splitCell::master(), Foam::nl, regionSplit::nRegions(), bitSet::set(), UList< T >::size(), Foam::sqrt(), Foam::sum(), UList< T >::test(), bitSet::test(), WarningInFunction, and Foam::Zero.

Here is the call graph for this function:

◆ filterRegionProximity()

void filterRegionProximity ( bitSet ignoreCells) const
protected

Remove region(s) that have far faces.

Definition at line 310 of file distanceSurfaceFilter.C.

References Pstream::broadcast(), PackedList< Width >::clearStorage(), Foam::faceMap(), searchableSurface::findNearest(), forAll, Foam::Info, Pstream::listCombineGather(), splitCell::master(), Foam::nl, bitSet::none(), regionSplit::nRegions(), outputName(), PackedList< Width >::reset(), Foam::returnReduce(), bitSet::set(), UList< T >::size(), writer(), and Foam::Zero.

Here is the call graph for this function:

◆ filterFaceProximity()

void filterFaceProximity ( )
protected

Adjust extracted iso-surface to remove far faces.

Definition at line 467 of file distanceSurfaceFilter.C.

References 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(), and writer().

Here is the call graph for this function:

◆ TypeName()

TypeName ( "distanceSurface"  )

Runtime type information.

◆ createGeometry()

◆ surfaceName()

const word & surfaceName ( ) const
inline

The name of the underlying searchableSurface.

Definition at line 409 of file distanceSurface.H.

◆ distance()

scalar distance ( ) const
inlinenoexcept

The distance to the underlying searchableSurface.

Definition at line 415 of file distanceSurface.H.

◆ surface() [1/2]

const meshedSurface & surface ( ) const
inline

The underlying surface.

Definition at line 421 of file distanceSurface.H.

Referenced by sampledDistanceSurface::Cf(), sampledDistanceSurface::faces(), sampledDistanceSurface::magSf(), sampledDistanceSurface::points(), and sampledDistanceSurface::Sf().

Here is the caller graph for this function:

◆ surface() [2/2]

meshedSurface & surface ( )
inline

The underlying surface.

Definition at line 431 of file distanceSurface.H.

◆ meshCells() [1/2]

const labelList & meshCells ( ) const
inline

For each face, the original cell in mesh.

Definition at line 441 of file distanceSurface.H.

Referenced by sampledDistanceSurface::sampleOnFaces().

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 451 of file distanceSurface.H.

◆ print()

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

Print information.

Definition at line 762 of file distanceSurface.C.

References Foam::distance(), os(), and UList< T >::size().

Here is the call graph for this function:

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