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

PatNgbOp2dExtra.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Pattern_PatNgbOp2dExtra_h
00002 #define Impala_Core_Array_Pattern_PatNgbOp2dExtra_h
00003 
00004 #include "Core/Array/CheckBorderSize.h"
00005 #include "Core/Array/Pattern/PatSetBorder.h"
00006 #include "Core/Array/Pattern/FuncNgbOp2dExtra.h"
00007 
00008 #ifdef PX_HORUS_USED
00009 #include "Core/Array/Pattern/PxArrayFunc.h"
00010 #include "Core/Array/Pattern/PxStateTrans.h"
00011 #endif
00012 
00013 namespace Impala
00014 {
00015 namespace Core
00016 {
00017 namespace Array
00018 {
00019 namespace Pattern
00020 {
00021 
00022 
00023 template <class DstArrayT, class SrcArrayT, class ExtraArrayT, class NgbT>
00024 inline void
00025 PatNgbOp2dExtra(DstArrayT*& dst, SrcArrayT* src, ExtraArrayT* xtr, NgbT& ngb)
00026 {
00027     int numX = ngb.Width() / 2;
00028     int numY = ngb.Height() / 2;
00029     SrcArrayT* checkedSrc = CheckBorderSize(src, numX, numY);
00030     ExtraArrayT* checkedXtr = CheckBorderSize(xtr, numX, numY);
00031 
00032     if ((dst == 0) || (dst == (DstArrayT*) checkedSrc))
00033         dst = ArrayClone<DstArrayT>(checkedSrc);
00034 
00035 #ifdef PX_HORUS_USED
00036     if (!PxRunParallel()) {                         // run sequential
00037 #endif
00038         PatSetBorder(checkedSrc, numX, numY);
00039         PatSetBorder(checkedXtr, numX, numY);
00040         FuncNgbOp2dExtraDispatch(dst, checkedSrc, checkedXtr, ngb);
00041 
00042 #ifdef PX_HORUS_USED
00043     } else {                                        // run parallel
00044         PxArrayPreStateTrans(checkedSrc, PAR_PART, STRONG);
00045         PxArrayPreStateTrans(checkedXtr, PAR_PART, STRONG);
00046         PxArrayPreStateTrans(dst, PAR_PART, WEAK);
00047         PatSetBorder(PxArrayPD(checkedSrc), numX, numY);
00048         PatSetBorder(PxArrayPD(checkedXtr), numX, numY);
00049         FuncNgbOp2dExtraDispatch(PxArrayPD(dst),
00050                     PxArrayPD(checkedSrc), PxArrayPD(checkedXtr), ngb);
00051         if (PxArrayPD(checkedSrc) != PxArrayPD(src))
00052             PxArrayDeletePD(checkedSrc);
00053         if (PxArrayPD(checkedXtr) != PxArrayPD(xtr))
00054             PxArrayDeletePD(checkedXtr);
00055         PxArrayPostStateTrans(dst);
00056 
00057         if (!PxRunLazyParallel()) {
00058             PxArrayForceNonDistributed(src);
00059             PxArrayForceNonDistributed(xtr);
00060             PxArrayForceNonDistributed(dst);
00061         }
00062     }
00063 #endif
00064 
00065     if (checkedSrc != src)
00066         delete checkedSrc;
00067     if (checkedXtr != xtr)
00068         delete checkedXtr;
00069 }
00070 
00071 } // namespace Pattern
00072 } // namespace Array
00073 } // namespace Core
00074 } // namespace Impala
00075 
00076 #endif

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