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_TOpSetAssendingValues.hpp
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_TOP_SET_ASSENDING_VALUES_HPP
12 #define RTOPPACK_TOP_SET_ASSENDING_VALUES_HPP
13 
14 #include "RTOpPack_RTOpTHelpers.hpp"
15 #include "Teuchos_as.hpp"
16 
17 
18 namespace RTOpPack {
19 
20 
22 template<class Scalar>
24 {
25 public:
26  TOpSetAssendingValuesEleWiseTransformation( const Scalar &offset )
27  {
28  offset_ = offset;
29  }
30  void operator()( const Ordinal global_i, Scalar &z0 ) const
31  {
32  z0 = offset_ + Teuchos::as<Scalar>(global_i + 1);
33  }
34 private:
35  Scalar offset_;
37 };
38 
39 
42 template<class Scalar>
44  : public TOp_0_1_CoordVariantBase<Scalar, TOpSetAssendingValuesEleWiseTransformation<Scalar> >
45 {
46 public:
49  TOpSetAssendingValues(const Scalar &offset = static_cast<Scalar>(0.0) )
51  {
52  this->setOpNameBase("TOpSetAssendingValues");
53  }
54 };
55 
56 
57 } // namespace RTOpPack
58 
59 
60 #endif // RTOPPACK_TOP_SET_ASSENDING_VALUES_HPP
Element-wise transformation for TOpSetAssendingValues.
Set the elements of a vector to: z0[i] = i+offset+1, i=0...n-1.
void setOpNameBase(const std::string &op_name_base)