Zoltan2 Version of the Day
Public Types | Public Member Functions
Zoltan2::IdentifierMap< User > Class Template Reference

An IdentifierMap manages a global space of object identifiers. More...

#include <Zoltan2_IdentifierMap.hpp>

List of all members.

Public Types

typedef InputTraits< User >::lno_t lno_t
 Constructor - Must be called by all processes.
typedef InputTraits< User >::gno_t gno_t
typedef InputTraits< User >::gid_t gid_t

Public Member Functions

 IdentifierMap (const RCP< const Environment > &env, const RCP< const Comm< int > > &comm, const ArrayRCP< const gid_t > &gids, bool gidsMustBeConsecutive=false)
 ~IdentifierMap ()
 Destructor.
 IdentifierMap (const IdentifierMap &id)
 Copy Constructor.
IdentifierMapoperator= (const IdentifierMap &id)
 Assignment operator.
bool gnosAreGids () const
 Return true if we are using the application global IDs for our internal global numbers.
gno_t getGlobalNumberOfIds () const
 Return the global number of identifiers.
gno_t getLocalNumberOfIds () const
 Return the local number of identifiers.
void getGnoRange (gno_t &min, gno_t &max) const
 Return the minimum and maximum values of the internal global numbers.
bool gnosAreConsecutive () const
 Return true if our internal global numbers are consecutive.
bool consecutiveGnosAreRequired () const
 Return true if consecutive Gids are required.
gno_t getMinimumGlobalId () const
 Return the minimum Zoltan2 global Id across all processes.
gno_t getMaximumGlobalId () const
 Return the maximum Zoltan2 global Id across all processes.
void gidTranslate (ArrayView< gid_t > gid, ArrayView< gno_t > gno, TranslationType tt) const
 Map the application global IDs to internal global numbers or vice versa.
void lnoTranslate (ArrayView< lno_t > lno, ArrayView< gno_t > gno, TranslationType tt) const
 Map application indices to internal global numbers or vice versa.
void gidGlobalTranslate (ArrayView< const gid_t > in_gid, ArrayView< gno_t > out_gno, ArrayView< int > out_proc) const
 Map application global IDs to internal global numbers and/or process owners.
void gnoGlobalTranslate (ArrayView< const gno_t > in_gno, ArrayView< gid_t > out_gid, ArrayView< int > out_proc) const
 Map library internal global numbers to application GIDs, and their process owners.

Detailed Description

template<typename User>
class Zoltan2::IdentifierMap< User >

An IdentifierMap manages a global space of object identifiers.

Data types:

The template parameter User is a user-defined data type which, through a traits mechanism, provides the actual data types with which the Zoltan2 library will be compiled. User may be the actual class or structure used by application to represent a vector, or it may be the helper class BasicUserTypes. See InputTraits for more information.

Todo:
test for global IDs that are std::pair<T1, T2>
Todo:
we require that user's gid_ts have base zero if we are to use them as consecutive gno_ts. This can be fixed if needed. We are not getting the efficiency advantage of using the user's gids simply because those IDs do not have base 0. We can add a flag about base 0 being required, and then map only if base 0 is required.

Definition at line 106 of file Zoltan2_IdentifierMap.hpp.


Member Typedef Documentation

template<typename User >
typedef InputTraits<User>::lno_t Zoltan2::IdentifierMap< User >::lno_t

Constructor - Must be called by all processes.

Parameters:
envthe problem and library environment
commthe problem communicator
gidsthe application global IDs
gidsMustBeConsecutiveset to true if the algorithm or third party library requires consective ids If necessary the IdentifierMap will map the application's global IDs to consecutive integral IDs beginning at zero.

Definition at line 121 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
typedef InputTraits<User>::gno_t Zoltan2::IdentifierMap< User >::gno_t

Definition at line 122 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
typedef InputTraits<User>::gid_t Zoltan2::IdentifierMap< User >::gid_t

Definition at line 123 of file Zoltan2_IdentifierMap.hpp.


Constructor & Destructor Documentation

template<typename User >
Zoltan2::IdentifierMap< User >::IdentifierMap ( const RCP< const Environment > &  env,
const RCP< const Comm< int > > &  comm,
const ArrayRCP< const gid_t > &  gids,
bool  gidsMustBeConsecutive = false 
) [explicit]

Definition at line 317 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
Zoltan2::IdentifierMap< User >::~IdentifierMap ( ) [inline]

Destructor.

Definition at line 131 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
Zoltan2::IdentifierMap< User >::IdentifierMap ( const IdentifierMap< User > &  id)

Copy Constructor.


Member Function Documentation

template<typename User >
IdentifierMap& Zoltan2::IdentifierMap< User >::operator= ( const IdentifierMap< User > &  id)

Assignment operator.

template<typename User >
bool Zoltan2::IdentifierMap< User >::gnosAreGids ( ) const

Return true if we are using the application global IDs for our internal global numbers.

