Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
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]

Classes

class  maxProcEqOp
 
class  nearestEqOp
 
class  nearestWorldEqOp
 

Public Types

enum  sampleMode {
  NEARESTCELL, NEARESTPATCHFACE, NEARESTPATCHFACEAMI, NEARESTPATCHPOINT,
  NEARESTFACE, NEARESTONLYCELL
}
 
enum  offsetMode { UNIFORM, NONUNIFORM, NORMAL }
 
typedef Tuple2< pointIndexHit, Tuple2< scalar, label > > nearInfo
 
typedef Tuple2< nearInfo, label > nearInfoWorld
 

Public Member Functions

 TypeName ("mappedPatchBase")
 
 mappedPatchBase (const polyPatch &)
 
 mappedPatchBase (const polyPatch &pp, const word &sampleRegion, const sampleMode sampleMode, const word &samplePatch, const vectorField &offsets)
 
 mappedPatchBase (const polyPatch &pp, const word &sampleRegion, const sampleMode sampleMode, const word &samplePatch, const vector &uniformOffset)
 
 mappedPatchBase (const polyPatch &pp, const word &sampleRegion, const sampleMode sampleMode, const word &samplePatch, const scalar normalDistance)
 
 mappedPatchBase (const polyPatch &, const dictionary &)
 
 mappedPatchBase (const polyPatch &, const sampleMode, const dictionary &)
 
 mappedPatchBase (const polyPatch &, const mappedPatchBase &)
 
 mappedPatchBase (const polyPatch &, const mappedPatchBase &, const labelUList &mapAddressing)
 
virtual ~mappedPatchBase ()
 
void clearOut ()
 
void setOffset (const scalar normalDist)
 
void setOffset (const vector &uniformOffset)
 
void setOffset (const vectorField &offsets)
 
sampleMode mode () const noexcept
 
const wordsampleWorld () const noexcept
 
const wordsampleRegion () const
 
const wordsamplePatch () const
 
const wordcoupleGroup () const
 
label sampleSize () const
 
const vectoroffset () const noexcept
 
const vectorFieldoffsets () const noexcept
 
label getCommunicator () const
 
label comm () const
 
bool sameWorld () const
 
bool masterWorld () const
 
bool sameRegion () const noexcept
 
const mapDistributemap () const
 
const AMIPatchToPatchInterpolationAMI (const bool forceUpdate=false) const
 
bool owner () const
 
const autoPtr< Foam::searchableSurface > & surfPtr () const
 
const polyMeshsampleMesh () const
 
const polyPatchsamplePolyPatch () const
 
tmp< pointFieldsamplePoints () const
 
const fileNamesampleDatabasePath () const
 
bool sampleDatabase () const
 
virtual fileName sendPath (const label proci) const
 
virtual fileName receivePath (const label proci) const
 
template<class Type >
void distribute (List< Type > &lst) const
 
template<class Type , class CombineOp >
void distribute (List< Type > &lst, const CombineOp &cop) const
 
template<class Type >
void reverseDistribute (List< Type > &lst) const
 
template<class Type , class CombineOp >
void reverseDistribute (List< Type > &lst, const CombineOp &cop) const
 
virtual void write (Ostream &os) const
 

Static Public Member Functions

static pointIndexHit facePoint (const polyMesh &, const label facei, const polyMesh::cellDecomposition)
 
static fileName sendPath (const fileName &root, const label proci)
 
static fileName receivePath (const fileName &root, const label proci)
 
static const objectRegistrysubRegistry (const objectRegistry &obr, const fileName &path)
 
template<class Type >
static void storeField (objectRegistry &obr, const word &fieldName, const Field< Type > &values)
 
static void writeDict (const objectRegistry &obr, dictionary &dict)
 
static void readDict (const dictionary &d, objectRegistry &obr)
 

Static Public Attributes

static const Enum< sampleModesampleModeNames_
 
static const Enum< offsetModeoffsetModeNames_
 

Protected Member Functions

bool addWorldConnection ()
 
label getWorldCommunicator () const
 
const polyMeshlookupMesh (const word &region) const
 
const polyPatchlookupPatch (const word &sampleRegion, const word &samplePatch) const
 
tmp< pointFieldfacePoints (const polyPatch &) const
 
