00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef RTOPPACK_RTOP_SUNDIALS_HELPERS_HPP
00031 #define RTOPPACK_RTOP_SUNDIALS_HELPERS_HPP
00032
00033 #include "RTOpPack_RTOpTHelpers.hpp"
00034
00035
00036
00037 namespace RTOpPack
00038 {
00039
00040
00041
00042 #ifdef TRILINOS_6.0
00043
00044 template<class Scalar>
00045 class RTOpBoolReduceAndTransform
00046 : public ROpIndexReductionBase<Scalar>,
00047 public ROpScalarTransformationBase<Scalar>
00048 {
00049
00050 public:
00051 typedef typename RTOpT<Scalar>::primitive_value_type primitive_value_type;
00052
00053 RTOpBoolReduceAndTransform()
00054 : RTOpT<Scalar>(""),
00055 ROpIndexReductionBase<Scalar>(1),
00056 ROpScalarTransformationBase<Scalar>()
00057 {;}
00058
00059
00060 virtual ~RTOpBoolReduceAndTransform(){;}
00061
00062
00063 index_type operator()(const ReductTarget& reduct_obj ) const
00064 { return this->getRawVal(reduct_obj); }
00065
00066
00067
00068 void reduce_reduct_objs(const ReductTarget& in_reduct_obj,
00069 ReductTarget* inout_reduct_obj) const
00070 {
00071 const index_type in_val = this->getRawVal(in_reduct_obj);
00072 const index_type inout_val = this->getRawVal(*inout_reduct_obj);
00073 this->setRawVal( in_val && inout_val, inout_reduct_obj );
00074 }
00075
00076 };
00077
00078 #endif
00079
00080 }
00081
00082
00083
00084
00085
00086 #define RTOP_APPLY_OP_3_0( NUM_VECS, SUB_VECS, NUM_TARG_VECS, TARG_SUB_VECS ) \
00087 TEST_FOR_EXCEPTION( \
00088 (NUM_VECS)!=3 || (SUB_VECS)==NULL \
00089 ,RTOpPack::InvalidNumVecs \
00090 ,"Error, num_vecs="<<(NUM_VECS)<<" not allowed, only num_vecs==3, sub_vecs!=NULL" \
00091 ); \
00092 TEST_FOR_EXCEPTION( \
00093 (NUM_TARG_VECS)!=0 || (TARG_SUB_VECS)!=NULL \
00094 ,RTOpPack::InvalidNumTargVecs \
00095 ,"Error, num_targ_vecs="<<(NUM_TARG_VECS)<<" not allowed, only num_targ_vecs==0, targ_sub_vecs==NULL" \
00096 ); \
00097 TEST_FOR_EXCEPTION( \
00098 (SUB_VECS)[0].subDim() != (SUB_VECS)[1].subDim() \
00099 || (SUB_VECS)[0].subDim() != (SUB_VECS)[2].subDim() \
00100 ||(SUB_VECS)[0].globalOffset() != (SUB_VECS)[1].globalOffset() \
00101 ||(SUB_VECS)[0].globalOffset() != (SUB_VECS)[1].globalOffset() \
00102 ,IncompatibleVecs \
00103 ,"Error, num_targ_vecs="<<(NUM_TARG_VECS)<<" not allowed, only num_targ_vecs==0, targ_sub_vecs==NULL" \
00104 ); \
00105 const RTOpPack::index_type subDim = (SUB_VECS)[0].subDim(); \
00106 const Scalar *v0_val = (SUB_VECS)[0].values(); \
00107 const ptrdiff_t v0_s = (SUB_VECS)[0].stride(); \
00108 const Scalar *v1_val = (SUB_VECS)[1].values(); \
00109 const ptrdiff_t v1_s = (SUB_VECS)[1].stride(); \
00110 const Scalar *v2_val = (SUB_VECS)[2].values(); \
00111 const ptrdiff_t v2_s = (SUB_VECS)[2].stride();
00112
00113
00114 #endif