Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes
mappedPatchBase Class Reference

Determines a mapping between patch face centres and mesh cell or face centres and processors they're on. More...

Inheritance diagram for mappedPatchBase:
Inheritance graph
[legend]
Collaboration diagram for mappedPatchBase:
Collaboration graph
[legend]

Data Structures

class  maxProcEqOp
 
class  nearestEqOp
 

Public Types

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

Public Member Functions

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

Static Public Member Functions

static pointIndexHit facePoint (const polyMesh &, const label faceI, const polyMesh::cellDecomposition)
 Get a point on the face given a face decomposition method: More...
 

Static Public Attributes

static const NamedEnum< sampleMode, 6 > sampleModeNames_
 
static const NamedEnum< offsetMode, 3 > offsetModeNames_
 

Protected Member Functions

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

Static Protected Member Functions

static tmp< pointFieldreadListOrField (const word &keyword, const dictionary &dict, const label size)
 Helper to read field or non-uniform list from dictionary. More...
 

Protected Attributes

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

Detailed Description

Determines a mapping between patch face centres and mesh cell or face centres and processors they're on.

If constructed from dictionary: Region to sample (default is region0) sampleRegion region0;

What to sample:

If sampleMode is nearestPatchFace : patch to find faces of samplePatch movingWall;

If sampleMode is nearestPatchFace : specify patchgroup to find samplePatch and sampleRegion (if not provided) coupleGroup baffleGroup;

How to supply offset (w.r.t. my patch face centres):

According to offsetMode (see above) supply one of offset, offsets or distance offset (1 0 0);

Note: if offsetMode is 'normal' it uses outwards pointing normals. So supply a negative distance if sampling inside the domain.

Note
Storage is not optimal. It temporary collects all (patch)face centres on all processors to keep the addressing calculation simple.
Source files

Definition at line 101 of file mappedPatchBase.H.

Member Typedef Documentation

◆ nearInfo

typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo

Helper class for finding nearest.

Nearest:

  • point+local index
  • sqr(distance)
  • processor

Definition at line 137 of file mappedPatchBase.H.

Member Enumeration Documentation

◆ sampleMode

enum sampleMode

Mesh items to sample.

Enumerator
NEARESTCELL 
NEARESTPATCHFACE 
NEARESTPATCHFACEAMI 
NEARESTPATCHPOINT 
NEARESTFACE 
NEARESTONLYCELL 

Definition at line 109 of file mappedPatchBase.H.

◆ offsetMode

enum offsetMode

How to project face centres.

Enumerator
UNIFORM 
NONUNIFORM 
NORMAL 

Definition at line 120 of file mappedPatchBase.H.

Constructor & Destructor Documentation

◆ mappedPatchBase() [1/8]

mappedPatchBase ( const polyPatch pp)

Construct from patch.

Definition at line 933 of file mappedPatchBase.C.

◆ mappedPatchBase() [2/8]

mappedPatchBase ( const polyPatch pp,
const word sampleRegion,
const sampleMode  sampleMode,
const word samplePatch,
const vectorField offsets 
)

Construct with offsetMode=non-uniform.

Definition at line 956 of file mappedPatchBase.C.

◆ mappedPatchBase() [3/8]

mappedPatchBase ( const polyPatch pp,
const word sampleRegion,
const sampleMode  sampleMode,
const word samplePatch,
const vector offset 
)

Construct from offsetMode=uniform.

Definition at line 983 of file mappedPatchBase.C.

◆ mappedPatchBase() [4/8]

mappedPatchBase ( const polyPatch pp,
const word sampleRegion,
const sampleMode  sampleMode,
const word samplePatch,
const scalar  distance 
)

Construct from offsetMode=normal and distance.

Definition at line 1010 of file mappedPatchBase.C.

◆ mappedPatchBase() [5/8]

mappedPatchBase ( const polyPatch pp,
const dictionary dict 
)

Construct from dictionary.

Definition at line 1037 of file mappedPatchBase.C.

