Class to calculate interpolative addressing and weights between the cells of two overlapping meshes. More...
Public Member Functions | |
TypeName ("cellsToCells") | |
Run-time type information. More... | |
declareRunTimeSelectionTable (autoPtr, cellsToCells, word,(),()) | |
Declare runtime constructor selection table. More... | |
cellsToCells () | |
Construct null. More... | |
cellsToCells (const cellsToCells &)=delete | |
Disallow default bitwise copy construction. More... | |
virtual | ~cellsToCells () |
Destructor. More... | |
label | singleProcess () const |
Index of the processor holding all cells of the cellsToCells,. More... | |
bool | isSingleProcess () const |
Is this intersection on a single process? More... | |
PackedBoolList | srcCoupled () const |
Return a list indicating which source cells are coupled. More... | |
PackedBoolList | tgtCoupled () const |
Return a list indicating which target cells are coupled. More... | |
template<class Type > | |
tmp< Field< Type > > | srcToTgt (const Field< Type > &srcFld) const |
Interpolate a source cell field to the target with no left. More... | |
template<class Type > | |
tmp< Field< Type > > | srcToTgt (const Field< Type > &srcFld, const Field< Type > &leftOverTgtFld) const |
Interpolate a source cell field to the target with left over. More... | |
template<class Type > | |
tmp< Field< Type > > | tgtToSrc (const Field< Type > &tgtFld) const |
Interpolate a target cell field to the source with no left. More... | |
template<class Type > | |
tmp< Field< Type > > | tgtToSrc (const Field< Type > &tgtFld, const Field< Type > &leftOverSrcFld) const |
Interpolate a target cell field to the source with left. More... | |
remote | srcToTgtPoint (const polyMesh &tgtMesh, const label srcCelli, const point &p) const |
Find the target processor and cell associated with a point in a. More... | |
scalar | update (const polyMesh &srcMesh, const polyMesh &tgtMesh) |
Update addressing and weights for the given meshes. Returns the. More... | |
void | operator= (const cellsToCells &)=delete |
Disallow default bitwise assignment. More... | |
template<class Type > | |
Foam::tmp< Foam::Field< Type > > | srcToTgt (const Field< Type > &srcFld) const |
template<class Type > | |
Foam::tmp< Foam::Field< Type > > | srcToTgt (const Field< Type > &srcFld, const Field< Type > &leftOverTgtFld) const |
template<class Type > | |
Foam::tmp< Foam::Field< Type > > | tgtToSrc (const Field< Type > &tgtFld) const |
template<class Type > | |
Foam::tmp< Foam::Field< Type > > | tgtToSrc (const Field< Type > &tgtFld, const Field< Type > &leftOverSrcFld) const |
Static Public Member Functions | |
static autoPtr< cellsToCells > | New (const word &cellsToCellsType) |
Select from name. More... | |
Protected Member Functions | |
void | initialise (const polyMesh &srcMesh, const polyMesh &tgtMesh) |
Initialise the addressing and weights. More... | |
virtual scalar | calculate (const polyMesh &srcMesh, const polyMesh &tgtMesh)=0 |
Calculate the addressing and weights. More... | |
virtual void | normalise (const polyMesh &mesh, labelListList &localOtherCells, scalarListList &weights) const =0 |
Normalise the weights for a given mesh. More... | |
labelList | maskCells (const polyMesh &srcMesh, const polyMesh &tgtMesh) const |
Return src cell IDs for the overlap region. More... | |
void | appendNbrCells (const label tgtCelli, const polyMesh &mesh, const DynamicList< label > &visitedTgtCells, DynamicList< label > &nbrTgtCellIDs) const |
Append target cell neighbour cells to cellIDs list. More... | |
labelListList | tgtMeshSendCells (const polyMesh &srcMesh, const polyMesh &tgtMesh) const |
Determine which target cells need to be sent to the source. More... | |
void | trimLocalTgt () |
Trim the local target addressing and mesh so that communication. More... | |
Static Protected Member Functions | |
static List< remote > | distributeMesh (const distributionMap &map, const polyMesh &mesh, autoPtr< polyMesh > &localMeshPtr) |
Distribute a mesh given its distribution map. More... | |
Protected Attributes | |
label | singleProcess_ |
Index of processor that holds all of both sides, or -1. More... | |
labelListList | srcLocalTgtCells_ |
For each source cell, the coupled local target cells. More... | |
labelListList | tgtLocalSrcCells_ |
For each target cell, the coupled local source cells. More... | |
scalarListList | srcWeights_ |
For each source cell, the coupled target weights. More... | |
scalarListList | tgtWeights_ |
For each target cell, the coupled source weights. More... | |
autoPtr< distributionMap > | srcMapPtr_ |
Map from source patch cells to target-local source patch cells. More... | |
autoPtr< distributionMap > | tgtMapPtr_ |
Map from target patch cells to source-local target patch cells. More... | |
autoPtr< List< remote > > | localSrcProcCellsPtr_ |
When running in parallel, a map from local source cell index to. More... | |
autoPtr< List< remote > > | localTgtProcCellsPtr_ |
When running in parallel, a map from local target cell index to. More... | |
autoPtr< polyMesh > | localTgtMeshPtr_ |
The target mesh, distributed locally to the source. More... | |
Class to calculate interpolative addressing and weights between the cells of two overlapping meshes.
Definition at line 55 of file cellsToCells.H.
cellsToCells | ( | ) |
Construct null.
Definition at line 139 of file cellsToCells.C.
|
delete |
Disallow default bitwise copy construction.
|
virtual |
Destructor.
Definition at line 156 of file cellsToCells.C.
Initialise the addressing and weights.
Definition at line 46 of file cellsToCells.C.
References List< T >::clear(), forAll, primitiveMesh::nCells(), List< T >::setSize(), cellsToCells::srcLocalTgtCells_, cellsToCells::srcWeights_, cellsToCells::tgtLocalSrcCells_, and cellsToCells::tgtWeights_.
|
protectedpure virtual |
Calculate the addressing and weights.
Implemented in nearest, matching, and intersection.
|
protectedpure virtual |
Normalise the weights for a given mesh.
Implemented in nearest, matching, and intersection.
|
protected |
Return src cell IDs for the overlap region.
Definition at line 70 of file cellsToCells.C.
References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), polyMesh::bounds(), primitiveMesh::cells(), polyMesh::faces(), forAll, boundBox::max(), Foam::max(), meshBb(), boundBox::min(), Foam::min(), primitiveMesh::nCells(), points, polyMesh::points(), and List< T >::transfer().
|
protected |
Append target cell neighbour cells to cellIDs list.
Definition at line 109 of file cellsToCells.C.
References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), primitiveMesh::cellCells(), Foam::findIndex(), and forAll.
|
protected |
Determine which target cells need to be sent to the source.
This is done before intersection. Bound boxes are used to estimate what cells will intersect.
Definition at line 55 of file cellsToCellsParallelOps.C.
References List< T >::append(), primitiveMesh::cells(), polyMesh::faces(), forAll, Pstream::gatherList(), UPstream::myProcNo(), primitiveMesh::nCells(), UPstream::nProcs(), polyMesh::points(), Pstream::scatterList(), and List< T >::transfer().
|
staticprotected |
Distribute a mesh given its distribution map.
Definition at line 108 of file cellsToCellsParallelOps.C.
References Foam::abort(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), polyMesh::boundaryMesh(), word::capitalise(), distributionMapBase::constructMap(), Foam::endl(), f(), polyMesh::faceNeighbour(), polyMesh::faceOwner(), polyMesh::faces(), Foam::FatalError, FatalErrorInFunction, PstreamBuffers::finishedSends(), forAll, Foam::max(), Foam::min(), UPstream::myProcNo(), IOobject::name(), dimensioned< Type >::name(), primitiveMesh::nCells(), primitiveMesh::nFaces(), IOobject::NO_READ, UPstream::nonBlocking, nPoints, primitiveMesh::nPoints(), UPstream::nProcs(), word::null, Foam::offset(), patches, patchi, polyMesh::points(), Foam::Pout, autoPtr< T >::reset(), List< T >::size(), polyPatch::start(), distributionMapBase::subMap(), and objectRegistry::time().
|
protected |
Trim the local target addressing and mesh so that communication.
from the target to the source is optimised
Definition at line 637 of file cellsToCellsParallelOps.C.
References word::capitalise(), Foam::endl(), Foam::exit(), polyMesh::faceNeighbour(), polyMesh::faceOwner(), polyMesh::faces(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::identityMap(), Foam::inplaceRenumber(), Foam::invert(), IOobject::name(), dimensioned< Type >::name(), primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), IOobject::NO_READ, word::null, patches, polyMesh::points(), Foam::Pout, List< T >::resize(), face::reverseFace(), List< T >::size(), Foam::Swap(), objectRegistry::time(), and Foam::patchToPatchTools::trimDistributionMap().
TypeName | ( | "cellsToCells" | ) |
Run-time type information.
declareRunTimeSelectionTable | ( | autoPtr | , |
cellsToCells | , | ||
word | , | ||
() | , | ||
() | |||
) |
Declare runtime constructor selection table.
|
static |
Select from name.
Definition at line 162 of file cellsToCells.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, and FatalErrorInFunction.
Referenced by interRegionModel::interpolation().
|
inline |
Index of the processor holding all cells of the cellsToCells,.
or -1 if spread across multiple processors
Definition at line 30 of file cellsToCellsI.H.
References cellsToCells::singleProcess_.
|
inline |
Is this intersection on a single process?
Definition at line 36 of file cellsToCellsI.H.
Foam::PackedBoolList srcCoupled | ( | ) | const |
Return a list indicating which source cells are coupled.
Definition at line 186 of file cellsToCells.C.
References PackedList< nBits >::empty(), and forAll.
Foam::PackedBoolList tgtCoupled | ( | ) | const |
Return a list indicating which target cells are coupled.
Definition at line 197 of file cellsToCells.C.
References PackedList< nBits >::empty(), and forAll.
Interpolate a source cell field to the target with no left.
over values specified. If the interpolation weight sum is less than one for a face then they will be normalised. If the interpolation weight sum is zero for a face then that face's value will be NaN.
Referenced by interRegionModel::interpolate().
tmp<Field<Type> > srcToTgt | ( | const Field< Type > & | srcFld, |
const Field< Type > & | leftOverTgtFld | ||
) | const |
Interpolate a source cell field to the target with left over.
values specified. If the interpolation weight sum is less than one for a face then the average will include the left over value multiplied by one minus the weight sum.
Interpolate a target cell field to the source with no left.
over values specified. As the corresponding srcToTgt.
Referenced by interRegionModel::interpolate().
tmp<Field<Type> > tgtToSrc | ( | const Field< Type > & | tgtFld, |
const Field< Type > & | leftOverSrcFld | ||
) | const |
Interpolate a target cell field to the source with left.
over values specified. As the corresponding srcToTgt.
Foam::remote srcToTgtPoint | ( | const polyMesh & | tgtMesh, |
const label | srcCelli, | ||
const point & | p | ||
) | const |
Find the target processor and cell associated with a point in a.
source cell. Note that this will only work with derivations that fill a cell's stencil with everything that overlaps that cell. qt present this is just cellsToCellss::intersection, but we might add a cheaper bound-box based method like patchToPatches::rays in future.
Definition at line 208 of file cellsToCells.C.
References forAll, UPstream::myProcNo(), p, and polyMesh::pointInCell().
Update addressing and weights for the given meshes. Returns the.
overlapping volume (if that is relevant to the method).
Definition at line 235 of file cellsToCells.C.
References Foam::fvPatchDistWave::calculate(), Foam::patchToPatchTools::constructDistributionMap(), cpuTime::cpuTimeIncrement(), Foam::decrIndent(), Foam::patchToPatchTools::distributeAddressing(), Foam::endl(), forAll, Foam::incrIndent(), Foam::indent(), Foam::Info, IOobject::name(), primitiveMesh::nCells(), Foam::normalise(), Foam::Pout, Foam::patchToPatchTools::procSendIndices(), Foam::patchToPatchTools::rDistributeListList(), Foam::patchToPatchTools::rDistributeTgtAddressing(), Foam::reduce(), Foam::returnReduce(), Foam::patchToPatchTools::singleProcess(), and regIOobject::write().
|
delete |
Disallow default bitwise assignment.
Foam::tmp<Foam::Field<Type> > srcToTgt | ( | const Field< Type > & | srcFld | ) | const |
Definition at line 33 of file cellsToCellsTemplates.C.
References Foam::patchToPatchTools::interpolate(), cellsToCells::srcMapPtr_, cellsToCells::tgtLocalSrcCells_, and cellsToCells::tgtWeights_.
Foam::tmp<Foam::Field<Type> > srcToTgt | ( | const Field< Type > & | srcFld, |
const Field< Type > & | leftOverTgtFld | ||
) | const |
Definition at line 47 of file cellsToCellsTemplates.C.
References Foam::patchToPatchTools::interpolate().
Foam::tmp<Foam::Field<Type> > tgtToSrc | ( | const Field< Type > & | tgtFld | ) | const |
Definition at line 67 of file cellsToCellsTemplates.C.
References Foam::patchToPatchTools::interpolate().
Foam::tmp<Foam::Field<Type> > tgtToSrc | ( | const Field< Type > & | tgtFld, |
const Field< Type > & | leftOverSrcFld | ||
) | const |
Definition at line 81 of file cellsToCellsTemplates.C.
References Foam::patchToPatchTools::interpolate().
|
protected |
Index of processor that holds all of both sides, or -1.
Definition at line 62 of file cellsToCells.H.
Referenced by cellsToCells::singleProcess().
|
protected |
For each source cell, the coupled local target cells.
Definition at line 65 of file cellsToCells.H.
Referenced by cellsToCells::initialise().
|
protected |
For each target cell, the coupled local source cells.
Definition at line 68 of file cellsToCells.H.
Referenced by cellsToCells::initialise(), and cellsToCells::srcToTgt().
|
protected |
For each source cell, the coupled target weights.
Definition at line 71 of file cellsToCells.H.
Referenced by cellsToCells::initialise().
|
protected |
For each target cell, the coupled source weights.
Definition at line 74 of file cellsToCells.H.
Referenced by cellsToCells::initialise(), and cellsToCells::srcToTgt().
|
protected |
Map from source patch cells to target-local source patch cells.
Definition at line 77 of file cellsToCells.H.
Referenced by cellsToCells::srcToTgt().
|
protected |
Map from target patch cells to source-local target patch cells.
Definition at line 80 of file cellsToCells.H.
When running in parallel, a map from local source cell index to.
source processor and cell index
Definition at line 84 of file cellsToCells.H.
When running in parallel, a map from local target cell index to.
target processor and cell index
Definition at line 88 of file cellsToCells.H.
The target mesh, distributed locally to the source.
Definition at line 91 of file cellsToCells.H.