Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
mapDistribute Class Reference

Class containing processor-to-processor mapping information. More...

Inheritance diagram for mapDistribute:
Inheritance graph
[legend]

Classes

class  transform
 Default transformation behaviour. More...
 
class  transformPosition
 Default transformation behaviour for position. More...
 

Public Member Functions

 ClassName ("mapDistribute")
 
 mapDistribute ()
 Construct null. More...
 
 mapDistribute (const label constructSize, const Xfer< labelListList > &subMap, const Xfer< labelListList > &constructMap)
 Construct from components. More...
 
 mapDistribute (const label constructSize, const Xfer< labelListList > &subMap, const Xfer< labelListList > &constructMap, const Xfer< labelListList > &transformElements, const Xfer< labelList > &transformStart)
 Construct from components. More...
 
 mapDistribute (const labelList &sendProcs, const labelList &recvProcs)
 Construct from reverse addressing: per data item the send. More...
 
 mapDistribute (const globalIndex &, labelList &elements, List< Map< label > > &compactMap, const int tag=Pstream::msgType())
 Construct from list of (possibly) remote elements in globalIndex. More...
 
 mapDistribute (const globalIndex &, labelListList &cellCells, List< Map< label > > &compactMap, const int tag=Pstream::msgType())
 Special variant that works with the info sorted into bins. More...
 
 mapDistribute (const globalIndex &, labelList &untransformedElements, const globalIndexAndTransform &, const labelPairList &transformedElements, labelList &transformedIndices, List< Map< label > > &compactMap, const int tag=Pstream::msgType())
 Construct from list of (possibly remote) untransformed elements. More...
 
 mapDistribute (const globalIndex &, labelListList &cellCells, const globalIndexAndTransform &, const List< labelPairList > &transformedElements, labelListList &transformedIndices, List< Map< label > > &compactMap, const int tag=Pstream::msgType())
 As above but with ListLists. More...
 
 mapDistribute (const Xfer< mapDistribute > &)
 Construct by transferring parameter content. More...
 
 mapDistribute (const mapDistribute &)
 Construct copy. More...
 
label constructSize () const
 Constructed data size. More...
 
labelconstructSize ()
 Constructed data size. More...
 
const labelListListsubMap () const
 From subsetted data back to original data. More...
 
labelListListsubMap ()
 From subsetted data back to original data. More...
 
const labelListListconstructMap () const
 From subsetted data to new reconstructed data. More...
 
labelListListconstructMap ()
 From subsetted data to new reconstructed data. More...
 
const labelListListtransformElements () const
 For every globalIndexAndTransform::transformPermutations. More...
 
const labelListtransformStart () const
 Destination in constructMap for transformed elements. More...
 
label whichTransform (const label index) const
 Find transform from transformElements. More...
 
const List< labelPair > & schedule () const
 Return a schedule. Demand driven. See above. More...
 
void transfer (mapDistribute &)
 Transfer the contents of the argument and annul the argument. More...
 
Xfer< mapDistributexfer ()
 Transfer contents to the Xfer container. More...
 
void compact (const boolList &elemIsUsed, const int tag=UPstream::msgType())
 Compact maps. Gets per field a bool whether it is used (locally) More...
 