References dict, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, dictionary::found(), dictionary::lookup(), Foam::readScalar(), and NamedEnum< Enum, nEnum >::words().

Here is the call graph for this function:

◆ mappedPatchBase() [6/8]

mappedPatchBase ( const polyPatch pp,
const sampleMode  mode,
const dictionary dict 
)

Construct from dictionary and (collocated) sample mode.

(only for nearestPatchFace, nearestPatchFaceAMI, nearestPatchPoint) Assumes zero offset.

Definition at line 1118 of file mappedPatchBase.C.

References dict, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, and Foam::mode().

Here is the call graph for this function:

◆ mappedPatchBase() [7/8]

mappedPatchBase ( const polyPatch pp,
const mappedPatchBase mpb 
)

Construct as copy, resetting patch.

Definition at line 1166 of file mappedPatchBase.C.

◆ mappedPatchBase() [8/8]

mappedPatchBase ( const polyPatch pp,
const mappedPatchBase mpb,
const labelUList mapAddressing 
)

Construct as copy, resetting patch, map original data.

Definition at line 1190 of file mappedPatchBase.C.

◆ ~mappedPatchBase()

~mappedPatchBase ( )
virtual

Destructor.

Definition at line 1221 of file mappedPatchBase.C.

Member Function Documentation

◆ facePoints()

Foam::tmp< Foam::pointField > facePoints ( const polyPatch pp) const
protected

Get the points from face-centre-decomposition face centres.

and project them onto the face-diagonal-decomposition triangles.

Definition at line 91 of file mappedPatchBase.C.

References polyPatch::boundaryMesh(), Foam::facePoint(), forAll, mesh, polyBoundaryMesh::mesh(), and polyPatch::start().

Referenced by mappedPatchBase::calcMapping().

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

◆ collectSamples()

void collectSamples ( const pointField facePoints,
pointField samples,
labelList patchFaceProcs,
labelList patchFaces,
pointField patchFc 
) const
protected

Collect single list of samples and originating processor+face.

Definition at line 119 of file mappedPatchBase.C.

References forAll, Foam::identity(), patchFaces(), samples(), List::setSize(), and List::size().

Referenced by mappedPatchBase::calcMapping().

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

◆ findSamples()

void findSamples ( const sampleMode  mode,
const pointField samples,
labelList sampleProcs,
labelList sampleIndices,
pointField sampleLocations 
) const
protected

◆ samplePoints() [1/2]

Foam::tmp< Foam::pointField > samplePoints ( const pointField fc) const
protected

Get the sample points given the face points.

Definition at line 1266 of file mappedPatchBase.C.

References fld(), Foam::mag(), and n.

Here is the call graph for this function:

◆ calcMapping()

void calcMapping ( ) const
protected

◆ calcAMI()

void calcAMI ( ) const
protected

◆ readListOrField()

Foam::tmp< Foam::pointField > readListOrField ( const word keyword,
const dictionary dict,
const label  size 
)
staticprotected

Helper to read field or non-uniform list from dictionary.

Definition at line 864 of file mappedPatchBase.C.

References dict, Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, fld(), IOWarningInFunction, token::isWord(), dictionary::lookup(), Istream::putBack(), IOstream::version(), and token::wordToken().

Here is the call graph for this function:

◆ TypeName()

TypeName ( "mappedPatchBase"  )

Runtime type information.

◆ clearOut()

void clearOut ( )

◆ mode()

const Foam::mappedPatchBase::sampleMode & mode ( ) const
inline

◆ sampleRegion()

const Foam::word & sampleRegion ( ) const
inline

Region to sample.

Definition at line 33 of file mappedPatchBaseI.H.

References Foam::exit(), Foam::FatalError, and FatalErrorInFunction.

Referenced by mappedPatchBase::calcMapping(), and regionModel::initialise().

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

◆ samplePatch()

const Foam::word & samplePatch ( ) const
inline

Patch (only if NEARESTPATCHFACE)

Definition at line 59 of file mappedPatchBaseI.H.

References Foam::exit(), Foam::FatalError, and FatalErrorInFunction.

