Collection of Concrete Vector Reduction/Transformation Operator Implementations  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RTOpPack_ROpGetSubVector_decl.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // RTOp: Interfaces and Support Software for Vector Reduction Transformation
5 // Operations
6 // Copyright (2006) Sandia Corporation
7 //
8 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9 // license for use of this work by or on behalf of the U.S. Government.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
39 //
40 // ***********************************************************************
41 // @HEADER
42 
43 #ifndef RTOPPACK_ROP_GET_SUB_VECTOR_DECL_HPP
44 #define RTOPPACK_ROP_GET_SUB_VECTOR_DECL_HPP
45 
46 
47 #include "RTOpPack_RTOpTHelpers.hpp"
48 
49 
50 namespace RTOpPack {
51 
52 
58 template<class Scalar>
59 class ROpGetSubVector : public RTOpT<Scalar> {
60 public:
61 
64 
66  ROpGetSubVector( const index_type l = 0, const index_type u = 0 );
67 
69  void set_range( const index_type l, const index_type u );
70 
75  const ReductTarget& reduct_obj ) const;
76 
79 
82  const Ptr<int> &num_values,
83  const Ptr<int> &num_indexes,
84  const Ptr<int> &num_chars
85  ) const;
89  void reduce_reduct_objs_impl( const ReductTarget &in_reduct_obj,
90  const Ptr<ReductTarget> &inout_reduct_obj) const;
92  void reduct_obj_reinit_impl( const Ptr<ReductTarget> &reduct_obj ) const;
95  const ReductTarget &reduct_obj,
96  const ArrayView<primitive_value_type> &value_data,
97  const ArrayView<index_type> &index_data,
98  const ArrayView<char_type> &char_data
99  ) const;
102  const ArrayView<const primitive_value_type> &value_data,
103  const ArrayView<const index_type> &index_data,
104  const ArrayView<const char_type> &char_data,
105  const Ptr<ReductTarget> &reduct_obj
106  ) const;
108  bool coord_invariant_impl() const;
110  void apply_op_impl(
111  const ArrayView<const ConstSubVectorView<Scalar> > &sub_vecs,
112  const ArrayView<const SubVectorView<Scalar> > &targ_sub_vecs,
113  const Ptr<ReductTarget> &reduct_obj
114  ) const;
115 
117 
118 private:
119 
120  index_type l_;
121  index_type u_;
122 
123 }; // class ROpGetSubVector
124 
125 
126 } // namespace RTOpPack
127 
128 
129 #endif // RTOPPACK_ROP_GET_SUB_VECTOR_DECL_HPP
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
void reduce_reduct_objs_impl(const ReductTarget &in_reduct_obj, const Ptr< ReductTarget > &inout_reduct_obj) const
void set_range(const index_type l, const index_type u)
Set the range of global indexes to extract elements for.
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
ROpGetSubVector(const index_type l=0, const index_type u=0)
RTOpT< Scalar >::primitive_value_type primitive_value_type
Teuchos::RCP< ReductTarget > reduct_obj_create_impl() const
Reduction operator that extracts a sub-vector in the range of global zero-based indexes [l...
void apply_op_impl(const ArrayView< const ConstSubVectorView< Scalar > > &sub_vecs, const ArrayView< const SubVectorView< Scalar > > &targ_sub_vecs, const Ptr< ReductTarget > &reduct_obj) const
void get_reduct_type_num_entries_impl(const Ptr< int > &num_values, const Ptr< int > &num_indexes, const Ptr< int > &num_chars) const
void reduct_obj_reinit_impl(const Ptr< ReductTarget > &reduct_obj) const
const ConstSubVectorView< Scalar > operator()(const ReductTarget &reduct_obj) const
Extract the subvector after all of the reductions are completed.