// @HEADER // ***************************************************************************** // RTOp: Interfaces and Support Software for Vector Reduction Transformation // Operations // // Copyright 2006 NTESS and the RTOp contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef RTOPPACK_RTOP_T_HELPERS_DEF_HPP #define RTOPPACK_RTOP_T_HELPERS_DEF_HPP #include "RTOpPack_RTOpTHelpers_decl.hpp" namespace RTOpPack { // // DefaultReductTarget // template std::string DefaultReductTarget::description() const { std::ostringstream oss; oss << "RTOpPack::DefaultReductTarget<" <::name()<<">" << "{concreteReductObj="< void RTOpPack::validate_apply_op( const RTOpT &op, const int allowed_num_sub_vecs, const int allowed_num_targ_sub_vecs, const bool expect_reduct_obj, const ArrayView > &sub_vecs, const ArrayView > &targ_sub_vecs, const Ptr &reduct_obj ) { using Teuchos::as; const int num_sub_vecs = sub_vecs.size(); const int num_targ_sub_vecs = targ_sub_vecs.size(); const std::string op_name_str = "op.name() = " + op.op_name(); if (allowed_num_sub_vecs >= 0) { TEUCHOS_TEST_FOR_EXCEPTION( allowed_num_sub_vecs != as(sub_vecs.size()), InvalidNumVecs, op_name_str<<": Error, sub_vecs.size()="<= 0) { TEUCHOS_TEST_FOR_EXCEPTION( allowed_num_targ_sub_vecs != as(targ_sub_vecs.size()), InvalidNumTargVecs, op_name_str<<": Error, targ_sub_vecs.size()="< dummy_reduct_obj = op.reduct_obj_create(); // mfh 22 Sep 2015: Clang 3.6 warns when typeid's expression may // have side effects. In this case, Ptr::operator* may throw in a // debug build if the pointer inside is NULL. (Throwing an // exception counts as a side effect here.) // // const std::type_info &reduct_obj_type = typeid(*reduct_obj); // const std::type_info &dummy_reduct_obj_type = typeid(*dummy_reduct_obj); const ReductTarget& reduct_obj_thing = *reduct_obj; const std::type_info& reduct_obj_type = typeid (reduct_obj_thing); ReductTarget& dummy_reduct_obj_thing = *dummy_reduct_obj; const std::type_info& dummy_reduct_obj_type = typeid (dummy_reduct_obj_thing); TEUCHOS_TEST_FOR_EXCEPTION( reduct_obj_type != dummy_reduct_obj_type, IncompatibleReductObj, op_name_str<<": Error, the type of the input reduct_obj = " <::description() const; #define RTOPPACK_RTOPT_HELPERS_INSTANT_SCALAR(SCALAR) \ \ RTOPPACK_RTOPT_HELPERS_DEFAULTREDUCTTARGET_INSTANT(SCALAR) \ \ RTOPPACK_RTOPT_HELPERS_DEFAULTREDUCTTARGET_INSTANT(ScalarIndex) \ \ RTOPPACK_RTOPT_HELPERS_DEFAULTREDUCTTARGET_INSTANT(SubVectorView) \ \ template void validate_apply_op( \ const RTOpT &op, \ const int allowed_num_sub_vecs, \ const int allowed_num_targ_sub_vecs, \ const bool expect_reduct_obj, \ const ArrayView > &sub_vecs, \ const ArrayView > &targ_sub_vecs, \ const Ptr &reduct_obj \ ); \ \ #endif // RTOPPACK_RTOP_T_HELPERS_DEF_HPP