Referenced by mappedPatchBase::calcMapping(), regionModel::nbrCoupledPatchID(), and mappedVelocityFluxFixedValueFvPatchField::updateCoeffs().

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

◆ coupleGroup()

const Foam::word & coupleGroup ( ) const
inline

PatchGroup (only if NEARESTPATCHFACE)

Definition at line 85 of file mappedPatchBaseI.H.

Referenced by thermalBaffleFvPatchScalarField::createPatchMesh().

Here is the caller graph for this function:

◆ sampleSize()

Foam::label sampleSize ( ) const
inline

Return size of mapped mesh/patch/boundary.

Definition at line 91 of file mappedPatchBaseI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, mesh, primitiveMesh::nFaces(), and primitiveMesh::nInternalFaces().

Here is the call graph for this function:

◆ offset()

const Foam::vector & offset ( ) const
inline

Offset vector (from patch faces to destination mesh objects)

Definition at line 126 of file mappedPatchBaseI.H.

◆ offsets()

const Foam::vectorField & offsets ( ) const
inline

Offset vector (from patch faces to destination mesh objects)

Definition at line 132 of file mappedPatchBaseI.H.

◆ sameRegion()

bool sameRegion ( ) const
inline

Cached sampleRegion != mesh.name()

Definition at line 138 of file mappedPatchBaseI.H.

◆ map()

const Foam::mapDistribute & map ( ) const
inline

◆ AMI()

const Foam::AMIPatchToPatchInterpolation & AMI ( const bool  forceUpdate = false) const
inline

Return reference to the AMI interpolator.

Definition at line 156 of file mappedPatchBaseI.H.

Referenced by mappedPatchBase::distribute().

Here is the caller graph for this function:

◆ surfPtr()

const Foam::autoPtr< Foam::searchableSurface > & surfPtr ( ) const

Return a pointer to the AMI projection surface.

Definition at line 771 of file mappedPatchBase.C.

References polyMesh::boundaryMesh(), TimePaths::constant(), mesh, polyBoundaryMesh::mesh(), IOobject::MUST_READ, searchableSurface::New(), IOobject::NO_WRITE, and fvMesh::time().

Here is the call graph for this function:

◆ sampleMesh()

const Foam::polyMesh & sampleMesh ( ) const

◆ samplePolyPatch()

const Foam::polyPatch & samplePolyPatch ( ) const

◆ samplePoints() [2/2]

Foam::tmp< Foam::pointField > samplePoints ( ) const

Get the sample points.

Definition at line 1300 of file mappedPatchBase.C.

Referenced by mappedPatchBase::calcMapping().

Here is the caller graph for this function:

◆ facePoint()

Foam::pointIndexHit facePoint ( const polyMesh mesh,
const label  faceI,
const polyMesh::cellDecomposition  decompMode 
)
static

Get a point on the face given a face decomposition method:

face-centre-tet : face centre. Returns index of face. face-planes : face centre. Returns index of face. face-diagonal : intersection of ray from cellcentre to facecentre with any of the triangles. Returns index (0..size-2) of triangle.

Definition at line 1307 of file mappedPatchBase.C.

References Foam::abort(), polyMesh::CELL_TETS, primitiveMesh::cellCentres(), PointHit::distance(), f(), polyMesh::FACE_CENTRE_TRIS, polyMesh::FACE_DIAG_TRIS, polyMesh::FACE_PLANES, primitiveMesh::faceCentres(), polyMesh::faceOwner(), polyMesh::faces(), Foam::FatalError, FatalErrorInFunction, intersection::HALF_RAY, PointHit::hit(), PointHit::hitPoint(), triangle::intersection(), mesh, p, polyMesh::points(), List::size(), and polyMesh::tetBasePtIs().

Referenced by nearWallFields::calcAddressing().

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

◆ distribute() [1/2]

void distribute ( List< Type > &  lst) const

◆ distribute() [2/2]

void distribute ( List< Type > &  lst,
const CombineOp &  cop 
) const

Wrapper around map/interpolate data distribution with operation.