void collectSamples (const label mySampleWorld, const pointField &facePoints, pointField &samples, labelList &patchFaceWorlds, labelList &patchFaceProcs, labelList &patchFaces, pointField &patchFc) const
 
void findLocalSamples (const sampleMode mode, const label sampleWorld, const word &sampleRegion, const word &samplePatch, const pointField &samplePoints, List< nearInfoWorld > &nearest) const
 
void findSamples (const sampleMode mode, const label myWorldIndex, const pointField &, const labelList &wantedWorlds, const labelList &origProcs, labelList &sampleProcs, labelList &sampleIndices, pointField &sampleLocations) const
 
tmp< pointFieldsamplePoints (const pointField &) const
 
void calcMapping () const
 
void calcAMI () const
 

Static Protected Member Functions

static autoPtr< fileNamereadDatabase (const dictionary &dict)
 
static const objectRegistrysubRegistry (const objectRegistry &obr, const wordList &names, const label index)
 
template<class Type >
static bool writeIOField (const regIOobject &obj, dictionary &dict)
 
template<class Type >
static bool constructIOField (const word &name, token &tok, Istream &is, objectRegistry &obr)
 

Protected Attributes

const polyPatchpatch_
 
word sampleWorld_
 
word sampleRegion_
 
const sampleMode mode_
 
word samplePatch_
 
const coupleGroupIdentifier coupleGroup_
 
const autoPtr< fileNamesampleDatabasePtr_
 
offsetMode offsetMode_
 
vector offset_
 
vectorField offsets_
 
scalar distance_
 
label communicator_
 
bool sameRegion_
 
autoPtr< mapDistributemapPtr_
 
const bool AMIReverse_
 
autoPtr< AMIPatchToPatchInterpolationAMIPtr_
 
autoPtr< searchableSurfacesurfPtr_
 
dictionary surfDict_
 

Detailed Description

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

If constructed from dictionary:

    // Optional world to sample (default is all)
    //sampleWorld solidSim;

    // Optional explicit coupling (requires functionObject to synchronise
    // databases. Default is close coupling (bc to bc)
    //sampleDatabase true;

    // Region to sample (default is region0)
    sampleRegion region0;

    // What to sample:
    // - nearestCell         : sample cell containing point
    // - nearestOnlyCell     : nearest sample cell (even if not containing
    //                         point)
    // - nearestPatchFace    : nearest face on selected patch
    // - nearestPatchFaceAMI : nearest face on selected patch
                               - patches need not conform
                               - uses AMI interpolation
    // - nearestFace         : nearest boundary face on any patch
    // - nearestPatchPoint   : nearest patch point (for coupled points
    //                         this might be any of the points so you have
    //                         to guarantee the point data is synchronised
    //                         beforehand)
    sampleMode nearestCell;

    // 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):
    // - uniform : single offset vector
    // - nonuniform : per-face offset vector
    // - normal : using supplied distance and face normal
    offsetMode uniform;

    // 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 108 of file mappedPatchBase.H.

Member Typedef Documentation

◆ nearInfo

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

Definition at line 143 of file mappedPatchBase.H.

◆ nearInfoWorld

typedef Tuple2<nearInfo, label> nearInfoWorld

Definition at line 188 of file mappedPatchBase.H.

Member Enumeration Documentation

◆ sampleMode

enum sampleMode
Enumerator
NEARESTCELL 

nearest cell containing sample

NEARESTPATCHFACE 

nearest face on selected patch

NEARESTPATCHFACEAMI 

nearest patch face + AMI interpolation

NEARESTPATCHPOINT 

nearest point on selected patch

NEARESTFACE 

nearest face

NEARESTONLYCELL 

nearest cell (even if not containing cell)

Definition at line 115 of file mappedPatchBase.H.

◆ offsetMode

enum offsetMode
Enumerator
UNIFORM 

single offset vector

NONUNIFORM 

per-face offset vector

NORMAL 

use face normal + distance

Definition at line 126 of file mappedPatchBase.H.

Constructor & Destructor Documentation

◆ mappedPatchBase() [1/8]

mappedPatchBase ( const polyPatch pp)
explicit

Definition at line 1208 of file mappedPatchBase.C.

◆ mappedPatchBase() [2/8]

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

