Loading...
Searching...
No Matches
sampledSurface Class Referenceabstract

An abstract class for surfaces with sampling. More...

#include <sampledSurface.H>

Inheritance diagram for sampledSurface:
Collaboration diagram for sampledSurface:

Classes

class  iNew
 PtrList read-construction helper. More...
class  iNewCapture
 PtrList read-construction helper that captures dictionaries used during creation. More...

Public Member Functions

 TypeName ("sampledSurface")
 Runtime type information.
 declareRunTimeSelectionTable (autoPtr, sampledSurface, word,(const word &name, const polyMesh &mesh, const dictionary &dict),(name, mesh, dict))
 Declare run-time constructor selection table.
 sampledSurface (const word &name, const polyMesh &mesh, const bool interpolateToPoints=false)
 Construct from name, mesh.
 sampledSurface (const word &name, const polyMesh &mesh, const dictionary &dict)
 Construct from dictionary.
autoPtr< sampledSurfaceclone () const
 Clone.
virtual ~sampledSurface ()
 Destructor - calls clearGeom().
const polyMeshmesh () const noexcept
 Access to the underlying mesh.
const wordname () const noexcept
 Name of surface.
bool enabled () const noexcept
 Surface is enabled.
bool invariant () const noexcept
 Surface is invariant with geometry change (caution).
bool isPointData () const noexcept
 Using interpolation to surface points.
virtual bool isPointData (const bool on)
 Change point/cell representation, may trigger an expire().
virtual bool needsUpdate () const =0
 Does the surface need an update?
virtual bool expire ()=0
 Mark the surface as needing an update.
virtual bool update ()=0
 Update the surface as required.
virtual const pointFieldpoints () const =0
 Points of surface.
virtual const faceListfaces () const =0
 Faces of surface.
virtual const vectorFieldSf () const =0
 Face area vectors.
virtual const scalarFieldmagSf () const =0
 Face area magnitudes.
virtual const vectorFieldCf () const =0
 Face centres.
scalar area () const
 The total surface area.
virtual bool hasFaceIds () const
 If element ids/order of the original surface are available.
polySurfacegetRegistrySurface (const objectRegistry &obr, word lookupName="") const
 Get surface from registry if available.
polySurfacestoreRegistrySurface (objectRegistry &obr, word lookupName="") const
 Copy surface into registry.
bool removeRegistrySurface (objectRegistry &obr, word lookupName="") const
 Remove surface from registry.
template<class Type, class GeoMeshType>
bool storeRegistryField (const objectRegistry &obr, const word &fieldName, const dimensionSet &dims, const Field< Type > &values, word lookupName="") const
 Copy/store sampled field onto registered surface (if it exists).
template<class Type, class GeoMeshType>
bool storeRegistryField (const objectRegistry &obr, const word &fieldName, const dimensionSet &dims, Field< Type > &&values, word lookupName="") const
 Move/store sampled field onto registered surface (if it exists).
virtual tmp< scalarFieldsample (const interpolation< scalar > &sampler) const =0
 Sample volume field onto surface faces.
virtual tmp< vectorFieldsample (const interpolation< vector > &sampler) const =0
 Sample volume field onto surface faces.
virtual tmp< sphericalTensorFieldsample (const interpolation< sphericalTensor > &sampler) const =0
 Sample volume field onto surface faces.
virtual tmp< symmTensorFieldsample (const interpolation< symmTensor > &sampler) const =0
 Sample volume field onto surface faces.
virtual tmp< tensorFieldsample (const interpolation< tensor > &sampler) const =0
 Sample volume field onto surface faces.
virtual bool withSurfaceFields () const
 Can it sample surface-fields?
virtual tmp< scalarFieldsample (const surfaceScalarField &sField) const
 Sample surface field onto surface.
virtual tmp< vectorFieldsample (const surfaceVectorField &sField) const
 Sample surface field onto surface.
virtual tmp< sphericalTensorFieldsample (const surfaceSphericalTensorField &sField) const
 Sample surface field onto surface.
virtual tmp< symmTensorFieldsample (const surfaceSymmTensorField &sField) const
 Sample surface field onto surface.
virtual tmp< tensorFieldsample (const surfaceTensorField &sField) const
 Sample surface field onto surface.
virtual tmp< scalarFieldinterpolate (const interpolation< scalar > &interpolator) const =0
 Interpolate volume field onto surface points.
