dune-common  2.4
Public Types | Public Member Functions | Friends | List of all members
Dune::RemoteIndices< T, A > Class Template Reference

The indices present on remote processes. More...

#include <dune/common/parallel/remoteindices.hh>

Public Types

typedef T ParallelIndexSet
 Type of the index set we use, e.g. ParallelLocalIndexSet. More...
 
typedef CollectiveIterator< T, A > CollectiveIteratorT
 The type of the collective iterator over all remote indices. More...
 
typedef ParallelIndexSet::GlobalIndex GlobalIndex
 The type of the global index. More...
 
typedef ParallelIndexSet::LocalIndex LocalIndex
 The type of the local index. More...
 
typedef LocalIndex::Attribute Attribute
 The type of the attribute. More...
 
typedef Dune::RemoteIndex< GlobalIndex, AttributeRemoteIndex
 Type of the remote indices we manage. More...
 
typedef A::template rebind< RemoteIndex >::other Allocator
 The type of the allocator for the remote index list. More...
 
typedef Dune::SLList< RemoteIndex, AllocatorRemoteIndexList
 The type of the remote index list. More...
 
typedef std::map< int, std::pair< RemoteIndexList *, RemoteIndexList * > > RemoteIndexMap
 The type of the map from rank to remote index list. More...
 
typedef RemoteIndexMap::const_iterator const_iterator
 

Public Member Functions

 RemoteIndices (const ParallelIndexSet &source, const ParallelIndexSet &destination, const MPI_Comm &comm, const std::vector< int > &neighbours=std::vector< int >(), bool includeSelf=false)
 Constructor. More...
 
 RemoteIndices ()
 
void setIncludeSelf (bool includeSelf)
 Tell whether sending from indices of the processor to other indices on the same processor is enabled even if the same indexset is used on both the sending and receiving side. More...
 
void setIndexSets (const ParallelIndexSet &source, const ParallelIndexSet &destination, const MPI_Comm &comm, const std::vector< int > &neighbours=std::vector< int >())
 Set the index sets and communicator we work with. More...
 
template<typename C >
void setNeighbours (const C &neighbours)
 
const std::set< int > & getNeighbours () const
 
 ~RemoteIndices ()
 Destructor. More...
 
template<bool ignorePublic>
void rebuild ()
 Rebuilds the set of remote indices. More...
 
bool operator== (const RemoteIndices &ri)
 
bool isSynced () const
 Checks whether the remote indices are synced with the indexsets. More...
 
MPI_Comm communicator () const
 Get the mpi communicator used. More...
 
template<bool mode, bool send>
RemoteIndexListModifier< T, A, mode > getModifier (int process)
 Get a modifier for a remote index list. More...
 
const_iterator find (int proc) const
 Find an iterator over the remote index lists of a specific process. More...
 
const_iterator begin () const
 Get an iterator over all remote index lists. More...
 
const_iterator end () const
 Get an iterator over all remote index lists. More...
 
template<bool send>
CollectiveIteratorT iterator () const
 Get an iterator for colletively iterating over the remote indices of all remote processes. More...
 
void free ()
 Free the index lists. More...
 
int neighbours () const
 Get the number of processors we share indices with. More...
 
const ParallelIndexSetsourceIndexSet () const
 Get the index set at the source. More...
 
const ParallelIndexSetdestinationIndexSet () const
 Get the index set at destination. More...
 
template<bool ignorePublic>
void packEntries (IndexPair< GlobalIndex, LocalIndex > **pairs, const ParallelIndexSet &indexSet, char *p_out, MPI_Datatype type, int bufferSize, int *position, int n)
 

Friends

template<typename T1 , typename A2 , typename A1 >
void repairLocalIndexPointers (std::map< int, SLList< std::pair< typename T1::GlobalIndex, typename T1::LocalIndex::Attribute >, A2 > > &, RemoteIndices< T1, A1 > &, const T1 &)
 
template<class G , class T1 , class T2 >
void fillIndexSetHoles (const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm)
 
std::ostream & operator<< (std::ostream &, const RemoteIndices< T > &)
 

Detailed Description

template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
class Dune::RemoteIndices< T, A >

The indices present on remote processes.

To set up communication between the set of processes active in the communication every process needs to know which indices are also known to other processes and which attributes are attached to them on the remote side.

This information is managed by this class. The information can either be computed automatically calling rebuild (which requires information to be sent in a ring) or set up by hand using the RemoteIndexListModifiers returned by function getModifier(int).