Definition at line 1234 of file mappedPatchBase.C.

References mappedPatchBase::setOffset().

Here is the call graph for this function:

◆ mappedPatchBase() [3/8]

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

Definition at line 1256 of file mappedPatchBase.C.

References mappedPatchBase::setOffset().

Here is the call graph for this function:

◆ mappedPatchBase() [4/8]

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

Definition at line 1278 of file mappedPatchBase.C.

◆ mappedPatchBase() [5/8]

mappedPatchBase ( const polyPatch pp,
const dictionary dict 
)

Definition at line 1314 of file mappedPatchBase.C.

References dict, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, dictionary::found(), dictionary::readEntry(), and dictionary::readIfPresent().

Here is the call graph for this function:

◆ mappedPatchBase() [6/8]

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

Definition at line 1416 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 
)

Definition at line 1489 of file mappedPatchBase.C.

◆ mappedPatchBase() [8/8]

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

Definition at line 1521 of file mappedPatchBase.C.

◆ ~mappedPatchBase()

~mappedPatchBase ( )
virtual

Definition at line 1560 of file mappedPatchBase.C.

Member Function Documentation

◆ addWorldConnection()

bool addWorldConnection ( )
protected

◆ getWorldCommunicator()

Foam::label getWorldCommunicator ( ) const
protected

Definition at line 131 of file mappedPatchBase.C.

References multiWorldConnections::getCommByName(), multiWorldConnections::New(), runTime, objectRegistry::time(), and UPstream::worldComm.

Here is the call graph for this function:

◆ lookupMesh()

const Foam::polyMesh & lookupMesh ( const word region) const
protected

Definition at line 1607 of file mappedPatchBase.C.

References polyMesh::boundaryMesh(), objectRegistry::lookupObject(), polyBoundaryMesh::mesh(), IOobject::name(), and objectRegistry::time().

Here is the call graph for this function:

◆ lookupPatch()

const Foam::polyPatch & lookupPatch ( const word sampleRegion,
const word samplePatch 
) const
protected

◆ facePoints()

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

◆ collectSamples()

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

◆ findLocalSamples()

void findLocalSamples ( const sampleMode  mode,
const label  sampleWorld,
const word sampleRegion,
const word samplePatch,
const pointField samplePoints,
List< nearInfoWorld > &  nearest 
) const
protected

◆ findSamples()

void findSamples ( const sampleMode  mode,
const label  myWorldIndex,
const pointField samples,
const labelList wantedWorlds,
const labelList origProcs,
labelList sampleProcs,
labelList sampleIndices,
pointField sampleLocations 
) const
protected

◆ samplePoints() [1/2]

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

Definition at line 1675 of file mappedPatchBase.C.

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

Here is the call graph for this function:

◆ calcMapping()

void calcMapping ( ) const
protected

◆ calcAMI()

void calcAMI ( ) const
protected

◆ readDatabase()

Foam::autoPtr< Foam::fileName > readDatabase ( const dictionary dict)
staticprotected

Definition at line 83 of file mappedPatchBase.C.

References dict, and autoPtr::set().

Here is the call graph for this function:

◆ subRegistry() [1/2]

const Foam::objectRegistry & subRegistry ( const objectRegistry obr,
const wordList names,
const label  index 
)
staticprotected

Definition at line 1188 of file mappedPatchBase.C.

References Foam::PtrListOps::names(), and objectRegistry::subRegistry().

Referenced by syncObjects::sync().

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

◆ writeIOField()

bool writeIOField ( const regIOobject obj,
dictionary dict 
)
staticprotected

Definition at line 218 of file mappedPatchBaseTemplates.C.

References dict, fld, and dictionary::set().

Here is the call graph for this function:

◆ constructIOField()

bool constructIOField ( const word name,
token tok,
Istream is,
objectRegistry obr 
)
staticprotected

◆ TypeName()

TypeName ( "mappedPatchBase"  )

◆ clearOut()

void clearOut ( )

◆ setOffset() [1/3]

void setOffset ( const scalar  normalDist)

Definition at line 1576 of file mappedPatchBase.C.

References Foam::Zero.

Referenced by mappedPatchBase::mappedPatchBase().

Here is the caller graph for this function:

