Support Software for Vector Reduction/Transformation Operators  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RTOpPack_TOpUnaryFuncPtrDecl.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_UNARY_FUNC_PTR_DECL_HPP
12 #define RTOPPACK_UNARY_FUNC_PTR_DECL_HPP
13 
14 #include "RTOpPack_RTOpT.hpp"
15 
16 namespace RTOpPack {
17 
25 template<class Scalar>
26 class TOpUnaryFuncPtr : public RTOpT<Scalar> {
27 public:
28 
30  typedef void (*unary_func_ptr_t) ( const Scalar x[], int x_dim, Scalar out[] );
31 
34 
37  unary_func_ptr_t unary_func_ptr
38  ,const std::string &op_name
39  );
40 
52  void initialize(
53  unary_func_ptr_t unary_func_ptr
54  ,const std::string &op_name
55  );
56 
66  void set_initialized(
67  unary_func_ptr_t *unary_func_ptr = NULL
68  ,std::string *op_name = NULL
69  );
70 
73 
75  const char* op_name() const;
77  void apply_op(
78  const int num_vecs, const ConstSubVectorView<Scalar> sub_vecs[]
79  ,const int num_targ_vecs, const SubVectorView<Scalar> targ_sub_vecs[]
80  ,ReductTarget *reduct_obj
81  ) const;
82 
84 
85 private:
86 
87  std::string op_name_;
88  unary_func_ptr_t unary_func_ptr_;
89 
90  // Not defined and not to be called
92  TOpUnaryFuncPtr& operator=(const TOpUnaryFuncPtr&);
93 
94 };
95 
96 } // end namespace RTOpPack
97 
98 #endif // RTOPPACK_UNARY_FUNC_PTR_DECL_HPP
RTOpT subclass for unary transformation functions using a function pointer.
void set_initialized(unary_func_ptr_t *unary_func_ptr=NULL, std::string *op_name=NULL)
Set uninitialized.
void(* unary_func_ptr_t)(const Scalar x[], int x_dim, Scalar out[])
TOpUnaryFuncPtr()
Construct to uninitialized.
void initialize(unary_func_ptr_t unary_func_ptr, const std::string &op_name)
Initialize.
void apply_op(const int num_vecs, const ConstSubVectorView< Scalar > sub_vecs[], const int num_targ_vecs, const SubVectorView< Scalar > targ_sub_vecs[], ReductTarget *reduct_obj) const