Template Parameters
TThe type of the underlying index set.
AThe type of the allocator to use.

Member Typedef Documentation

template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
typedef A::template rebind<RemoteIndex>::other Dune::RemoteIndices< T, A >::Allocator

The type of the allocator for the remote index list.

template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
typedef LocalIndex::Attribute Dune::RemoteIndices< T, A >::Attribute

The type of the attribute.

template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
typedef CollectiveIterator<T,A> Dune::RemoteIndices< T, A >::CollectiveIteratorT

The type of the collective iterator over all remote indices.

template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
typedef RemoteIndexMap::const_iterator Dune::RemoteIndices< T, A >::const_iterator
template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
typedef ParallelIndexSet::GlobalIndex Dune::RemoteIndices< T, A >::GlobalIndex

The type of the global index.

template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
typedef ParallelIndexSet::LocalIndex Dune::RemoteIndices< T, A >::LocalIndex

The type of the local index.

template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
typedef T Dune::RemoteIndices< T, A >::ParallelIndexSet

Type of the index set we use, e.g. ParallelLocalIndexSet.

template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
typedef Dune::RemoteIndex<GlobalIndex,Attribute> Dune::RemoteIndices< T, A >::RemoteIndex

Type of the remote indices we manage.

template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
typedef Dune::SLList<RemoteIndex,Allocator> Dune::RemoteIndices< T, A >::RemoteIndexList

The type of the remote index list.

template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
typedef std::map<int, std::pair<RemoteIndexList*,RemoteIndexList*> > Dune::RemoteIndices< T, A >::RemoteIndexMap

The type of the map from rank to remote index list.

Constructor & Destructor Documentation

template<typename T , typename A >
Dune::RemoteIndices< T, A >::RemoteIndices ( const ParallelIndexSet source,
const ParallelIndexSet destination,
const MPI_Comm &  comm,
const std::vector< int > &  neighbours = std::vector<int>(),
bool  includeSelf = false 
)
inline

Constructor.

Parameters
commThe communicator to use.
sourceThe indexset which represents the global to local mapping at the source of the communication
destinationThe indexset to which the communication which represents the global to local mapping at the destination of the communication. May be the same as the source indexset.
neighboursOptional: The neighbours the process shares indices with. If this parameter is omitted a ring communication with all indices will take place to calculate this information which is O(P).
includeSelfIf true, sending from indices of the processor to other indices on the same processor is enabled even if the same indexset is used on both the sending and receiving side.

References Dune::RemoteIndices< T, A >::setNeighbours().

template<typename T , typename A >
Dune::RemoteIndices< T, A >::RemoteIndices ( )
template<typename T , typename A >
Dune::RemoteIndices< T, A >::~RemoteIndices ( )

Destructor.

Member Function Documentation

template<typename T , typename A >
RemoteIndices< T, A >::const_iterator Dune::RemoteIndices< T, A >::begin ( ) const
inline

Get an iterator over all remote index lists.

Returns
The iterator over all remote index lists postioned at the first process.

Referenced by Dune::storeGlobalIndicesOfRemoteIndices(), and Dune::IndicesSyncer< T >::sync().

template<typename T , typename A >
MPI_Comm Dune::RemoteIndices< T, A >::communicator ( ) const
inline

Get the mpi communicator used.

Referenced by Dune::IndicesSyncer< T >::IndicesSyncer().

template<typename T , typename A >
const RemoteIndices< T, A >::ParallelIndexSet & Dune::RemoteIndices< T, A >::destinationIndexSet ( ) const
inline

Get the index set at destination.

template<typename T , typename A >
RemoteIndices< T, A >::const_iterator Dune::RemoteIndices< T, A >::end ( ) const
inline

Get an iterator over all remote index lists.

Returns
The iterator over all remote index lists postioned at the end.

Referenced by Dune::InterfaceBuilder::buildInterface(), Dune::storeGlobalIndicesOfRemoteIndices(), and Dune::IndicesSyncer< T >::sync().

template<typename T , typename A >
RemoteIndices< T, A >::const_iterator Dune::RemoteIndices< T, A >::find ( int  proc) const
inline

Find an iterator over the remote index lists of a specific process.

Parameters
procThe identifier of the process.
Returns
The iterator the remote index lists postioned at the process. If theres is no list for this process, the end iterator is returned.
template<typename T , typename A >
void Dune::RemoteIndices< T, A >::free ( )
inline

Free the index lists.

