14 #ifndef _ZOLTAN2_MultiJagged_ReductionOps_HPP_
15 #define _ZOLTAN2_MultiJagged_ReductionOps_HPP_
17 #include <Teuchos_ReductionOp.hpp>
20 template <
typename Ordinal,
typename T>
24 Ordinal numSum_0, numMin_1, numMin_2;
25 std::vector <Ordinal> *partVector;
34 numMin_2(0), k(0), partVector(NULL), vectorBegin(0), reductionType(0){}
44 numSum_0(nsum), numMin_1(nmin1), numMin_2(nmin2), partVector(NULL),
45 vectorBegin(0), k(k_), reductionType(0){}
50 numSum_0(0), numMin_1(0), numMin_2(0), partVector(pVector),
51 vectorBegin(vBegin), k(k_), reductionType(1){}
56 void reduce(
const Ordinal ,
const T inBuffer[], T inoutBuffer[])
const
58 if (reductionType == 0){
60 for(Ordinal ii = 0; ii < k ; ++ii){
61 for (Ordinal i=0; i < numSum_0; i++, next++)
62 inoutBuffer[next] += inBuffer[next];
64 for (Ordinal i=0; i < numMin_1; i++, next++)
65 if (inoutBuffer[next] < inBuffer[next])
66 inoutBuffer[next] = inBuffer[next];
68 for (Ordinal i=0; i < numMin_2; i++, next++)
69 if (inoutBuffer[next] > inBuffer[next])
70 inoutBuffer[next] = inBuffer[next];
75 for(Ordinal ii = 0; ii < k ; ++ii){
76 Ordinal partPartition = (*partVector)[ii + vectorBegin];
77 Ordinal tnumSum_ = 2 * partPartition - 1;
78 Ordinal tnumMin_1 = partPartition - 1;
79 Ordinal tnumMin_2 = tnumMin_1 ;
80 for (Ordinal i=0; i < tnumSum_; i++, next++)
81 inoutBuffer[next] += inBuffer[next];
83 for (Ordinal i=0; i < tnumMin_1; i++, next++)
84 if (inoutBuffer[next] < inBuffer[next])
85 inoutBuffer[next] = inBuffer[next];
87 for (Ordinal i=0; i < tnumMin_2; i++, next++)
88 if (inoutBuffer[next] > inBuffer[next])
89 inoutBuffer[next] = inBuffer[next];
96 template <
typename Ordinal,
typename T>
98 public ValueTypeReductionOp<Ordinal,T>
101 Ordinal numMin, numMax, numTotal;
116 nTotal): numMin(nmin), numMax(nmax), numTotal(nTotal){}
120 void reduce(
const Ordinal ,
const T inBuffer[], T inoutBuffer[])
const
124 for (Ordinal i=0; i < numMin; i++, next++)
125 if (inoutBuffer[next] > inBuffer[next])
126 inoutBuffer[next] = inBuffer[next];
128 for (Ordinal i=0; i < numMax; i++, next++)
129 if (inoutBuffer[next] < inBuffer[next])
130 inoutBuffer[next] = inBuffer[next];
133 for (Ordinal i=0; i < numTotal; i++, next++)
134 inoutBuffer[next] += inBuffer[next];
139 #endif //_ZOLTAN2_MultiJagged_ReductionOps_HPP_
void reduce(const Ordinal, const T inBuffer[], T inoutBuffer[]) const
Implement Teuchos::ValueTypeReductionOp interface.
MultiJaggedCombinedMinMaxTotalReductionOp()
Default Constructor.
void reduce(const Ordinal, const T inBuffer[], T inoutBuffer[]) const
Implement Teuchos::ValueTypeReductionOp interface.
MultiJaggedCombinedReductionOp()
Default Constructor.
MultiJaggedCombinedReductionOp(std::vector< Ordinal > *pVector, Ordinal vBegin, Ordinal k_)
MultiJaggedCombinedReductionOp(Ordinal nsum, Ordinal nmin1, Ordinal nmin2, Ordinal k_)
Constructor.
MultiJaggedCombinedMinMaxTotalReductionOp(Ordinal nmin, Ordinal nmax, Ordinal nTotal)
Constructor.