virtual tmp< vectorFieldinterpolate (const interpolation< vector > &interpolator) const =0
 Interpolate volume field onto surface points.
virtual tmp< sphericalTensorFieldinterpolate (const interpolation< sphericalTensor > &interpolator) const =0
 Interpolate volume field onto surface points.
virtual tmp< symmTensorFieldinterpolate (const interpolation< symmTensor > &interpolator) const =0
 Interpolate volume field onto surface points.
virtual tmp< tensorFieldinterpolate (const interpolation< tensor > &interpolator) const =0
 Interpolate volume field onto surface points.
virtual void rename (const word &newName)
 Rename.
virtual void print (Ostream &os, int level=0) const
 Print information.
bool interpolate () const noexcept
 Same as isPointData().
template<class Type>
Foam::tmp< Foam::Field< Type > > sampleOnFaces (const interpolation< Type > &sampler, const labelUList &elements, const faceList &fcs, const pointField &pts, const Type &defaultValue)
template<class Type>
Foam::tmp< Foam::Field< Type > > sampleOnPoints (const interpolation< Type > &interpolator, const labelUList &elements, const faceList &fcs, const pointField &pts)
template<class Type>
Foam::tmp< Foam::VolumeField< Type > > pointAverage (const PointField< Type > &pfld)
Public Member Functions inherited from meshedSurf
constexpr meshedSurf () noexcept=default
 Default construct.
virtual ~meshedSurf ()=default
 Destructor.
virtual const labelListzoneIds () const
 Per-face zone/region information.
virtual const labelListfaceIds () const
 Per-face identifier (eg, element Id).

Static Public Member Functions

static autoPtr< sampledSurfaceNew (const word &name, const polyMesh &mesh, const dictionary &dict)
 Return a reference to the selected surface.

Protected Member Functions

virtual void clearGeom () const
 Additional cleanup when clearing the geometry.
 sampledSurface (const word &name, std::nullptr_t)
 Construct null.

Static Protected Member Functions

template<class Type>
static tmp< Field< Type > > sampleOnFaces (const interpolation< Type > &sampler, const labelUList &elements, const faceList &fcs, const pointField &pts, const Type &defaultValue=Type(Zero))
 Loop for sampling volume elements to faces.
template<class Type>
static tmp< Field< Type > > sampleOnPoints (const interpolation< Type > &interpolator, const labelUList &elements, const faceList &fcs, const pointField &pts)
 Loop for interpolating volume elements to face points.
template<class Type>
static tmp< VolumeField< Type > > pointAverage (const PointField< Type > &pfld)
 Create cell values by averaging the point values.

Detailed Description

An abstract class for surfaces with sampling.

The constructors for the derived classes should generally start in a 'expired' condition (ie, needsUpdate() == true) and rely on a subsequent call to the update() method to complete the initialization. Delaying the final construction as late as possible allows the construction of surfaces that may depend on intermediate calculation results (eg, iso-surfaces) and also avoids the unnecessary reconstruction of surfaces between sampling intervals.

It is the responsibility of the caller to ensure that the surface update() is called before the surface is used. The update() method implementation should do nothing when the surface is already up-to-date.

Any sampler is assumed to work for the standard volume field types. Some may also support surface fields.

Dictionary entries:

Property Description Required Default
name Alternative name no
enabled Enable/disable the surface? no yes
interpolate Interpolate to nodes instead of faces no false
invariant Invariant with geometry change (use with caution!) no false
Note
The invariant switch is an advanced feature to declare that the surface is unaffected by changes in the general mesh geometry. For example, if sampling on a static patch while some other motion occurs elsewhere. If used improperly, there is a significant possibility for problems (caveat emptor).
Source files

Definition at line 116 of file sampledSurface.H.

Constructor & Destructor Documentation

◆ sampledSurface() [1/3]

◆ sampledSurface() [2/3]

sampledSurface ( const word & name,
const polyMesh & mesh,
const bool interpolateToPoints = false )

Construct from name, mesh.

Definition at line 86 of file sampledSurface.C.

References mesh(), and name().

Here is the call graph for this function:

◆ sampledSurface() [3/3]

sampledSurface ( const word & name,
const polyMesh & mesh,
const dictionary & dict )

Construct from dictionary.

Definition at line 102 of file sampledSurface.C.

References dict, mesh(), and name().

Here is the call graph for this function:

◆ ~sampledSurface()