Definition at line 338 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
gno_t Zoltan2::IdentifierMap< User >::getGlobalNumberOfIds ( ) const [inline]

Return the global number of identifiers.

Definition at line 146 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
gno_t Zoltan2::IdentifierMap< User >::getLocalNumberOfIds ( ) const [inline]

Return the local number of identifiers.

Definition at line 150 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
void Zoltan2::IdentifierMap< User >::getGnoRange ( gno_t min,
gno_t max 
) const

Return the minimum and maximum values of the internal global numbers.

Definition at line 344 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
bool Zoltan2::IdentifierMap< User >::gnosAreConsecutive ( ) const

Return true if our internal global numbers are consecutive.

Definition at line 351 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
bool Zoltan2::IdentifierMap< User >::consecutiveGnosAreRequired ( ) const

Return true if consecutive Gids are required.

Definition at line 357 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
InputTraits< User >::gno_t Zoltan2::IdentifierMap< User >::getMinimumGlobalId ( ) const

Return the minimum Zoltan2 global Id across all processes.

Definition at line 363 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
InputTraits< User >::gno_t Zoltan2::IdentifierMap< User >::getMaximumGlobalId ( ) const

Return the maximum Zoltan2 global Id across all processes.

Definition at line 369 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
void Zoltan2::IdentifierMap< User >::gidTranslate ( ArrayView< gid_t gid,
ArrayView< gno_t gno,
TranslationType  tt 
) const

Map the application global IDs to internal global numbers or vice versa.

Parameters:
gidan array of caller's global IDs
gnoan array of Zoltan2 global numbers
ttshould be TRANSLATE_APP_TO_LIB or TRANSLATE_LIB_TO_APP

Both gid and gno are preallocated by the caller.

This is a local call. If gid is a vector of application global IDs, then gno will be set to the corresponding internal global numbers. If the gno vector contains internal global numbers, they will be translated to application global IDs. The application global IDs must be from those supplied by this process.

Todo:
If the gnos need to be translated to gids, check first to see if the gnos are in their original order. If so, we can save memory by returning an arrayview of the gids.

Definition at line 375 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
void Zoltan2::IdentifierMap< User >::lnoTranslate ( ArrayView< lno_t lno,
ArrayView< gno_t gno,
TranslationType  tt 
) const

Map application indices to internal global numbers or vice versa.

Parameters:
lnoan array of indices
gnoan array of Zoltan2 global numbers
ttshould be TRANSLATE_APP_TO_LIB or TRANSLATE_LIB_TO_APP

This is a local call.

If gno contains a list of Zoltan2 internal global numbers, then lno[i] on return will be the index at which the application's global ID associated with gno[i] appeared in the input adapter's "get" method list. In this case, lno should be pre-allocated by the caller, and tt should be TRANSLATE_LIB_TO_APP.

Similarly, if lno contains a list of indices ranging from 0 to N-1 (where N would be the local number of objects), then gno[i] on return will be the internal global number associated with the application's global ID that appeared in location lno[i] in the input adapter's "get" method list. In this case, gno should be pre-allocated by the caller and tt should be TRANSLATE_APP_TO_LIB.

Definition at line 446 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
void Zoltan2::IdentifierMap< User >::gidGlobalTranslate ( ArrayView< const gid_t in_gid,
ArrayView< gno_t out_gno,
ArrayView< int >  out_proc 
) const

Map application global IDs to internal global numbers and/or process owners.

Parameters:
in_gidinput, an array of the global IDs
out_gnooutput, an optional array of the corresponding global numbers used by Zoltan2. If out_gno.size() is zero, we assume global numbers are not needed.
out_procoutput, an optional array of the corresponding process ranks owning the global Ids. If out_proc.size() is zero, we assume process ranks are not needed.

If in_gid[i] is not one of the global Ids supplied in this problem, then out_proc[i] will be -1, and out_gno[i] (if requested) is undefined. This behavior supports graph subsetting.

All processes must call this. The global IDs supplied may belong to another process.

Definition at line 517 of file Zoltan2_IdentifierMap.hpp.

template<typename User >
void Zoltan2::IdentifierMap< User >::gnoGlobalTranslate ( ArrayView< const gno_t in_gno,
ArrayView< gid_t out_gid,
ArrayView< int >  out_proc 
) const

Map library internal global numbers to application GIDs, and their process owners.

Parameters:
in_gnoinput, an array of the global numbers.
out_gidoutput, an optional array of the corresponding user global Ids. If out_gid.size() is zero, we assume global Ids are not desired.
out_procoutput, an optional array of the corresponding process ranks owning the global numbers. If out_proc.size() is zero, we assume process ranks are not needed.

Global numbers are always consecutive numbers beginning with zero. If the global number is out of range, a std::runtime_error() is thrown.

All processes must call this. The global numbers supplied may belong to another process.

Definition at line 862 of file Zoltan2_IdentifierMap.hpp.


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