50 #ifndef _ZOLTAN2_MultiJagged_ReductionOps_HPP_
51 #define _ZOLTAN2_MultiJagged_ReductionOps_HPP_
53 #include <Teuchos_ReductionOp.hpp>
56 template <
typename Ordinal,
typename T>
60 Ordinal numSum_0, numMin_1, numMin_2;
61 std::vector <Ordinal> *partVector;
70 numMin_2(0), k(0), partVector(NULL), vectorBegin(0), reductionType(0){}
80 numSum_0(nsum), numMin_1(nmin1), numMin_2(nmin2), partVector(NULL),
81 vectorBegin(0), k(k_), reductionType(0){}
86 numSum_0(0), numMin_1(0), numMin_2(0), partVector(pVector),
87 vectorBegin(vBegin), k(k_), reductionType(1){}
92 void reduce(
const Ordinal ,
const T inBuffer[], T inoutBuffer[])
const
94 if (reductionType == 0){
96 for(Ordinal ii = 0; ii < k ; ++ii){
97 for (Ordinal i=0; i < numSum_0; i++, next++)
98 inoutBuffer[next] += inBuffer[next];
100 for (Ordinal i=0; i < numMin_1; i++, next++)
101 if (inoutBuffer[next] < inBuffer[next])
102 inoutBuffer[next] = inBuffer[next];
104 for (Ordinal i=0; i < numMin_2; i++, next++)
105 if (inoutBuffer[next] > inBuffer[next])
106 inoutBuffer[next] = inBuffer[next];
111 for(Ordinal ii = 0; ii < k ; ++ii){
112 Ordinal partPartition = (*partVector)[ii + vectorBegin];
113 Ordinal tnumSum_ = 2 * partPartition - 1;
114 Ordinal tnumMin_1 = partPartition - 1;
115 Ordinal tnumMin_2 = tnumMin_1 ;
116 for (Ordinal i=0; i < tnumSum_; i++, next++)
117 inoutBuffer[next] += inBuffer[next];
119 for (Ordinal i=0; i < tnumMin_1; i++, next++)
120 if (inoutBuffer[next] < inBuffer[next])
121 inoutBuffer[next] = inBuffer[next];
123 for (Ordinal i=0; i < tnumMin_2; i++, next++)
124 if (inoutBuffer[next] > inBuffer[next])
125 inoutBuffer[next] = inBuffer[next];
132 template <
typename Ordinal,
typename T>
134 public ValueTypeReductionOp<Ordinal,T>
137 Ordinal numMin, numMax, numTotal;
152 nTotal): numMin(nmin), numMax(nmax), numTotal(nTotal){}
156 void reduce(
const Ordinal ,
const T inBuffer[], T inoutBuffer[])
const
160 for (Ordinal i=0; i < numMin; i++, next++)
161 if (inoutBuffer[next] > inBuffer[next])
162 inoutBuffer[next] = inBuffer[next];
164 for (Ordinal i=0; i < numMax; i++, next++)
165 if (inoutBuffer[next] < inBuffer[next])
166 inoutBuffer[next] = inBuffer[next];
169 for (Ordinal i=0; i < numTotal; i++, next++)
170 inoutBuffer[next] += inBuffer[next];
175 #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.