~sampledSurface ( )
virtual

Destructor - calls clearGeom().

Definition at line 120 of file sampledSurface.C.

References clearGeom().

Here is the call graph for this function:

Member Function Documentation

◆ sampleOnFaces() [1/2]

template<class Type>
tmp< Field< Type > > sampleOnFaces ( const interpolation< Type > & sampler,
const labelUList & elements,
const faceList & fcs,
const pointField & pts,
const Type & defaultValue = Type(Zero) )
staticprotected

◆ sampleOnPoints() [1/2]

template<class Type>
tmp< Field< Type > > sampleOnPoints ( const interpolation< Type > & interpolator,
const labelUList & elements,
const faceList & fcs,
const pointField & pts )
staticprotected

◆ pointAverage() [1/2]

template<class Type>
tmp< VolumeField< Type > > pointAverage ( const PointField< Type > & pfld)
staticprotected

Create cell values by averaging the point values.

References name().

Referenced by sampledCuttingPlane::sampleOnIsoSurfacePoints(), sampledDistanceSurface::sampleOnIsoSurfacePoints(), and sampledIsoSurface::sampleOnIsoSurfacePoints().

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

◆ clearGeom()

◆ TypeName()

TypeName ( "sampledSurface" )

Runtime type information.

◆ declareRunTimeSelectionTable()

declareRunTimeSelectionTable ( autoPtr ,
sampledSurface ,
word ,
(const word &name, const polyMesh &mesh, const dictionary &dict) ,
(name, mesh, dict)  )

Declare run-time constructor selection table.

References dict, mesh(), name(), and sampledSurface().

Here is the call graph for this function:

◆ clone()

autoPtr< sampledSurface > clone ( ) const
inline

Clone.

Definition at line 317 of file sampledSurface.H.

References NotImplemented.

◆ New()

Foam::autoPtr< Foam::sampledSurface > New ( const word & name,
const polyMesh & mesh,
const dictionary & dict )
static

Return a reference to the selected surface.

Definition at line 44 of file sampledSurface.C.

References DebugInfo, dict, Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInLookup, mesh(), and name().

Referenced by sampledSurface::iNew::operator()(), sampledSurface::iNewCapture::operator()(), sampledSurfaces::read(), sampledFaceZone::sampleOnFaces(), sampledMeshedSurface::sampleOnFaces(), sampledPatch::sampleOnFaces(), and sampleOnFaces().

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

◆ mesh()

const polyMesh & mesh ( ) const
inlinenoexcept

Access to the underlying mesh.

Definition at line 350 of file sampledSurface.H.

References Foam::noexcept.

Referenced by declareRunTimeSelectionTable(), sampledSurface::iNew::iNew(), sampledSurface::iNewCapture::iNewCapture(), New(), pointAverage(), sampledCuttingPlane::sampledCuttingPlane(), sampledCuttingSurface::sampledCuttingSurface(), sampledCuttingSurface::sampledCuttingSurface(), sampledDistanceSurface::sampledDistanceSurface(), sampledDistanceSurface::sampledDistanceSurface(), sampledFaceZone::sampledFaceZone(), sampledFaceZone::sampledFaceZone(), sampledInterface::sampledInterface(), sampledIsoSurface::sampledIsoSurface(), sampledIsoSurface::sampledIsoSurface(), sampledIsoSurfaceCell::sampledIsoSurfaceCell(), sampledIsoSurfacePoint::sampledIsoSurfacePoint(), sampledIsoSurfaceTopo::sampledIsoSurfaceTopo(), sampledMeshedSurface::sampledMeshedSurface(), sampledMeshedSurface::sampledMeshedSurface(), sampledMeshedSurfaceNormal::sampledMeshedSurfaceNormal(), sampledMeshedSurfaceNormal::sampledMeshedSurfaceNormal(), sampledNone::sampledNone(), sampledPatch::sampledPatch(), sampledPatch::sampledPatch(), sampledPatchInternalField::sampledPatchInternalField(), sampledPlane::sampledPlane(), sampledPlane::sampledPlane(), sampledSurface(), sampledSurface(), sampledThresholdCellFaces::sampledThresholdCellFaces(), sampledFaceZone::sampleOnFaces(), sampledMeshedSurface::sampleOnFaces(), sampledCuttingPlane::TypeName(), sampledCuttingSurface::TypeName(), sampledDistanceSurface::TypeName(), sampledFaceZone::TypeName(), sampledInterface::TypeName(), sampledIsoSurface::TypeName(), sampledMeshedSurface::TypeName(), sampledMeshedSurfaceNormal::TypeName(), sampledPatch::TypeName(), sampledPatchInternalField::TypeName(), sampledPlane::TypeName(), sampledIsoSurfaceCell::TypeNameNoDebug(), sampledIsoSurfacePoint::TypeNameNoDebug(), and sampledIsoSurfaceTopo::TypeNameNoDebug().

