Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

PatReduceOp.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Pattern_PatReduceOp_h
00002 #define Impala_Core_Array_Pattern_PatReduceOp_h
00003 
00004 #include "Core/Array/Trait/ReduceAdaptor.h"
00005 #include "Core/Array/Pattern/FuncInOut.h"
00006 
00007 #ifdef PX_HORUS_USED
00008 #include "Core/Array/Pattern/PxArrayFunc.h"
00009 #include "Core/Array/Pattern/PxStateTrans.h"
00010 #endif
00011 
00012 namespace Impala
00013 {
00014 namespace Core
00015 {
00016 namespace Array
00017 {
00018 namespace Pattern
00019 {
00020 
00021 
00022 template<class ArrayT, class ReduceT>
00023 inline typename ArrayT::ArithType
00024 PatReduceOp(ArrayT* src, ReduceT& pixOp)
00025 {
00026     Trait::ReduceAdaptor<ReduceT> redOp;
00027     typedef typename ArrayT::ArithType ArithT;
00028     ArithT total;
00029 
00030 #ifdef PX_HORUS_USED
00031     if (!PxRunParallel()) {                         // run sequential
00032 #endif
00033         FuncInOutDispatch(src, redOp);
00034         total = redOp.Result();
00035 
00036 #ifdef PX_HORUS_USED
00037     } else {                                        // run parallel
00038         PxArrayPreStateTrans(src, PAR_PART, STRONG);
00039         FuncInOutDispatch(PxArrayPD(src), redOp);
00040         total = redOp.Result();
00041         total = PxReduceValueToAll(total, pixOp, PX_MPI);
00042 
00043         if (!PxRunLazyParallel()) {
00044             PxArrayForceNonDistributed(src);
00045         }
00046     }
00047 #endif
00048 
00049     return total;
00050 }
00051 
00052 } // namespace Pattern
00053 } // namespace Array
00054 } // namespace Core
00055 } // namespace Impala
00056 
00057 #endif

Generated on Fri Mar 19 09:30:51 2010 for ImpalaSrc by  doxygen 1.5.1