◆ setOffset() [2/3]

void setOffset ( const vector uniformOffset)

Definition at line 1586 of file mappedPatchBase.C.

References Foam::Zero.

◆ setOffset() [3/3]

void setOffset ( const vectorField offsets)

Definition at line 1596 of file mappedPatchBase.C.

References Foam::Zero.

◆ mode()

Foam::mappedPatchBase::sampleMode mode ( ) const
inlinenoexcept

◆ sampleWorld()

const Foam::word & sampleWorld ( ) const
inlinenoexcept

Definition at line 29 of file mappedPatchBaseI.H.

◆ sampleRegion()

const Foam::word & sampleRegion ( ) const
inline

Definition at line 35 of file mappedPatchBaseI.H.

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

Referenced by turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs(), and turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs().

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

◆ samplePatch()

const Foam::word & samplePatch ( ) const
inline

◆ coupleGroup()

const Foam::word & coupleGroup ( ) const
inline

Definition at line 87 of file mappedPatchBaseI.H.

◆ sampleSize()

Foam::label sampleSize ( ) const
inline

Definition at line 93 of file mappedPatchBaseI.H.

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

Here is the call graph for this function:

◆ offset()

const Foam::vector & offset ( ) const
inlinenoexcept

Definition at line 128 of file mappedPatchBaseI.H.

◆ offsets()

const Foam::vectorField & offsets ( ) const
inlinenoexcept

Definition at line 134 of file mappedPatchBaseI.H.

◆ getCommunicator()

Foam::label getCommunicator ( ) const
inline

Definition at line 140 of file mappedPatchBaseI.H.

Referenced by mappedPatchBase::distribute().

Here is the caller graph for this function:

◆ comm()

Foam::label comm ( ) const
inline

Definition at line 151 of file mappedPatchBaseI.H.

◆ sameWorld()

bool sameWorld ( ) const
inline

◆ masterWorld()

bool masterWorld ( ) const
inline

Definition at line 173 of file mappedPatchBaseI.H.

References UPstream::allWorlds(), and UPstream::myWorldID().

Referenced by mappedPatchBase::distribute().

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

◆ sameRegion()

bool sameRegion ( ) const
inlinenoexcept

Definition at line 186 of file mappedPatchBaseI.H.

◆ map()

const Foam::mapDistribute & map ( ) const
inline

◆ AMI()

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

Definition at line 214 of file mappedPatchBaseI.H.

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

Referenced by mappedPatchBase::distribute().

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

◆ owner()

bool owner ( ) const
inline

Definition at line 234 of file mappedPatchBaseI.H.

Referenced by mappedPolyPatch::masterImplicit(), and mappedWallPolyPatch::masterImplicit().

Here is the caller graph for this function:

◆ surfPtr()

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

◆ sampleMesh()

const Foam::polyMesh & sampleMesh ( ) const

◆ samplePolyPatch()

const Foam::polyPatch & samplePolyPatch ( ) const

◆ samplePoints() [2/2]

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

Definition at line 1709 of file mappedPatchBase.C.

◆ facePoint()

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

◆ sampleDatabasePath()

const fileName& sampleDatabasePath ( ) const
inline

Definition at line 556 of file mappedPatchBase.H.

References mappedPatchBase::sampleDatabasePtr_.

◆ sampleDatabase()

bool sampleDatabase ( ) const
inline

Definition at line 561 of file mappedPatchBase.H.

References bool, and mappedPatchBase::sampleDatabasePtr_.

◆ sendPath() [1/2]

Foam::fileName sendPath ( const fileName root,
const label  proci 
)
static

Definition at line 1821 of file mappedPatchBase.C.

References Foam::name().

Referenced by syncObjects::sync().

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

◆ sendPath() [2/2]

Foam::fileName sendPath ( const label  proci) const
virtual

Definition at line 1831 of file mappedPatchBase.C.

◆ receivePath() [1/2]

Foam::fileName receivePath ( const fileName root,
const label  proci 
)
static

Definition at line 1838 of file mappedPatchBase.C.

References Foam::name().

Referenced by syncObjects::sync().

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

◆ receivePath() [2/2]

Foam::fileName receivePath ( const label  proci) const
virtual

Definition at line 1848 of file mappedPatchBase.C.

