Sampled< Type > Class Template Reference

PatchFunction1 to sample an existing field. More...

Inheritance diagram for Sampled< Type >:
[legend]
Collaboration diagram for Sampled< Type >:
[legend]

Public Member Functions

 TypeName ("sampled")
 
 Sampled (const polyPatch &pp, const word &type, const word &entryName, const dictionary &dict, const bool faceValues=true)
 Construct from entry name and dictionary. More...
 
 Sampled (const Sampled< Type > &ut)
 Copy constructor. More...
 
 Sampled (const Sampled< Type > &ut, const polyPatch &pp)
 Copy constructor setting patch. More...
 
virtual tmp< PatchFunction1< Type > > clone () const
 Construct and return a clone. More...
 
virtual tmp< PatchFunction1< Type > > clone (const polyPatch &pp) const
 Construct and return a clone setting patch. More...
 
virtual ~Sampled ()=default
 Destructor. More...
 
const GeometricField< Type, fvPatchField, volMesh > & sampleField () const
 Field to sample. Either on my or nbr mesh. More...
 
virtual tmp< Field< Type > > value (const scalar x) const
 Return sampled value. More...
 
virtual bool constant () const
 Is value constant (i.e. independent of x) More...
 
virtual bool uniform () const
 Is value uniform (i.e. independent of coordinate) More...
 
virtual tmp< Field< Type > > integrate (const scalar x1, const scalar x2) const
 Integrate between two values. More...
 
virtual void writeData (Ostream &os) const
 Write in dictionary format. More...
 