template<typename T , typename A >
template<bool mode, bool send>
RemoteIndexListModifier< T, A, mode > Dune::RemoteIndices< T, A >::getModifier ( int  process)
inline

Get a modifier for a remote index list.

Sometimes the user knows in advance which indices will be present on other processors, too. Then he can set them up using this modifier.

Warning
Use with care. If the remote index list is inconsistent after the modification the communication might result in a dead lock!
Template Parameters
modeIf true the index set corresponding to the remote indices might get modified. Therefore the internal pointers to the indices need to be repaired.
sendIf true the remote index information at the sending side will be modified, if false the receiving side.
template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
const std::set<int>& Dune::RemoteIndices< T, A >::getNeighbours ( ) const
inline
template<typename T , typename A >
bool Dune::RemoteIndices< T, A >::isSynced ( ) const
inline

Checks whether the remote indices are synced with the indexsets.

If they are not synced the remote indices need to be rebuild.

Returns
True if they are synced.
template<typename T , typename A >
template<bool send>
RemoteIndices< T, A >::CollectiveIteratorT Dune::RemoteIndices< T, A >::iterator ( ) const
inline

Get an iterator for colletively iterating over the remote indices of all remote processes.

template<typename T , typename A >
int Dune::RemoteIndices< T, A >::neighbours ( ) const
inline

Get the number of processors we share indices with.

Returns
The number of neighbours.

Referenced by Dune::RemoteIndices< T, A >::operator==(), Dune::repairLocalIndexPointers(), and Dune::IndicesSyncer< T >::sync().

template<typename T , typename A >
bool Dune::RemoteIndices< T, A >::operator== ( const RemoteIndices< T, A > &  ri)
template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
template<bool ignorePublic>
void Dune::RemoteIndices< T, A >::packEntries ( IndexPair< GlobalIndex, LocalIndex > **  pairs,
const ParallelIndexSet indexSet,
char *  p_out,
MPI_Datatype  type,
int  bufferSize,
int *  position,
int  n 
)
inline

References DUNE_UNUSED_PARAMETER.

template<typename T , typename A >
template<bool ignorePublic>
void Dune::RemoteIndices< T, A >::rebuild ( )
inline

Rebuilds the set of remote indices.

This has to be called whenever the underlying index sets change.

If the template parameter ignorePublic is true all indices will be treated as public.

template<typename T , typename A >
void Dune::RemoteIndices< T, A >::setIncludeSelf ( bool  includeSelf)

Tell whether sending from indices of the processor to other indices on the same processor is enabled even if the same indexset is used on both the sending and receiving side.

Parameters
includeSelfIf true it is enabled.
template<class T , typename A >
void Dune::RemoteIndices< T, A >::setIndexSets ( const ParallelIndexSet source,
const ParallelIndexSet destination,
const MPI_Comm &  comm,
const std::vector< int > &  neighbours = std::vector<int>() 
)

Set the index sets and communicator we work with.

Warning
All remote indices already setup will be deleted!
Parameters
commThe communicator to use.
sourceThe indexset which represents the global to local mapping at the source of the communication
destinationThe indexset to which the communication which represents the global to local mapping at the destination of the communication. May be the same as the source indexset.
neighboursOptional: The neighbours the process shares indices with. If this parameter is omitted a ring communication with all indices will take place to calculate this information which is O(P).
template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
template<typename C >
void Dune::RemoteIndices< T, A >::setNeighbours ( const C &  neighbours)
inline
template<typename T , typename A >
const RemoteIndices< T, A >::ParallelIndexSet & Dune::RemoteIndices< T, A >::sourceIndexSet ( ) const
inline

Get the index set at the source.

Friends And Related Function Documentation

template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
template<class G , class T1 , class T2 >
void fillIndexSetHoles ( const G &  graph,
Dune::OwnerOverlapCopyCommunication< T1, T2 > &  oocomm 
)
friend
template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
std::ostream& operator<< ( std::ostream &  ,
const RemoteIndices< T > &   
)
friend
template<class T, class A = std::allocator<RemoteIndex<typename T::GlobalIndex, typename T::LocalIndex::Attribute> >>
template<typename T1 , typename A2 , typename A1 >
void repairLocalIndexPointers ( std::map< int, SLList< std::pair< typename T1::GlobalIndex, typename T1::LocalIndex::Attribute >, A2 > > &  ,
RemoteIndices< T1, A1 > &  ,
const T1 &   
)
friend

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