Definition at line 46 of file mappedPatchBaseTemplates.C.

References UPstream::defaultCommsType, mapDistributeBase::distribute(), and List::xfer().

Here is the call graph for this function:

◆ reverseDistribute() [1/2]

void reverseDistribute ( List< Type > &  lst) const

Wrapper around map/interpolate data distribution.

Definition at line 84 of file mappedPatchBaseTemplates.C.

References List::xfer().

Referenced by regionModel::toPrimary().

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

◆ reverseDistribute() [2/2]

void reverseDistribute ( List< Type > &  lst,
const CombineOp &  cop 
) const

Wrapper around map/interpolate data distribution with operation.

Definition at line 104 of file mappedPatchBaseTemplates.C.

References UPstream::defaultCommsType, mapDistributeBase::distribute(), and List::xfer().

Here is the call graph for this function:

◆ write()

void write ( Ostream os) const
virtual

Field Documentation

◆ sampleModeNames_

const Foam::NamedEnum< Foam::mappedPatchBase::sampleMode, 6 > sampleModeNames_
static

◆ offsetModeNames_

const Foam::NamedEnum< Foam::mappedPatchBase::offsetMode, 3 > offsetModeNames_
static

Definition at line 129 of file mappedPatchBase.H.

Referenced by mappedPatchBase::calcMapping().

◆ patch_

const polyPatch& patch_
protected

Patch to sample.

Definition at line 187 of file mappedPatchBase.H.

Referenced by mappedPatchBase::calcMapping().

◆ sampleRegion_

word sampleRegion_
mutableprotected

Region to sample.

Definition at line 190 of file mappedPatchBase.H.

◆ mode_

const sampleMode mode_
protected

What to sample.

Definition at line 193 of file mappedPatchBase.H.

Referenced by mappedPatchBase::calcMapping(), mappedPatchBase::distribute(), and mappedPatchBase::mode().

◆ samplePatch_

word samplePatch_
mutableprotected

Patch (if in sampleMode NEARESTPATCH*)

Definition at line 196 of file mappedPatchBase.H.

◆ coupleGroup_

const coupleGroupIdentifier coupleGroup_
protected

PatchGroup (if in sampleMode NEARESTPATCH*)

Definition at line 199 of file mappedPatchBase.H.

◆ offsetMode_

offsetMode offsetMode_
protected

How to obtain samples.

Definition at line 202 of file mappedPatchBase.H.

Referenced by mappedPatchBase::calcMapping().

◆ offset_

vector offset_
protected

Offset vector (uniform)

Definition at line 205 of file mappedPatchBase.H.

◆ offsets_

vectorField offsets_
protected

Offset vector (nonuniform)

Definition at line 208 of file mappedPatchBase.H.

◆ distance_

scalar distance_
protected

Offset distance (normal)

Definition at line 211 of file mappedPatchBase.H.

◆ sameRegion_

bool sameRegion_
mutableprotected

Same region.

Definition at line 214 of file mappedPatchBase.H.

◆ mapPtr_

autoPtr<mapDistribute> mapPtr_
mutableprotected

Communication schedule:

  • Cells/faces to sample per processor

Patch faces to receive per processor

  • schedule

Definition at line 223 of file mappedPatchBase.H.

Referenced by mappedPatchBase::calcMapping().

◆ AMIPtr_

autoPtr<AMIPatchToPatchInterpolation> AMIPtr_
mutableprotected

Pointer to AMI interpolator.

Definition at line 229 of file mappedPatchBase.H.

◆ AMIReverse_

const bool AMIReverse_
protected

Flag to indicate that slave patch should be reversed for AMI.

Definition at line 232 of file mappedPatchBase.H.

◆ surfPtr_

autoPtr<searchableSurface> surfPtr_
mutableprotected

Pointer to projection surface employed by AMI interpolator.

Definition at line 235 of file mappedPatchBase.H.

◆ surfDict_

dictionary surfDict_
protected

Dictionary storing projection surface description.

Definition at line 238 of file mappedPatchBase.H.


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