- Public Member Functions inherited from PatchFunction1< Type >
 TypeName ("PatchFunction1") declareRunTimeSelectionTable(autoPtr
 Runtime type information. More...
 
 PatchFunction1 (const polyPatch &pp, const word &entryName, const bool faceValues=true)
 Construct from polyPatch and entry name. More...
 
 PatchFunction1 (const polyPatch &pp, const word &entryName, const dictionary &dict, const bool faceValues=true)
 Construct from polyPatch, dictionary and entry name. More...
 
 PatchFunction1 (const PatchFunction1< Type > &pf1)
 Copy constructor. More...
 
 PatchFunction1 (const PatchFunction1< Type > &pf1, const polyPatch &pp)
 Copy constructor setting patch. More...
 
virtual ~PatchFunction1 ()=default
 Destructor. More...
 
const wordname () const
 Return the name of the entry. More...
 
virtual void convertTimeBase (const Time &t)
 Convert time. More...
 
virtual tmp< pointFieldlocalPosition (const pointField &globalPos) const
 Helper: optionally convert coordinates to local coordinates. More...
 
virtual tmp< Field< Type > > transform (const Field< Type > &fld) const
 Apply optional transformation. More...
 
virtual tmp< Field< Type > > transform (const tmp< Field< Type >> &tfld) const
 Apply optional transformation. More...
 
virtual void autoMap (const FieldMapper &mapper)
 Map (and resize as needed) from self given a mapping object. More...
 
virtual void rmap (const PatchFunction1< Type > &pf1, const labelList &addr)
 Reverse map the given PatchFunction1 onto this PatchFunction1. More...
 
- Public Member Functions inherited from mappedPatchBase
 TypeName ("mappedPatchBase")
 Runtime type information. More...
 
 mappedPatchBase (const polyPatch &)
 Construct from patch. More...
 
 mappedPatchBase (const polyPatch &pp, const word &sampleRegion, const sampleMode sampleMode, const word &samplePatch, const vectorField &offsets)
 Construct with offsetMode=non-uniform. More...
 
 mappedPatchBase (const polyPatch &pp, const word &sampleRegion, const sampleMode sampleMode, const word &samplePatch, const vector &offset)
 Construct from offsetMode=uniform. More...
 
 mappedPatchBase (const polyPatch &pp, const word &sampleRegion, const sampleMode sampleMode, const word &samplePatch, const scalar distance)
 Construct from offsetMode=normal and distance. More...
 
 mappedPatchBase (const polyPatch &, const dictionary &)
 Construct from dictionary. More...
 
 mappedPatchBase (const polyPatch &, const sampleMode, const dictionary &)
 Construct from dictionary and (collocated) sample mode. More...
 
 mappedPatchBase (const polyPatch &, const mappedPatchBase &)
 Construct as copy, resetting patch. More...
 
 mappedPatchBase (const polyPatch &, const mappedPatchBase &, const labelUList &mapAddressing)
 Construct as copy, resetting patch, map original data. More...
 
virtual ~mappedPatchBase ()
 Destructor. More...
 
void clearOut ()
 
const sampleModemode () const
 What to sample. More...
 
const wordsampleRegion () const
 Region to sample. More...
 
const wordsamplePatch () const
 Patch (only if NEARESTPATCHFACE) More...
 
const wordcoupleGroup () const
 PatchGroup (only if NEARESTPATCHFACE) More...
 
label sampleSize () const
 Return size of mapped mesh/patch/boundary. More...
 
const vectoroffset () const
 Offset vector (from patch faces to destination mesh objects) More...
 
const vectorFieldoffsets () const
 Offset vector (from patch faces to destination mesh objects) More...
 
bool sameRegion () const
 Cached sampleRegion != mesh.name() More...
 
const mapDistributemap () const
 Return reference to the parallel distribution map. More...
 
const AMIPatchToPatchInterpolationAMI (const bool forceUpdate=false) const
 Return reference to the AMI interpolator. More...
 
const autoPtr< Foam::searchableSurface > & surfPtr () const
 Return a pointer to the AMI projection surface. More...
 
const polyMeshsampleMesh () const
 Get the region mesh. More...
 
const polyPatchsamplePolyPatch () const
 Get the patch on the region. More...
 
tmp< pointFieldsamplePoints () const
 Get the sample points. More...
 
template<class Type >
void distribute (List< Type > &lst) const
 Wrapper around map/interpolate data distribution. More...
 
template<class Type , class CombineOp >
void distribute (List< Type > &lst, const CombineOp &cop) const
 Wrapper around map/interpolate data distribution with operation. More...
 
template<class Type >
void reverseDistribute (List< Type > &lst) const
 Wrapper around map/interpolate data distribution. More...
 
template<class Type , class CombineOp >
void reverseDistribute (List< Type > &lst, const CombineOp &cop) const
 Wrapper around map/interpolate data distribution with operation. More...
 
virtual void write (Ostream &) const
 Write as a dictionary. More...
 

Protected Member Functions

bool haveSampleField () const
 Field to sample. Either on my or nbr mesh. More...
 
void operator= (const Sampled< Type > &)=delete
 No copy assignment. More...
 
- Protected Member Functions inherited from mappedPatchBase
tmp< pointFieldfacePoints (const polyPatch &) const
 Get the points from face-centre-decomposition face centres. More...
 
void collectSamples (const pointField &facePoints, pointField &, labelList &patchFaceProcs, labelList &patchFaces, pointField &patchFc) const
 Collect single list of samples and originating processor+face. More...
 
void findSamples (const sampleMode mode, const pointField &, labelList &sampleProcs, labelList &sampleIndices, pointField &sampleLocations) const
 Find cells/faces containing samples. More...
 
tmp< pointFieldsamplePoints (const pointField &) const
 Get the sample points given the face points. More...
 
void calcMapping () const
 Calculate mapping. More...
 
void calcAMI () const
 Calculate AMI interpolator. More...
 

Protected Attributes

word fieldName_
 Name of the field. More...
 
const bool setAverage_
 If true adjust the mapped field to maintain average value average_. More...
 
const Type average_
 
word interpolationScheme_
 Interpolation scheme to use for nearestcell mode. More...
 
- Protected Attributes inherited from PatchFunction1< Type >
const word name_
 Name of entry. More...
 
const polyPatchpatch_
 Reference to the patch. More...
 
const bool faceValues_
 Whether to generate face or point values on patch. More...
 
coordinateScaling< Type > coordSys_
 Optional local co-ordinate system and scaling. More...
 
- Protected Attributes inherited from mappedPatchBase
const polyPatchpatch_
 Patch to sample. More...
 
word sampleRegion_
 Region to sample. More...
 
const sampleMode mode_
 What to sample. More...
 
word samplePatch_
 Patch (if in sampleMode NEARESTPATCH*) More...
 
const coupleGroupIdentifier coupleGroup_
 PatchGroup (if in sampleMode NEARESTPATCH*) More...
 
offsetMode offsetMode_
 How to obtain samples. More...
 
vector offset_
 Offset vector (uniform) More...
 
vectorField offsets_
 Offset vector (nonuniform) More...
 
scalar distance_
 Offset distance (normal) More...
 
bool sameRegion_
 Same region. More...
 
autoPtr< mapDistributemapPtr_
 Communication schedule: More...
 
autoPtr< AMIPatchToPatchInterpolationAMIPtr_
 Pointer to AMI interpolator. More...
 
const bool AMIReverse_
 Flag to indicate that slave patch should be reversed for AMI. More...
 
autoPtr< searchableSurfacesurfPtr_
 Pointer to projection surface employed by AMI interpolator. More...
 
dictionary surfDict_
 Dictionary storing projection surface description. More...
 

Additional Inherited Members

- Public Types inherited from PatchFunction1< Type >
typedef Field< Type > returnType
 
- Public Types inherited from mappedPatchBase
enum  sampleMode {
  NEARESTCELL, NEARESTPATCHFACE, NEARESTPATCHFACEAMI, NEARESTPATCHPOINT,
  NEARESTFACE, NEARESTONLYCELL
}
 Mesh items to sample. More...
 
enum  offsetMode { UNIFORM, NONUNIFORM, NORMAL }
 How to project face centres. More...
 
typedef Tuple2< pointIndexHit, Tuple2< scalar, label > > nearInfo
 Helper class for finding nearest. More...
 
- Static Public Member Functions inherited from PatchFunction1< Type >
static autoPtr< PatchFunction1< Type > > New (const polyPatch &pp, const word &entryName, const dictionary &dict, const bool faceValues=true)
 Selector. More...
 
- Static Public Member Functions inherited from mappedPatchBase
static pointIndexHit facePoint (const polyMesh &, const label facei, const polyMesh::cellDecomposition)
 Get a point on the face given a face decomposition method: More...
 
- Public Attributes inherited from PatchFunction1< Type >
 PatchFunction1
 
 dictionary
 
const polyPatchpp
 
const polyPatch const wordtype
 
const polyPatch const word const wordentryName
 
const polyPatch const word const word const dictionarydict
 
const polyPatch const word const word const dictionary const bool faceValues
 
const polyPatch const word const word const dictionary const bool pp
 
const polyPatch const word const word const dictionary const bool type
 
const polyPatch const word const word const dictionary const bool entryName
 
const polyPatch const word const word const dictionary const bool dict
 
- Static Public Attributes inherited from mappedPatchBase
static const Enum< sampleModesampleModeNames_
 
static const Enum< offsetModeoffsetModeNames_
 
- Static Protected Member Functions inherited from mappedPatchBase
static tmp< pointFieldreadListOrField (const word &keyword, const dictionary &dict, const label size)
 Helper to read field or non-uniform list from dictionary. More...
 

Detailed Description

template<class Type>
class Foam::PatchFunction1Types::Sampled< Type >

PatchFunction1 to sample an existing field.

It is the exact functionality from mappedField boundary condition with the following differences:

  • the field name is specified. So any derived fields will have the same field name to sample.
  • if used with uniformFixedValue boundary condition there is the problem that that re-evaluates instead of reading/mapping.
Usage
Property Description Required Default value
field Field name yes
sampleMode how to obtain samples yes
sampleRegion mesh to sample no ""
samplePatch patch to sample no ""
offsetMode how to offset samples no uniform
offset uniform offset vector no (0 0 0)
interpolationScheme interpolation method yes cell
setAverage optional average adjustment no false
average optional average value no

Example of the boundary condition specification:

    <patchName>
    {
        // Field to sample
        field           U;

        // Geometric/mapping info (equivalent of 'mappedPatch' patch type)
        sampleMode      nearestCell;
        offset          (0 -0.001 0);

        // Field specific info (equivalent of 'mappedField' patch field type)
        interpolationScheme cell;
    }
Source files

Definition at line 142 of file Sampled.H.

Constructor & Destructor Documentation

◆ Sampled() [1/3]

Sampled ( const polyPatch pp,
const word type,
const word entryName,
const dictionary dict,
const bool  faceValues = true 
)

Construct from entry name and dictionary.

Definition at line 54 of file Sampled.C.

References dict, and Foam::mode().

Here is the call graph for this function:

◆ Sampled() [2/3]

Sampled ( const Sampled< Type > &  ut)
explicit

Copy constructor.

Definition at line 78 of file Sampled.C.

◆ Sampled() [3/3]

Sampled ( const Sampled< Type > &  ut,
const polyPatch pp 
)
explicit

Copy constructor setting patch.

Definition at line 93 of file Sampled.C.

◆ ~Sampled()

virtual ~Sampled ( )
virtualdefault

Destructor.

Member Function Documentation

◆ haveSampleField()

bool haveSampleField ( ) const
protected

Field to sample. Either on my or nbr mesh.

Definition at line 130 of file Sampled.C.

References polyMesh::boundaryMesh(), and polyBoundaryMesh::mesh().

Here is the call graph for this function:

◆ operator=()

void operator= ( const Sampled< Type > &  )
protecteddelete

No copy assignment.

◆ TypeName()

TypeName ( "sampled"  )

◆ clone() [1/2]

virtual tmp<PatchFunction1<Type> > clone ( ) const
inlinevirtual

Construct and return a clone.

Implements PatchFunction1< Type >.

Definition at line 209 of file Sampled.H.

◆ clone() [2/2]

virtual tmp<PatchFunction1<Type> > clone ( const polyPatch pp) const
inlinevirtual

Construct and return a clone setting patch.

Implements PatchFunction1< Type >.

Definition at line 218 of file Sampled.H.

References PatchFunction1< Type >::pp.

◆ sampleField()

const Foam::GeometricField< Type, Foam::fvPatchField, Foam::volMesh > & sampleField ( ) const

Field to sample. Either on my or nbr mesh.

Definition at line 111 of file Sampled.C.

References polyMesh::boundaryMesh(), and polyBoundaryMesh::mesh().

Here is the call graph for this function:

◆ value()

Foam::tmp< Foam::Field< Type > > value ( const scalar  x) const
virtual

Return sampled value.

Reimplemented from PatchFunction1< Type >.

Definition at line 151 of file Sampled.C.

References Foam::abort(), polyMesh::boundaryMesh(), mapDistribute::distribute(), Foam::FatalError, FatalErrorInFunction, polyBoundaryMesh::findPatchID(), forAll, Foam::gAverage(), Foam::gSum(), Foam::mag(), Foam::max(), mesh, Foam::mode(), primitiveMesh::nCells(), Foam::New(), primitiveMesh::nFaces(), Foam::nl, Foam::returnReduce(), mapDistribute::reverseDistribute(), samples(), Foam::transform(), and Foam::Zero.

Here is the call graph for this function:

◆ constant()

virtual bool constant ( ) const
inlinevirtual

Is value constant (i.e. independent of x)

Implements PatchFunction1< Type >.

Definition at line 242 of file Sampled.H.

◆ uniform()

virtual bool uniform ( ) const
inlinevirtual

Is value uniform (i.e. independent of coordinate)

Implements PatchFunction1< Type >.

Definition at line 248 of file Sampled.H.

◆ integrate()

Foam::tmp< Foam::Field< Type > > integrate ( const scalar  x1,
const scalar  x2 
) const
virtual

Integrate between two values.

Reimplemented from PatchFunction1< Type >.

Definition at line 322 of file Sampled.C.

References NotImplemented.

◆ writeData()

void writeData ( Ostream os) const
virtual

Write in dictionary format.

Reimplemented from PatchFunction1< Type >.

Definition at line 334 of file Sampled.C.

References Foam::name(), Foam::vtk::write(), writeData(), and Ostream::writeEntry().

Here is the call graph for this function:

Member Data Documentation

◆ fieldName_

word fieldName_
protected

Name of the field.

Definition at line 158 of file Sampled.H.

◆ setAverage_

const bool setAverage_
protected

If true adjust the mapped field to maintain average value average_.

Definition at line 161 of file Sampled.H.

◆ average_

const Type average_
protected

Average value the mapped field is adjusted to maintain if setAverage_ is set true

Definition at line 165 of file Sampled.H.

◆ interpolationScheme_

word interpolationScheme_
protected

Interpolation scheme to use for nearestcell mode.

Definition at line 168 of file Sampled.H.


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