Here is the caller graph for this function:

◆ name()

◆ enabled()

bool enabled ( ) const
inlinenoexcept

Surface is enabled.

Definition at line 366 of file sampledSurface.H.

References Foam::noexcept.

◆ invariant()

bool invariant ( ) const
inlinenoexcept

Surface is invariant with geometry change (caution).

Definition at line 374 of file sampledSurface.H.

References Foam::noexcept.

◆ isPointData() [1/2]

bool isPointData ( ) const
inlinenoexcept

Using interpolation to surface points.

Definition at line 382 of file sampledSurface.H.

References Foam::noexcept.

◆ isPointData() [2/2]

bool isPointData ( const bool on)
virtual

Change point/cell representation, may trigger an expire().

Returns
old value

Definition at line 139 of file sampledSurface.C.

◆ needsUpdate()

◆ expire()

virtual bool expire ( )
pure virtual

Mark the surface as needing an update.

May also free up unneeded data. Return false if surface was already marked as expired.

Implemented in sampledCuttingPlane, sampledCuttingSurface, sampledDistanceSurface, sampledFaceZone, sampledInterface, sampledIsoSurface, sampledMeshedSurface, sampledNone, sampledPatch, sampledPlane, and sampledThresholdCellFaces.

◆ update()

virtual bool update ( )
pure virtual

Update the surface as required.

Do nothing (and return false) if no update was required

Implemented in sampledCuttingPlane, sampledCuttingSurface, sampledDistanceSurface, sampledFaceZone, sampledInterface, sampledIsoSurface, sampledMeshedSurface, sampledNone, sampledPatch, sampledPlane, and sampledThresholdCellFaces.

◆ points()

◆ faces()

◆ Sf()

◆ magSf()

virtual const scalarField & magSf ( ) const
pure virtual

◆ Cf()

◆ area()

Foam::scalar area ( ) const

The total surface area.

Definition at line 128 of file sampledSurface.C.

References Foam::gSum(), and magSf().

Here is the call graph for this function:

◆ hasFaceIds()

virtual bool hasFaceIds ( ) const
inlinevirtual

If element ids/order of the original surface are available.

Reimplemented in sampledMeshedSurface.

Definition at line 447 of file sampledSurface.H.

◆ getRegistrySurface()

Foam::polySurface * getRegistrySurface ( const objectRegistry & obr,
word lookupName = "" ) const

Get surface from registry if available.

Parameters
obrThe objectRegistry to use
lookupNameOptional lookup name, use surface name if empty
Returns
surface or nullptr

Definition at line 26 of file sampledSurfaceRegister.C.

References objectRegistry::getObjectPtr().

Referenced by storeRegistryField(), and storeRegistryField().

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

◆ storeRegistrySurface()

Foam::polySurface * storeRegistrySurface ( objectRegistry & obr,
word lookupName = "" ) const

Copy surface into registry.

Parameters
obrThe objectRegistry to use
lookupNameOptional lookup name, use surface name if empty
Returns
surface or nullptr it surface should not be stored

Definition at line 41 of file sampledSurfaceRegister.C.

References polySurface::copySurface(), objectRegistry::getObjectPtr(), name, and regIOobject::store().

Here is the call graph for this function:

◆ removeRegistrySurface()

bool removeRegistrySurface ( objectRegistry & obr,
word lookupName = "" ) const

Remove surface from registry.

Parameters
obrThe objectRegistry to use
lookupNameOptional lookup name, use surface name if empty
Returns
True if surface existed and was removed

Definition at line 67 of file sampledSurfaceRegister.C.

References polySurface::Delete().

Here is the call graph for this function:

◆ storeRegistryField() [1/2]

template<class Type, class GeoMeshType>
bool storeRegistryField ( const objectRegistry & obr,
const word & fieldName,
const dimensionSet & dims,
const Field< Type > & values,
word lookupName = "" ) const

