|
Zoltan2
|
The functions to be defined for users' global ID types. More...
#include <Zoltan2_IdentifierTraits.hpp>
Static Public Member Functions | |
| static int | hashCode (const T id) |
| Compute an integer hash code for the user's global ID. | |
| static bool | hasUniqueKey () |
| Determine if the data type supports unique hash keys. | |
| static double | key (const T c) |
| Return a double which is a unique key for the value. | |
| static std::string | name () |
| The name of the identifier data type. | |
| static std::string | stringify (T val) |
| A string displaying the value. | |
| static bool | isGlobalOrdinal () |
| Determine whether the data type can be a Teuchos Ordinal. | |
| static T | difference (const T a, const T b) |
| Compute b - a, if possible. | |
| static bool | is_valid_id_type () |
| Determine if the data type is one for which IdentifierTraits are defined. | |
| static void | minMax (const T *values, size_t numValues, T &min, T &max) |
| Return the minimum and maximum of a list of values. | |
| static void | globalMinMax (const Comm< int > &comm, bool flag, T localMin, T localMax, T &globalMin, T &globalMax) |
| Find global minimum and maximum. | |
| static bool | areConsecutive (const T *val, size_t n) |
| Determine if the values are locally increasing consecutive. | |
The functions to be defined for users' global ID types.
The template parameter is the user's global ID data type.
The data types permitted for global identifiers for Zoltan2 callers may include those that are not represented in Teuchos::OrdinalTraits. A common case is when a matrix nonzero is represented as an (i,j) pair.
In such a case, Zoltan2 will map them to a list of new IDs that are Teuchos Ordinals. All computation will be in the space of the new global numbers. When the Solution object is written, the internal global numbers are mapped back to the user's global IDs.
During this process of determining if the user's IDs can be used by Zoltan2, and mapping them to new global numbers if they can not, the Traits defined here are used to manipulate the user's IDs.
Traits are defined for the following types:
The long long and unsigned long long traits are only defined if Trilinos was configured with the TEUCHOS_ENABLE_LONG_LONG_INT option.
If the user's global ID type does not appear in the above list, it can be added by the user in his or her application code. See the example in tobeWritten.cpp.
i and j indices.zgid_t as the users global ID data type and gno_t as the data type used internally by Zoltan2.Each data type which is not defined in Teuchos::DirectSerializationTraits must have a Zoltan2::AlltoAllv specialization in Zoltan2_AlltoAll.hpp.
Definition at line 240 of file Zoltan2_IdentifierTraits.hpp.
| static int Zoltan2::IdentifierTraits< T >::hashCode | ( | const T | id | ) | [inline, static] |
Compute an integer hash code for the user's global ID.
| id | the user's global id |
Definition at line 247 of file Zoltan2_IdentifierTraits.hpp.
| static bool Zoltan2::IdentifierTraits< T >::hasUniqueKey | ( | ) | [inline, static] |
Determine if the data type supports unique hash keys.
Definition at line 255 of file Zoltan2_IdentifierTraits.hpp.
| static double Zoltan2::IdentifierTraits< T >::key | ( | const T | c | ) | [inline, static] |
Return a double which is a unique key for the value.
if hasUniqueKey() is false, throw a logic_error.
Definition at line 265 of file Zoltan2_IdentifierTraits.hpp.
| static std::string Zoltan2::IdentifierTraits< T >::name | ( | ) | [inline, static] |
The name of the identifier data type.
Definition at line 271 of file Zoltan2_IdentifierTraits.hpp.
| static std::string Zoltan2::IdentifierTraits< T >::stringify | ( | T | val | ) | [inline, static] |
A string displaying the value.
| val | the value to represent as a string |
Definition at line 280 of file Zoltan2_IdentifierTraits.hpp.
| static bool Zoltan2::IdentifierTraits< T >::isGlobalOrdinal | ( | ) | [inline, static] |
Determine whether the data type can be a Teuchos Ordinal.
Data types are those with a definition in Teuchos::OrdinalTraits.
Definition at line 290 of file Zoltan2_IdentifierTraits.hpp.
| static T Zoltan2::IdentifierTraits< T >::difference | ( | const T | a, |
| const T | b | ||
| ) | [inline, static] |
Compute b - a, if possible.
| a | The a of b-a |
| b | The b of b-a |
A std::logic_error is throw at runtime if the operation is not valid for T.
Definition at line 303 of file Zoltan2_IdentifierTraits.hpp.
| static bool Zoltan2::IdentifierTraits< T >::is_valid_id_type | ( | ) | [inline, static] |
Determine if the data type is one for which IdentifierTraits are defined.
Definition at line 312 of file Zoltan2_IdentifierTraits.hpp.
| static void Zoltan2::IdentifierTraits< T >::minMax | ( | const T * | values, |
| size_t | numValues, | ||
| T & | min, | ||
| T & | max | ||
| ) | [inline, static] |
Return the minimum and maximum of a list of values.
| values | a pointer to numValues values |
| numValues | the number of values to consider |
| min | on return the minimum value in the list |
| max | on return the maximum value in the list |
A std::logic_error is throw at runtime if T is a type that can not be ordered.
Definition at line 323 of file Zoltan2_IdentifierTraits.hpp.
| static void Zoltan2::IdentifierTraits< T >::globalMinMax | ( | const Comm< int > & | comm, |
| bool | flag, | ||
| T | localMin, | ||
| T | localMax, | ||
| T & | globalMin, | ||
| T & | globalMax | ||
| ) | [inline, static] |
Find global minimum and maximum.
| comm | Communicator for global operation |
| flag | true if there are no values on this process (so localMin and localMax are ignored), false otherwise |
| localMin | The local minimum |
| localMax | The local maximum |
| globalMin | On return, the global minimum |
| globalMax | On return, the global maximum |
A std::logic_error is throw at runtime if T is a type that can not be ordered.
Definition at line 340 of file Zoltan2_IdentifierTraits.hpp.
| static bool Zoltan2::IdentifierTraits< T >::areConsecutive | ( | const T * | val, |
| size_t | n | ||
| ) | [inline, static] |
Determine if the values are locally increasing consecutive.
| val | a pointer to n values |
| n | the number of values in the list |
A std::logic_error is throw at runtime if T is a type that can not be ordered.
Definition at line 355 of file Zoltan2_IdentifierTraits.hpp.
1.7.6.1