46 #ifndef _ZOLTAN2_TPLTRAITS_HPP_ 47 #define _ZOLTAN2_TPLTRAITS_HPP_ 49 #include <Teuchos_RCP.hpp> 50 #include <Teuchos_ArrayView.hpp> 51 #include <Teuchos_as.hpp> 55 #include <zoltan_types.h> 69 template <
typename tpl_t,
typename zno_t>
75 return ((
sizeof(tpl_t) ==
sizeof(zno_t)) &&
76 (std::numeric_limits<tpl_t>::is_signed ==
77 std::numeric_limits<zno_t>::is_signed));
84 a = Teuchos::asSafe<tpl_t, zno_t>(b);
86 catch (std::exception &e) {
87 throw std::runtime_error(
88 "TPL_Traits: Value too large for TPL index type. " 89 "Rebuild TPL with larger index type or rebuild without the TPL.");
96 size_t size = b.size();
99 for (
size_t i = 0; i < size; i++)
ASSIGN_TPL_T((*a)[i], b[i]);
125 template <
typename tpl_t>
136 *a = const_cast<tpl_t *> (b.getRawPtr());
152 template <
typename zno_t>
161 static const int NUM_ID = ((
sizeof(zno_t) /
sizeof(ZOLTAN_ID_TYPE) > 0)
162 ? (
sizeof(zno_t) /
sizeof(ZOLTAN_ID_TYPE))
178 a[0] =
static_cast<ZOLTAN_ID_TYPE
>(b);
181 ZOLTAN_ID_TYPE *ptr = (ZOLTAN_ID_TYPE *)(&b);
187 ZOLTAN_ID_TYPE *ptr = (ZOLTAN_ID_TYPE *)(&b);
188 for (
int i = 0; i < NUM_ID; i++) a[i] = ptr[i];
196 size_t size = b.size();
202 *a =
new ZOLTAN_ID_TYPE[size*NUM_ID];
203 for (
size_t i = 0; i < size; i++)
ASSIGN_TPL_T((*a)[i], b[i]);
219 template <
typename zno_t>
239 a =
static_cast<zno_t
>(b[0]);
242 zno_t *tmp = (zno_t *) b;
static void ASSIGN_TPL_T(ZOLTAN_ID_PTR &a, zno_t b)
static bool OK_TO_CAST_TPL_T()
static void DELETE_TPL_T_ARRAY(tpl_t **a)
static void DELETE_TPL_T_ARRAY(tpl_t **a)
static void ASSIGN_TPL_T_ARRAY(tpl_t **a, ArrayView< tpl_t > &b)
static void ASSIGN_TPL_T_ARRAY(ZOLTAN_ID_PTR *a, ArrayView< zno_t > &b)
static bool OK_TO_CAST_TPL_T()
static void ASSIGN_TPL_T(zno_t &a, ZOLTAN_ID_PTR b)
static void ASSIGN_TPL_T_ARRAY(tpl_t **a, ArrayView< zno_t > &b)
static bool OK_TO_CAST_TPL_T()
Gathering definitions used in software development.
Defines the Environment class.
static void ASSIGN_TPL_T(tpl_t &a, zno_t b)
static bool OK_TO_CAST_TPL_T()
static void DELETE_TPL_T_ARRAY(ZOLTAN_ID_PTR *a)
static void ASSIGN_TPL_T(tpl_t &a, tpl_t b)