sampledSurface Class Referenceabstract

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

Inheritance diagram for sampledSurface:
[legend]
Collaboration diagram for sampledSurface:
[legend]

Classes

class  iNew
 PtrList read-construction helper. More...
 
class  iNewCapture
 

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static const wordList surfaceFieldTypes
 Class names for surface field types. More...
 

Protected Member Functions

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

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. More...
 
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. More...
 
template<class Type >
static tmp< GeometricField< Type, fvPatchField, volMesh > > pointAverage (const GeometricField< Type, pointPatchField, pointMesh > &pfld)
 Create cell values by averaging the point values. More...
 

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 121 of file sampledSurface.H.

Constructor & Destructor Documentation

◆ sampledSurface() [1/3]

sampledSurface ( const word name,
std::nullptr_t   
)
explicitprotected

Construct null.

Definition at line 92 of file sampledSurface.C.

◆ sampledSurface() [2/3]

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

Construct from name, mesh.

Definition at line 104 of file sampledSurface.C.

◆ sampledSurface() [3/3]

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

Construct from dictionary.

Definition at line 120 of file sampledSurface.C.

◆ ~sampledSurface()

~sampledSurface ( )
virtual

Destructor - calls clearGeom()

Definition at line 137 of file sampledSurface.C.

Member Function Documentation

◆ sampleOnFaces() [1/2]

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

Loop for sampling volume elements to faces.

The defaultValue is used for invalid (negative) elements

◆ sampleOnPoints() [1/2]

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

Loop for interpolating volume elements to face points.

◆ pointAverage() [1/2]

static tmp<GeometricField<Type, fvPatchField, volMesh> > pointAverage ( const GeometricField< Type, pointPatchField, pointMesh > &  pfld)
staticprotected

Create cell values by averaging the point values.

◆ clearGeom()

void clearGeom ( ) const
protectedvirtual

Additional cleanup when clearing the geometry.

Definition at line 53 of file sampledSurface.C.

Referenced by sampledCuttingSurface::expire(), sampledFaceZone::expire(), sampledPlane::expire(), sampledPatch::expire(), sampledCuttingPlane::expire(), sampledMeshedSurface::expire(), sampledIsoSurface::expire(), sampledCuttingSurface::update(), and sampledPlane::update().

Here is the caller graph for this function:

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

◆ clone()

autoPtr<sampledSurface> clone ( ) const
inline

Clone.

Definition at line 289 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 62 of file sampledSurface.C.

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

Referenced by sampledSurface::iNew::operator()(), sampledSurface::iNewCapture::operator()(), sampledSurfaces::read(), and surfaceFieldValue::read().

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 316 of file sampledSurface.H.

Referenced by sampledSurface::getSurfMesh(), sampledPatch::patchIDs(), and sampledFaceZone::zoneIDs().

Here is the caller graph for this function:

◆ name()

const word& name ( ) const
inlinenoexcept

Name of surface.

Definition at line 322 of file sampledSurface.H.

Referenced by sampledSurface::getSurfMesh(), sampledSurface::iNew::operator()(), sampledSurface::iNewCapture::operator()(), and sampledPatchInternalField::print().

Here is the caller graph for this function:

◆ enabled()

bool enabled ( ) const
inlinenoexcept

Surface is enabled.

Definition at line 328 of file sampledSurface.H.

Referenced by sampledSurfaces::read().

Here is the caller graph for this function:

◆ invariant()

bool invariant ( ) const
inlinenoexcept

Surface is invariant with geometry change (caution)

Definition at line 334 of file sampledSurface.H.

◆ isPointData() [1/2]

bool isPointData ( ) const
inlinenoexcept

Using interpolation to surface points.

Definition at line 340 of file sampledSurface.H.

◆ isPointData() [2/2]

bool isPointData ( const bool  on)
virtual

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

Returns
old value

Definition at line 156 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 sampledIsoSurface, sampledMeshedSurface, sampledCuttingPlane, sampledDistanceSurface, sampledPatch, sampledPlane, sampledThresholdCellFaces, sampledFaceZone, sampledCuttingSurface, sampledInterface, and sampledNone.

◆ update()

virtual bool update ( )
pure virtual

Update the surface as required.

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

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

◆ points()

◆ faces()

◆ Sf()

◆ magSf()

◆ Cf()

◆ area()

Foam::scalar area ( ) const

The total surface area.

Definition at line 145 of file sampledSurface.C.

References Foam::gSum().

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 380 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 35 of file sampledSurfaceRegister.C.

