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

PatMPixOp.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Pattern_PatMPixOp_h
00002 #define Impala_Core_Array_Pattern_PatMPixOp_h
00003 
00004 #include "Core/Array/Array2dTem.h"
00005 #include "Core/Array/Pattern/FuncMpo.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 DstArrayT, class SrcArrayT, class MpoT>
00023 inline void
00024 PatMPixOp(DstArrayT*& dst,
00025           const std::vector<SrcArrayT*>& srcList,
00026           MpoT& mpo)
00027 {
00028     int length = srcList.size();
00029     if (length < 1)
00030         return;
00031     if (dst == 0)
00032         dst = ArrayClone<DstArrayT>(srcList[0]);
00033 
00034 #ifdef PX_HORUS_USED
00035     if (!PxRunParallel()) {                         // run sequential
00036 #endif
00037         FuncMpo(dst, srcList, mpo);
00038 
00039 #ifdef PX_HORUS_USED
00040     } else {                                        // run parallel
00041         int i;
00042         for(i=0 ; i<length ; ++i)
00043             PxArrayPreStateTrans(srcList[i],  PAR_PART, STRONG);
00044 
00045         std::vector<SrcArrayT*> pdList;
00046         pdList.resize(length);
00047         for(i=0 ; i<length ; ++i)
00048             pdList[i] = PxArrayPD(srcList[i]);
00049 
00050         FuncMpo(PxArrayPD(dst), pdList, mpo);
00051         PxArrayPostStateTrans(dst);
00052 
00053         if (!PxRunLazyParallel()) {
00054             for(i=0 ; i<length ; ++i)
00055                 PxArrayForceNonDistributed(srcList[i]);
00056             PxArrayForceNonDistributed(dst);
00057         }
00058     }
00059 #endif
00060 }
00061 
00062 } // namespace Pattern
00063 } // namespace Array
00064 } // namespace Core
00065 } // namespace Impala
00066 
00067 #endif

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