◆ subRegistry() [2/2]

const Foam::objectRegistry & subRegistry ( const objectRegistry obr,
const fileName path 
)
static

Definition at line 1797 of file mappedPatchBase.C.

References fileName::clean(), fileName::components(), Foam::PtrListOps::names(), and path().

Here is the call graph for this function:

◆ storeField()

void storeField ( objectRegistry obr,
const word fieldName,
const Field< Type > &  values 
)
static

Definition at line 308 of file mappedPatchBaseTemplates.C.

References objectRegistry::findObject(), IOobject::NO_READ, IOobject::NO_WRITE, regIOobject::store(), and Foam::HashTableOps::values().

Here is the call graph for this function:

◆ writeDict()

void writeDict ( const objectRegistry obr,
dictionary dict 
)
static

Definition at line 1855 of file mappedPatchBase.C.

References dictionary::add(), dict, forAllIters, IOobject::name(), os(), dictionary::subDictOrAdd(), and regIOobject::writeData().

Referenced by syncObjects::sync().

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

◆ readDict()

void readDict ( const dictionary d,
objectRegistry obr 
)
static

Definition at line 1894 of file mappedPatchBase.C.

References Foam::constant::electromagnetic::e, Foam::exit(), Foam::FatalError, FatalErrorInFunction, and objectRegistry::subRegistry().

Referenced by syncObjects::sync().

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

◆ reverseDistribute() [1/2]

void reverseDistribute ( List< Type > &  lst) const

Definition at line 141 of file mappedPatchBaseTemplates.C.

References UPstream::warnComm, and UPstream::worldComm.

Referenced by regionModel::toPrimary().

Here is the caller graph for this function:

◆ reverseDistribute() [2/2]

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

◆ write()

void write ( Ostream os) const
virtual

Member Data Documentation

◆ sampleModeNames_

const Foam::Enum< Foam::mappedPatchBase::sampleMode > sampleModeNames_
static

Definition at line 133 of file mappedPatchBase.H.

◆ offsetModeNames_

const Foam::Enum< Foam::mappedPatchBase::offsetMode > offsetModeNames_
static

Definition at line 135 of file mappedPatchBase.H.

◆ patch_

const polyPatch& patch_
protected

◆ sampleWorld_

word sampleWorld_
mutableprotected

Definition at line 225 of file mappedPatchBase.H.

Referenced by mappedPatchBase::addWorldConnection().

◆ sampleRegion_

word sampleRegion_
mutableprotected

◆ mode_

const sampleMode mode_
protected

Definition at line 231 of file mappedPatchBase.H.

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

◆ samplePatch_

word samplePatch_
mutableprotected

◆ coupleGroup_

const coupleGroupIdentifier coupleGroup_
protected

Definition at line 237 of file mappedPatchBase.H.

◆ sampleDatabasePtr_

const autoPtr<fileName> sampleDatabasePtr_
protected

◆ offsetMode_

offsetMode offsetMode_
protected

Definition at line 243 of file mappedPatchBase.H.

◆ offset_

vector offset_
protected

Definition at line 246 of file mappedPatchBase.H.

◆ offsets_

vectorField offsets_
protected

Definition at line 249 of file mappedPatchBase.H.

◆ distance_

scalar distance_
protected

Definition at line 252 of file mappedPatchBase.H.

◆ communicator_

label communicator_
protected

Definition at line 255 of file mappedPatchBase.H.

◆ sameRegion_

bool sameRegion_
mutableprotected

Definition at line 258 of file mappedPatchBase.H.

◆ mapPtr_

autoPtr<mapDistribute> mapPtr_
mutableprotected

Definition at line 268 of file mappedPatchBase.H.

◆ AMIReverse_

const bool AMIReverse_
protected

Definition at line 274 of file mappedPatchBase.H.

◆ AMIPtr_

autoPtr<AMIPatchToPatchInterpolation> AMIPtr_
mutableprotected

Definition at line 277 of file mappedPatchBase.H.

◆ surfPtr_

autoPtr<searchableSurface> surfPtr_
mutableprotected

Definition at line 280 of file mappedPatchBase.H.

◆ surfDict_

dictionary surfDict_
protected

Definition at line 283 of file mappedPatchBase.H.


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