Copy/store sampled field onto registered surface (if it exists).

Definition at line 174 of file sampledSurfaceTemplates.C.

References getRegistrySurface(), and polySurface::storeField().

Here is the call graph for this function:

◆ storeRegistryField() [2/2]

template<class Type, class GeoMeshType>
bool storeRegistryField ( const objectRegistry & obr,
const word & fieldName,
const dimensionSet & dims,
Field< Type > && values,
word lookupName = "" ) const

Move/store sampled field onto registered surface (if it exists).

Definition at line 198 of file sampledSurfaceTemplates.C.

References getRegistrySurface(), and polySurface::storeField().

Here is the call graph for this function:

◆ sample() [1/10]

◆ sample() [2/10]

◆ sample() [3/10]

◆ sample() [4/10]

◆ sample() [5/10]

◆ withSurfaceFields()

bool withSurfaceFields ( ) const
virtual

Can it sample surface-fields?

Reimplemented in sampledFaceZone, and sampledPatch.

Definition at line 147 of file sampledSurface.C.

◆ sample() [6/10]

Foam::tmp< Foam::scalarField > sample ( const surfaceScalarField & sField) const
virtual

Sample surface field onto surface.

Reimplemented in sampledFaceZone, and sampledPatch.

Definition at line 153 of file sampledSurface.C.

References NotImplemented.

◆ sample() [7/10]

Foam::tmp< Foam::vectorField > sample ( const surfaceVectorField & sField) const
virtual

Sample surface field onto surface.

Reimplemented in sampledFaceZone, and sampledPatch.

Definition at line 163 of file sampledSurface.C.

References NotImplemented.

◆ sample() [8/10]

Foam::tmp< Foam::tensorField > sample ( const surfaceSphericalTensorField & sField) const
virtual

Sample surface field onto surface.

Reimplemented in sampledFaceZone, sampledFaceZone, sampledFaceZone, sampledPatch, sampledPatch, and sampledPatch.

Definition at line 173 of file sampledSurface.C.

References NotImplemented.

◆ sample() [9/10]

virtual tmp< symmTensorField > sample ( const surfaceSymmTensorField & sField) const
virtual

Sample surface field onto surface.

Reimplemented in sampledFaceZone, sampledFaceZone, sampledFaceZone, sampledPatch, sampledPatch, and sampledPatch.

◆ sample() [10/10]

virtual tmp< tensorField > sample ( const surfaceTensorField & sField) const
virtual

Sample surface field onto surface.

Reimplemented in sampledFaceZone, sampledFaceZone, sampledFaceZone, sampledPatch, sampledPatch, and sampledPatch.

◆ interpolate() [1/6]

◆ interpolate() [2/6]

◆ interpolate() [3/6]

◆ interpolate() [4/6]

◆ interpolate() [5/6]

◆ rename()

virtual void rename ( const word & newName)
inlinevirtual

Rename.

Definition at line 659 of file sampledSurface.H.

◆ print()

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

Print information.

Reimplemented in sampledCuttingPlane, sampledDistanceSurface, sampledFaceZone, sampledInterface, sampledIsoSurface, sampledMeshedSurface, sampledPatch, sampledPatchInternalField, sampledPlane, and sampledThresholdCellFaces.

Definition at line 203 of file sampledSurface.C.

References os(), and Foam::type().

Here is the call graph for this function:

◆ interpolate() [6/6]

bool interpolate ( ) const
inlinenoexcept

Same as isPointData().

Definition at line 678 of file sampledSurface.H.

References Foam::noexcept.

◆ sampleOnFaces() [2/2]

template<class Type>
Foam::tmp< Foam::Field< Type > > sampleOnFaces ( const interpolation< Type > & sampler,
const labelUList & elements,
const faceList & fcs,
const pointField & pts,
const Type & defaultValue )

Definition at line 28 of file sampledSurfaceTemplates.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, interpolation< Type >::interpolate(), New(), pts, and UList< T >::size().

Here is the call graph for this function:

◆ sampleOnPoints() [2/2]

template<class Type>
Foam::tmp< Foam::Field< Type > > sampleOnPoints ( const interpolation< Type > & interpolator,
const labelUList & elements,
const faceList & fcs,
const pointField & pts )

◆ pointAverage() [2/2]

template<class Type>
Foam::tmp< Foam::VolumeField< Type > > pointAverage ( const PointField< Type > & pfld)

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