template<class T >
void distribute (DynamicList< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Distribute data using default commsType. More...
 
template<class T >
void distribute (List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Distribute data using default commsType. More...
 
template<class T , class TransformOp >
void distribute (const globalIndexAndTransform &, List< T > &fld, const TransformOp &top, const int tag=UPstream::msgType()) const
 Same but with transforms. More...
 
template<class T >
void reverseDistribute (const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Reverse distribute data using default commsType. More...
 
template<class T , class TransformOp >
void reverseDistribute (const globalIndexAndTransform &, const label constructSize, List< T > &fld, const TransformOp &top, const int tag=UPstream::msgType()) const
 Same but with transforms. More...
 
template<class T >
void reverseDistribute (const label constructSize, const T &nullValue, List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Reverse distribute data using default commsType. More...
 
template<class T , class TransformOp >
void reverseDistribute (const globalIndexAndTransform &, const label constructSize, const T &nullValue, List< T > &fld, const TransformOp &top, const int tag=UPstream::msgType()) const
 Same but with transforms. More...
 
template<class T >
void send (PstreamBuffers &, const List< T > &) const
 Do all sends using PstreamBuffers. More...
 
template<class T >
void receive (PstreamBuffers &, List< T > &) const
 Do all receives using PstreamBuffers. More...
 
void printLayout (Ostream &os) const
 Debug: print layout. Can only be used on maps with sorted. More...
 
void updateMesh (const mapPolyMesh &)
 Correct for topo change. More...
 
void operator= (const mapDistribute &)
 

Static Public Member Functions

static List< labelPairschedule (const labelListList &subMap, const labelListList &constructMap, const int tag)
 Calculate a schedule. See above. More...
 
static label renumber (const globalIndex &, const List< Map< label > > &compactMap, const label globalElement)
 Helper for construct from globalIndex. Renumbers element. More...
 
template<class T >
static void distribute (const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const labelListList &constructMap, List< T > &, const int tag=UPstream::msgType())
 Distribute data. Note:schedule only used for Pstream::scheduled. More...
 
template<class T , class CombineOp >
static void distribute (const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const labelListList &constructMap, List< T > &, const CombineOp &cop, const T &nullValue, const int tag=UPstream::msgType())
 Distribute data. If multiple processors writing to same. More...
 

Friends

Istreamoperator>> (Istream &, mapDistribute &)
 Read dictionary from Istream. More...
 
Ostreamoperator<< (Ostream &, const mapDistribute &)
 Write dictionary to Ostream. More...
 

Detailed Description

Class containing processor-to-processor mapping information.

We store mapping from the bits-to-send to the complete starting list (subXXXMap) and from the received bits to their location in the new list (constructXXXMap).

Note: Schedule is a list of processor pairs (one send, one receive. One of them will be myself) which forms a scheduled (i.e. non-buffered) exchange. See distribute on how to use it. Note2: number of items sent on one processor have to equal the number of items received on the other processor.

To aid constructing these maps there are the constructors from global numbering, either with or without transforms.

It rewrites the input global indices into indices into the constructed data.

Any distribute with transforms is now done as: 1. exchange data with other processors and receive these into the slots for that processor 2. for all transformations transform a subset of the data according to transformElements_[transformI] and store this starting from transformStart_[transformI]

In the same way a reverse distribute will 1. apply the inverse transform to the data starting at transformStart_[transformI] and copy the result back into the transformElements_[transformI]. These might be local or remote slots. 2. the data in the remote slots will now be sent back to the correct location in the originating processor.

E.g. a map to handle

Source files

Definition at line 152 of file mapDistribute.H.

Constructor & Destructor Documentation

Construct null.

Definition at line 651 of file mapDistribute.C.

Referenced by mapDistribute::mapDistribute(), and mapDistribute::transformPosition::operator()().

Here is the caller graph for this function:

mapDistribute ( const label  constructSize,
const Xfer< labelListList > &  subMap,
const Xfer< labelListList > &  constructMap 
)

Construct from components.

Definition at line 660 of file mapDistribute.C.

References mapDistribute::mapDistribute().

Here is the call graph for this function:

mapDistribute ( const label  constructSize,
const Xfer< labelListList > &  subMap,
const Xfer< labelListList > &  constructMap,
const Xfer< labelListList > &  transformElements,
const Xfer< labelList > &  transformStart 
)

Construct from components.

Definition at line 675 of file mapDistribute.C.

References mapDistribute::mapDistribute().

Here is the call graph for this function:

mapDistribute ( const labelList sendProcs,
const labelList recvProcs 
)

Construct from reverse addressing: per data item the send.

processor and the receive processor. (note: data is not stored sorted per processor so cannot use printLayout).

Definition at line 693 of file mapDistribute.C.

References Foam::abort(), Foam::FatalError, FatalErrorIn, forAll, mapDistribute::mapDistribute(), UPstream::myProcNo(), UPstream::nProcs(), List< T >::setSize(), and List< T >::size().

Here is the call graph for this function:

mapDistribute ( const globalIndex globalNumbering,
labelList elements,
List< Map< label > > &  compactMap,
const int  tag = Pstream::msgType() 
)

Construct from list of (possibly) remote elements in globalIndex.

numbering (or -1). Determines compact numbering (see above) and distribute map to get data into this ordering and renumbers the elements to be in compact numbering.

Definition at line 767 of file mapDistribute.C.

References mapDistribute::mapDistribute(), Foam::Pout, and mapDistribute::printLayout().

Here is the call graph for this function:

mapDistribute ( const globalIndex globalNumbering,
labelListList cellCells,
List< Map< label > > &  compactMap,
const int  tag = Pstream::msgType() 
)

Special variant that works with the info sorted into bins.

according to local indices. E.g. think cellCells where cellCells[localCellI] is a list of global cells

Definition at line 825 of file mapDistribute.C.

References mapDistribute::mapDistribute(), Foam::Pout, and mapDistribute::printLayout().

Here is the call graph for this function:

mapDistribute ( const globalIndex globalNumbering,
labelList untransformedElements,
const globalIndexAndTransform globalTransforms,
const labelPairList transformedElements,
labelList transformedIndices,
List< Map< label > > &  compactMap,
const int  tag = Pstream::msgType() 
)

Construct from list of (possibly remote) untransformed elements.

in globalIndex numbering (or -1) and (possibly remote) transformded elements in globalIndexAndTransform numbering. Determines compact numbering (see above) and distribute map to get data into this ordering and renumbers the elements to be in compact numbering.

Definition at line 883 of file mapDistribute.C.

References forAll, globalIndexAndTransform::index(), mapDistribute::mapDistribute(), UPstream::myProcNo(), n, Foam::Pout, mapDistribute::printLayout(), globalIndexAndTransform::processor(), List< T >::setSize(), List< T >::size(), globalIndexAndTransform::transformIndex(), and globalIndexAndTransform::transformPermutations().

Here is the call graph for this function:

mapDistribute ( const globalIndex globalNumbering,
labelListList cellCells,
const globalIndexAndTransform globalTransforms,
const List< labelPairList > &  transformedElements,
labelListList transformedIndices,
List< Map< label > > &  compactMap,
const int  tag = Pstream::msgType() 
)
mapDistribute ( const Xfer< mapDistribute > &  map)

Construct by transferring parameter content.

Definition at line 1118 of file mapDistribute.C.

mapDistribute ( const mapDistribute map)

Construct copy.

Definition at line 1107 of file mapDistribute.C.

Member Function Documentation

ClassName ( "mapDistribute"  )

Referenced by mapDistribute::transformPosition::operator()().

Here is the caller graph for this function:

label constructSize ( ) const
inline
label& constructSize ( )
inline

Constructed data size.

Definition at line 467 of file mapDistribute.H.

const labelListList& subMap ( ) const
inline
labelListList& subMap ( )
inline

From subsetted data back to original data.

Definition at line 479 of file mapDistribute.H.

const labelListList& constructMap ( ) const
inline
labelListList& constructMap ( )
inline

From subsetted data to new reconstructed data.

Definition at line 491 of file mapDistribute.H.

References mapDistribute::transformElements().

Here is the call graph for this function:

const labelListList& transformElements ( ) const
inline

For every globalIndexAndTransform::transformPermutations.

gives the elements that need to be transformed

Definition at line 498 of file mapDistribute.H.

Referenced by mapDistribute::constructMap(), and mapDistribute::transformPosition::operator()().

Here is the caller graph for this function:

const labelList& transformStart ( ) const
inline
Foam::label whichTransform ( const label  index) const

Find transform from transformElements.

Definition at line 1131 of file mapDistribute.C.

References Foam::findLower().

Referenced by mapDistribute::transformStart().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::List< Foam::labelPair > schedule ( const labelListList subMap,
const labelListList constructMap,
const int  tag 
)
static
const Foam::List< Foam::labelPair > & schedule ( ) const

Return a schedule. Demand driven. See above.

Definition at line 263 of file mapDistribute.C.

References Foam::abort(), Foam::FatalError, FatalErrorIn, and UPstream::msgType().

Referenced by mapDistribute::distribute(), mapDistribute::transform::operator()(), mapDistribute::reverseDistribute(), and mapDistribute::transformStart().

Here is the call graph for this function:

Here is the caller graph for this function:

void transfer ( mapDistribute rhs)

Transfer the contents of the argument and annul the argument.

Definition at line 1137 of file mapDistribute.C.

References List< T >::transfer().

Referenced by IOmapDistribute::IOmapDistribute(), and mapDistribute::transformStart().

Here is the call graph for this function:

Here is the caller graph for this function:

Transfer contents to the Xfer container.

Definition at line 1148 of file mapDistribute.C.

References mapDistribute::renumber(), and Foam::xferMove().

Referenced by minEqOp< labelPair >::operator()(), and mapDistribute::transformStart().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::label renumber ( const globalIndex globalNumbering,
const List< Map< label > > &  compactMap,
const label  globalElement 
)
static

Helper for construct from globalIndex. Renumbers element.

(in globalIndex numbering) into compact indices.

Definition at line 1155 of file mapDistribute.C.

References globalIndex::isLocal(), globalIndex::toLocal(), and globalIndex::whichProcID().

Referenced by mapDistribute::transformStart(), and mapDistribute::xfer().

Here is the call graph for this function:

Here is the caller graph for this function:

void compact ( const boolList elemIsUsed,
const int  tag = UPstream::msgType() 
)

Compact maps. Gets per field a bool whether it is used (locally)

and works out itself what this side and sender side can remove from maps.

Definition at line 1178 of file mapDistribute.C.

References UList< T >::begin(), forAll, Foam::max(), UPstream::myProcNo(), UPstream::nonBlocking, UPstream::nProcs(), UPstream::nRequests(), UPstream::parRun(), UIPstream::read(), List< T >::setSize(), List< T >::size(), List< T >::transfer(), UPstream::waitRequests(), and UOPstream::write().

Referenced by mapDistribute::transformStart().

Here is the call graph for this function:

Here is the caller graph for this function:

void distribute ( const Pstream::commsTypes  commsType,
const List< labelPair > &  schedule,
const label  constructSize,
const labelListList subMap,
const labelListList constructMap,
List< T > &  field,
const int  tag = UPstream::msgType() 
)
static

Distribute data. Note:schedule only used for Pstream::scheduled.

for now, all others just use send-to-all, receive-from-all.

Definition at line 37 of file mapDistributeTemplates.C.

References Foam::abort(), UList< T >::begin(), UList< T >::byteSize(), Foam::FatalError, FatalErrorIn, PstreamBuffers::finishedSends(), forAll, Foam::read(), List< T >::setSize(), List< T >::size(), List< T >::transfer(), and write().

Referenced by extendedCellToFaceStencil::collectData(), extendedFaceToCellStencil::collectData(), PointEdgeWave< Type, TrackingData >::countPatchType(), mappedPatchBase::distribute(), mapDistribute::distribute(), mapDistributePolyMesh::distributeCellData(), mapDistributePolyMesh::distributeFaceData(), mapDistributeLagrangian::distributeLagrangianData(), mapDistributePolyMesh::distributePatchData(), mapDistributePolyMesh::distributePointData(), distributedTriSurfaceMesh::findNearest(), sampledPatchInternalField::interpolateField(), AMIInterpolation< SourcePatch, TargetPatch >::interpolateToSource(), AMIInterpolation< SourcePatch, TargetPatch >::interpolateToTarget(), mappedPatchFieldBase< Type >::mappedField(), meshToMesh::mapSrcToTgt(), meshToMesh::mapTgtToSrc(), globalMeshData::mergePoints(), NamedEnum< Enum, nEnum >::names(), PatchTools::pointNormals(), mapDistribute::receive(), mappedPatchBase::reverseDistribute(), mapDistribute::reverseDistribute(), globalMeshData::syncData(), pointConstraints::syncUntransformedData(), thermalBaffle1DFvPatchScalarField< solidType >::thermalBaffle1DFvPatchScalarField(), mapDistribute::transformStart(), thermalBaffle1DFvPatchScalarField< solidType >::updateCoeffs(), AMIInterpolation< SourcePatch, TargetPatch >::wordTointerpolationMethod(), streamLine::write(), and wallBoundedStreamLine::write().

Here is the call graph for this function:

Here is the caller graph for this function:

void distribute ( const Pstream::commsTypes  commsType,
const List< labelPair > &  schedule,
const label  constructSize,
const labelListList subMap,
const labelListList constructMap,
List< T > &  field,
const CombineOp &  cop,
const T nullValue,
const int  tag = UPstream::msgType() 
)
static

Distribute data. If multiple processors writing to same.

position adds contributions using cop.

Definition at line 387 of file mapDistributeTemplates.C.

References Foam::abort(), UList< T >::begin(), Foam::FatalError, FatalErrorIn, PstreamBuffers::finishedSends(), forAll, Foam::read(), List< T >::setSize(), List< T >::size(), T, List< T >::transfer(), and write().

Here is the call graph for this function:

void distribute ( DynamicList< T > &  fld,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const

Distribute data using default commsType.

Definition at line 893 of file mapDistributeTemplates.C.

References mapDistribute::distribute(), fld(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::setCapacity(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::shrink(), and List< T >::size().

Here is the call graph for this function:

void distribute ( List< T > &  fld,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const

Distribute data using default commsType.

Fill in transformed slots with copies

Definition at line 912 of file mapDistributeTemplates.C.

References UPstream::blocking, UPstream::defaultCommsType, mapDistribute::distribute(), UPstream::nonBlocking, mapDistribute::reverseDistribute(), mapDistribute::schedule(), and UPstream::scheduled.

Here is the call graph for this function:

void distribute ( const globalIndexAndTransform git,
List< T > &  fld,
const TransformOp &  top,
const int  tag = UPstream::msgType() 
) const

Same but with transforms.

Distribute data using default commsType.

Definition at line 1092 of file mapDistributeTemplates.C.

References mapDistribute::distribute(), and mapDistribute::reverseDistribute().

Here is the call graph for this function:

void reverseDistribute ( const label  constructSize,
List< T > &  fld,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const
void reverseDistribute ( const globalIndexAndTransform git,
const label  constructSize,
List< T > &  fld,
const TransformOp &  top,
const int  tag = UPstream::msgType() 
) const

Same but with transforms.

Definition at line 1108 of file mapDistributeTemplates.C.

References mapDistribute::reverseDistribute().

Here is the call graph for this function:

void reverseDistribute ( const label  constructSize,
const T nullValue,
List< T > &  fld,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const

Reverse distribute data using default commsType.

Since constructSize might be larger than supplied size supply a nullValue

Definition at line 1028 of file mapDistributeTemplates.C.

References UPstream::blocking, UPstream::defaultCommsType, mapDistribute::distribute(), UPstream::nonBlocking, mapDistribute::schedule(), and UPstream::scheduled.

Here is the call graph for this function:

void reverseDistribute ( const globalIndexAndTransform git,
const label  constructSize,
const T nullValue,
List< T > &  fld,
const TransformOp &  top,
const int  tag = UPstream::msgType() 
) const

Same but with transforms.

Definition at line 1128 of file mapDistributeTemplates.C.

References mapDistribute::reverseDistribute().

Here is the call graph for this function:

void send ( PstreamBuffers pBufs,
const List< T > &  field 
) const

Do all sends using PstreamBuffers.

Definition at line 732 of file mapDistributeTemplates.C.

References PstreamBuffers::finishedSends(), UPstream::nProcs(), and List< T >::size().

Referenced by InteractionLists< ParticleType >::sendReferredData(), and mapDistribute::transformStart().

Here is the call graph for this function:

Here is the caller graph for this function:

void receive ( PstreamBuffers pBufs,
List< T > &  field 
) const
void printLayout ( Ostream os) const

Debug: print layout. Can only be used on maps with sorted.

storage (local data first, then non-local data)

Definition at line 308 of file mapDistribute.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorIn, forAll, forAllIter, Foam::identity(), globalIndex::isLocal(), Foam::labelMax, Foam::labelMin, globalIndex::localSize(), Foam::max(), Foam::min(), UPstream::myProcNo(), UPstream::nProcs(), Foam::renumber(), List< T >::setSize(), List< T >::size(), globalIndex::toLocal(), globalIndex::whichProcID(), and UPstream::worldComm.

Referenced by mapDistribute::mapDistribute(), and mapDistribute::transformStart().

Here is the call graph for this function:

Here is the caller graph for this function:

void updateMesh ( const mapPolyMesh )
inline

Correct for topo change.

Definition at line 666 of file mapDistribute.H.

References fld(), notImplemented, mapDistribute::operator<<, mapDistribute::operator=(), and mapDistribute::operator>>.

Here is the call graph for this function:

void operator= ( const mapDistribute rhs)

Definition at line 1324 of file mapDistribute.C.

References Foam::abort(), IOstream::fatalCheck(), Foam::FatalError, FatalErrorIn, token::NL, Foam::operator<<(), and Foam::operator>>().

Referenced by IOmapDistribute::IOmapDistribute(), and mapDistribute::updateMesh().

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

Istream& operator>> ( Istream ,
mapDistribute  
)
friend

Read dictionary from Istream.

Referenced by mapDistribute::updateMesh().

Ostream& operator<< ( Ostream ,
const mapDistribute  
)
friend

Write dictionary to Ostream.

Referenced by mapDistribute::updateMesh().


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