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

TalkNgbExtra2P1Cnum.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Trait_TalkNgbExtra2P1Cnum_h
00002 #define Impala_Core_Array_Trait_TalkNgbExtra2P1Cnum_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include "Core/Array/Pattern/Cnum.h"
00006 #include "Core/Array/Element/E1Cast.h"
00007 
00008 namespace Impala
00009 {
00010 namespace Core
00011 {
00012 namespace Array
00013 {
00014 namespace Trait
00015 {
00016 
00017 
00020 template<class DstArrayT, class SrcArrayT, class ExtraArrayT, class Extra2ArrayT>
00021 class TalkNgbExtra2P1Cnum
00022 {
00023 public:
00024 
00026     typedef Pattern::TagCnum IteratorCategory;
00027 
00029     typedef Pattern::Tag1Phase PhaseCategory;
00030 
00032     typedef Pattern::Cnum CnumType;
00033 
00034     typedef typename DstArrayT::StorType DstStorType;
00035     typedef typename DstArrayT::ArithType DstArithType;
00036     typedef typename SrcArrayT::StorType SrcStorType;
00037     typedef typename SrcArrayT::ArithType SrcArithType;
00038     typedef typename ExtraArrayT::StorType ExtraStorType;
00039     typedef typename ExtraArrayT::ArithType ExtraArithType;
00040     typedef typename Extra2ArrayT::StorType Extra2StorType;
00041     typedef typename Extra2ArrayT::ArithType Extra2ArithType;
00042 
00044     TalkNgbExtra2P1Cnum(bool verbose)
00045     {
00046         mVerbose = verbose;
00047     }
00048 
00050     int
00051     Width()
00052     {
00053         return 3;
00054     }
00055 
00057     int
00058     Height()
00059     {
00060         return 3;
00061     }
00062 
00064     CnumType
00065     Begin()
00066     {
00067         return mBegin;
00068     }
00069 
00071     CnumType&
00072     End()
00073     {
00074         return mEnd;
00075     }
00076 
00078     void
00079     Init(int x, int y, const SrcArithType& v1, const ExtraArithType& v2,
00080          const Extra2ArithType& v3)
00081     {
00082         if (mVerbose)
00083             std::cout << "  TalkNgbExtra2P1Cnum::init(" << x << "," << y << ","
00084                       << v1 << "," << v2 << "," << v3 << ") " << std::endl;
00085         mBegin = CnumType(&mCoordPairs[0]);
00086         mEnd = CnumType(&mCoordPairs[8]);
00087         mResult = Element::E1Cast(0, DstArithType());
00088     }
00089 
00091     void
00092     NextEl(int x, int y, const SrcArithType& v1, const ExtraArithType& v2,
00093            const Extra2ArithType& v3)
00094     {
00095         if (mVerbose)
00096             std::cout << "      TalkNgbExtra2P1Cnum::next(" << x << "," << y
00097                       << "," << v1 << "," << v2 << "," << v3 << ") " << std::endl;
00098         DstArithType tmp(v1, v2, v3);
00099         mResult += tmp;
00100     }
00101 
00103     DstArithType
00104     Result() const
00105     {
00106         return mResult;
00107     }
00108 
00109 private:
00110     DstArithType   mResult;
00111     bool           mVerbose;
00112     CnumType       mBegin;
00113     CnumType       mEnd;
00114     static Pattern::Coord mCoordPairs[8];
00115 };
00116 
00117 
00118 template<class DstArrayT, class SrcArrayT, class ExtraArrayT, class Extra2ArrayT>
00119 Pattern::Coord TalkNgbExtra2P1Cnum<DstArrayT,SrcArrayT,ExtraArrayT,Extra2ArrayT>::
00120 mCoordPairs[8] = 
00121 {
00122     { -1, -1 },
00123     {  0, -1 },
00124     {  1, -1 },
00125     {  1,  0 },
00126     {  1,  1 },
00127     {  0,  1 },
00128     { -1,  1 },
00129     {  0, -1 }
00130 };
00131 
00132 } // namespace Trait
00133 } // namespace Array
00134 } // namespace Core
00135 } // namespace Impala
00136 
00137 #endif

Generated on Fri Mar 19 09:31:00 2010 for ImpalaSrc by  doxygen 1.5.1