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...
 
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) 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 GeometricField< Type, fvPatchField, volMesh > &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 filterByProximity ()
 Adjust extracted iso-surface to remove far faces. 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...
 

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    proximity;
    }

    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 (none/largestRegion/nearestPoints/proximity) 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

Filtering (for zero-distance only)

  • largestRegion (pre-filter): The cut cells are checked for topological connectivity and the region with the most number of cut cells is retained. This handles the "ragged" edge problem.
  • nearestPoints (pre-filter): The cut cells split into regions, the regions closest to the user-defined points are retained. Uses maxDistance for additional control.
  • proximity (post-filter): Checks the resulting faces against the original search surface and rejects faces with a distance greater than absProximity.
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 198 of file distanceSurface.H.

Constructor & Destructor Documentation

◆ distanceSurface() [1/3]

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

Construct from dictionary.

Definition at line 246 of file distanceSurface.C.

References dict, and Foam::sqr().

Here is the call graph for this function:

◆ distanceSurface() [2/3]

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

◆ distanceSurface() [3/3]

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

References bool.

◆ isoSurfaceInterpolate()

tmp<Field<Type> > isoSurfaceInterpolate ( const GeometricField< Type, fvPatchField, volMesh > &  cellValues,
const Field< Type > &  pointValues 
) const
inlineprotected

Interpolate volume field onto surface points.

Definition at line 297 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::getCellCutType(), bitSet::set(), and bitSet::test().

Referenced by distanceSurface::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 68 of file distanceSurfaceFilter.C.

References forAll, Foam::foamVersion::patch, List< T >::set(), and bitSet::test().

Here is the call graph for this function:

◆ filterByProximity()

void filterByProximity ( )
protected

Adjust extracted iso-surface to remove far faces.

Definition at line 309 of file distanceSurfaceFilter.C.

References Foam::expressions::patchExpr::debug, Foam::diff(), Foam::faceMap(), searchableSurface::findNearest(), forAll, searchableSurface::getNormal(), Foam::Info, Foam::mag(), Foam::nl, Foam::Pout, Foam::returnReduce(), MeshedSurface< Face >::subsetMesh(), distanceSurface::surfaceName(), MeshedSurface< Face >::transfer(), writer< Type >::write(), writer(), and Foam::Zero.

Referenced by distanceSurface::createGeometry().

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

References PackedList< Width >::clearStorage(), Foam::expressions::patchExpr::debug, Foam::findMax(), Foam::flatOutput(), forAll, Foam::Info, Foam::nl, regionSplit::nRegions(), bitSet::set(), Foam::sum(), bitSet::test(), and Foam::Zero.

Referenced by distanceSurface::createGeometry().

Here is the call graph for this function:
Here is the caller 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 PackedList< Width >::clearStorage(), Foam::expressions::patchExpr::debug, Foam::endl(), Foam::findMax(), Foam::flatOutput(), forAll, Foam::Info, Foam::magSqr(), Foam::nl, regionSplit::nRegions(), bitSet::set(), Foam::sqrt(), Foam::sum(), bitSet::test(), WarningInFunction, and Foam::Zero.

Referenced by distanceSurface::createGeometry().

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

◆ TypeName()

TypeName ( "distanceSurface"  )

Runtime type information.

◆ createGeometry()

void createGeometry ( )

Create/recreate the distance surface.

Definition at line 388 of file distanceSurface.C.

References isoSurfaceParams::ALGO_POINT, isoSurfaceParams::algorithm(), GeometricField< Type, PatchField, GeoMesh >::boundaryField(), fvMesh::C(), Foam::calcNormalDistance_filtered(), Foam::calcNormalDistance_nonzero(), Foam::calcNormalDistance_zero(), Foam::checkAllHits(), List< T >::clear(), MeshedSurface< Face >::clear(), PackedList< Width >::clearStorage(), Foam::expressions::patchExpr::debug, Foam::dimLength, Foam::endl(), distanceSurface::filterByProximity(), distanceSurface::filterKeepLargestRegion(), distanceSurface::filterKeepNearestRegions(), searchableSurface::findNearest(), fld, forAll, searchableSurface::getNormal(), MeshObject< polyMesh, UpdateableMeshObject, pointMesh >::New(), isoSurfaceBase::New(), IOobject::NO_READ, IOobject::NO_WRITE, bitSet::none(), primitiveMesh::nPoints(), polyMesh::points(), Foam::Pout, GeometricField< Type, PatchField, GeoMesh >::primitiveFieldRef(), distanceSurface::print(), distanceSurface::refineBlockedCells(), fvMesh::time(), Time::timeName(), List< T >::transfer(), MeshedSurface< Face >::transfer(), Ostream::write(), and Foam::Zero.

Referenced by sampledDistanceSurface::update().

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

◆ surfaceName()

const word& surfaceName ( ) const
inline

The name of the underlying searchableSurface.

Definition at line 383 of file distanceSurface.H.

Referenced by distanceSurface::filterByProximity().

Here is the caller graph for this function:

◆ distance()

scalar distance ( ) const
inlinenoexcept

The distance to the underlying searchableSurface.

Definition at line 389 of file distanceSurface.H.

◆ surface() [1/2]

const meshedSurface& surface ( ) const
inline

The underlying surface.

Definition at line 395 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 405 of file distanceSurface.H.

◆ meshCells() [1/2]

const labelList& meshCells ( ) const
inline

For each face, the original cell in mesh.

Definition at line 415 of file distanceSurface.H.

◆ meshCells() [2/2]

labelList& meshCells ( )
inline

For each face, the original cell in mesh.

Definition at line 425 of file distanceSurface.H.

◆ print()

void print ( Ostream os) const

Print information.

Definition at line 694 of file distanceSurface.C.

References Foam::distance().

Referenced by distanceSurface::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: