RTOp Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RTOpPack_RTOpT_def.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // RTOp: Interfaces and Support Software for Vector Reduction Transformation
4 // Operations
5 //
6 // Copyright 2006 NTESS and the RTOp contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 #ifndef RTOPPACK_RTOP_NEW_T_HPP
12 #define RTOPPACK_RTOP_NEW_T_HPP
13 
14 #include "RTOpPack_RTOpT_decl.hpp"
15 #include "Teuchos_Workspace.hpp"
16 #include "Teuchos_Assert.hpp"
17 #include "Teuchos_ScalarTraits.hpp"
18 
19 
20 namespace RTOpPack {
21 
22 
23 // Protected functions to be overridden by subclasses
24 
25 
26 template<class Scalar>
28  const Ptr<int> &num_values,
29  const Ptr<int> &num_indexes,
30  const Ptr<int> &num_chars
31  ) const
32 {
33  *num_values = 0;
34  *num_indexes = 0;
35  *num_chars = 0;
36 }
37 
38 
39 template<class Scalar>
42 {
43  return Teuchos::null;
44 }
45 
46 
47 template<class Scalar>
49  const ReductTarget& /* in_reduct_obj */, const Ptr<ReductTarget>& /* inout_reduct_obj */
50  ) const
51 {
52  throwNoReductError();
53 }
54 
55 
56 template<class Scalar>
58  const Ptr<ReductTarget> &/* reduct_obj */ ) const
59 {
60  throwNoReductError();
61 }
62 
63 
64 template<class Scalar>
66  const ReductTarget &/* reduct_obj */,
67  const ArrayView<primitive_value_type> &/* value_data */,
68  const ArrayView<index_type> &/* index_data */,
69  const ArrayView<char_type> &/* char_data */
70  ) const
71 {
72  throwNoReductError();
73 }
74 
75 
76 template<class Scalar>
78  const ArrayView<const primitive_value_type> &/* value_data */,
79  const ArrayView<const index_type> &/* index_data */,
80  const ArrayView<const char_type> &/* char_data */,
81  const Ptr<ReductTarget> &/* reduct_obj */
82  ) const
83 {
84  throwNoReductError();
85 }
86 
87 
88 template<class Scalar>
89 std::string RTOpT<Scalar>::op_name_impl() const
90 {
91  return op_name_;
92 }
93 
94 
95 template<class Scalar>
97 {
98  return true;
99 }
100 
101 
102 template<class Scalar>
104 {
105  return Range1D();
106 }
107 
108 
109 // Nonvirtual protected functions
110 
111 
112 template<class Scalar>
113 RTOpT<Scalar>::RTOpT( const std::string &op_name_base )
114 {
115  setOpNameBase(op_name_base);
116 }
117 
118 
119 template<class Scalar>
120 void RTOpT<Scalar>::setOpNameBase( const std::string &op_name_base )
121 {
122  op_name_ = op_name_base+"<"+ScalarTraits<Scalar>::name()+">";
123 }
124 
125 
126 // private
127 
128 
129 template<class Scalar>
131 {
132  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
133  "Error, no reduction is defined for concrete reduction op \'"
134  << this->description() << "\'!" );
135 }
136 
137 
138 
139 } // end namespace RTOpPack
140 
141 
142 #endif // RTOPPACK_RTOP_NEW_T_HPP
virtual Teuchos::RCP< ReductTarget > reduct_obj_create_impl() const
virtual void reduct_obj_reinit_impl(const Ptr< ReductTarget > &reduct_obj) const
virtual void reduce_reduct_objs_impl(const ReductTarget &in_reduct_obj, const Ptr< ReductTarget > &inout_reduct_obj) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void throwNoReductError() const
static std::string name()
virtual Range1D range_impl() const
virtual bool coord_invariant_impl() const
virtual void extract_reduct_obj_state_impl(const ReductTarget &reduct_obj, const ArrayView< primitive_value_type > &value_data, const ArrayView< index_type > &index_data, const ArrayView< char_type > &char_data) const
virtual void load_reduct_obj_state_impl(const ArrayView< const primitive_value_type > &value_data, const ArrayView< const index_type > &index_data, const ArrayView< const char_type > &char_data, const Ptr< ReductTarget > &reduct_obj) const
virtual std::string op_name_impl() const
Abstract base class for all reduction objects.
void setOpNameBase(const std::string &op_name_base)
Just set the operator name.
virtual void get_reduct_type_num_entries_impl(const Ptr< int > &num_values, const Ptr< int > &num_indexes, const Ptr< int > &num_chars) const
RTOpT(const std::string &op_name_base="")
Constructor that creates an operator name appended with the type.