References objectRegistry::getObjectPtr(), and Foam::name().

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

References polySurface::copySurface(), and Foam::name().

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 75 of file sampledSurfaceRegister.C.

References objectRegistry::checkOut().

Here is the call graph for this function:

◆ storeRegistryField() [1/2]

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 182 of file sampledSurfaceTemplates.C.

References polySurface::storeField(), and Foam::HashTableOps::values().

Here is the call graph for this function:

◆ storeRegistryField() [2/2]

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 206 of file sampledSurfaceTemplates.C.

References polySurface::storeField(), and Foam::HashTableOps::values().

Here is the call graph for this function:

◆ getSurfMesh()

Foam::surfMesh * getSurfMesh ( word  lookupName = "") const

Get surface from registry if available.

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

Definition at line 85 of file sampledSurfaceRegister.C.

References objectRegistry::getObjectPtr(), sampledSurface::mesh(), and sampledSurface::name().

Here is the call graph for this function:

◆ storeSurfMesh()

Foam::surfMesh * storeSurfMesh ( word  lookupName = "") const

Copy surface into registry.

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

Definition at line 96 of file sampledSurfaceRegister.C.

References surfMesh::copySurface(), mesh, Foam::name(), and regIOobject::store().

Here is the call graph for this function:

◆ removeSurfMesh()

bool removeSurfMesh ( word  lookupName = "") const

Remove surface from registry.

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

Definition at line 119 of file sampledSurfaceRegister.C.

References objectRegistry::checkOut(), and mesh.

Here is the call graph for this function:

◆ storeSurfMeshField() [1/2]

bool storeSurfMeshField ( const word fieldName,
const dimensionSet dims,
const Field< Type > &  values,
word  lookupName = "" 
) const

Copy/store sampled Face field onto surfMesh (if it exists)

Definition at line 230 of file sampledSurfaceTemplates.C.

References surfMesh::storeField(), and Foam::HashTableOps::values().

Here is the call graph for this function:

◆ storeSurfMeshField() [2/2]

bool storeSurfMeshField ( const word fieldName,
const dimensionSet dims,
Field< Type > &&  values,
word  lookupName = "" 
) const

Move/store sampled Face field onto surfMesh (if it exists)

Definition at line 253 of file sampledSurfaceTemplates.C.

References surfMesh::storeField(), and Foam::HashTableOps::values().

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 sampledPatch, and sampledFaceZone.

Definition at line 164 of file sampledSurface.C.

◆ sample() [6/10]

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

Sample surface field onto surface.

Reimplemented in sampledPatch, and sampledFaceZone.

Definition at line 171 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 sampledPatch, and sampledFaceZone.

Definition at line 181 of file sampledSurface.C.

References NotImplemented.

◆ sample() [8/10]

Sample surface field onto surface.

Reimplemented in sampledPatch, and sampledFaceZone.

Definition at line 191 of file sampledSurface.C.

References NotImplemented.

◆ sample() [9/10]

Foam::tmp< Foam::symmTensorField > sample ( const surfaceSymmTensorField sField) const
virtual

Sample surface field onto surface.

Reimplemented in sampledPatch, and sampledFaceZone.

Definition at line 201 of file sampledSurface.C.

References NotImplemented.

◆ sample() [10/10]

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

Sample surface field onto surface.

Reimplemented in sampledPatch, and sampledFaceZone.

Definition at line 211 of file sampledSurface.C.

References NotImplemented.

◆ 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 583 of file sampledSurface.H.

◆ print()

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

Print information.

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

Definition at line 220 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 598 of file sampledSurface.H.

◆ sampleOnFaces() [2/2]

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

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

Here is the call graph for this function:

◆ sampleOnPoints() [2/2]

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

Definition at line 80 of file sampledSurfaceTemplates.C.

References Foam::exit(), f(), Foam::FatalError, FatalErrorInFunction, forAll, interpolation< Type >::interpolate(), Foam::New(), UList< T >::size(), Foam::HashTableOps::values(), and Foam::Zero.

Here is the call graph for this function:

◆ pointAverage() [2/2]

Definition at line 130 of file sampledSurfaceTemplates.C.

References Foam::dimless, forAll, mesh, Foam::New(), and Foam::Zero.

Here is the call graph for this function:

Member Data Documentation

◆ surfaceFieldTypes

const Foam::wordList surfaceFieldTypes
static

Class names for surface field types.

Definition at line 130 of file sampledSurface.H.


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