00001 #include "SundanceBasicVertexView.hpp"
00002 #include "Teuchos_Utils.hpp"
00003 
00004 using namespace Teuchos;
00005 using namespace Sundance;
00006 using namespace Sundance;
00007 using namespace Sundance;
00008 
00009 string VertexView::toString() const
00010 {
00011   int* ptr = *base_ +  offset_*length_;
00012   string rtn="{";
00013   for (int i=0; i<length_; i++) 
00014     {
00015       rtn += Teuchos::toString(ptr[i]);
00016       if (i < length_-1) rtn += ", ";
00017     }
00018   rtn += "}";
00019   return rtn;
00020 }
00021 
00022 
00023 
00024 
00025 int VertexView::hashCode() const
00026 {
00027   int rtn = 0;
00028       int* p = *base_ + offset_*length_;
00029 
00030       for (int i=0; i<length_; i++)
00031         {
00032           rtn += p[i];
00033         }
00034 
00035       return rtn;
00036 
00037 #ifdef BLARF
00038       
00039   int* p = *base_ + offset_*length_;
00040 
00041   unsigned char* key = reinterpret_cast<unsigned char*>(p);
00042   unsigned int key_len = length_ * sizeof(int);
00043 
00044   
00045 
00046   unsigned int hash = 0;
00047   int i;
00048   
00049   for (i = 0; i < key_len; i++) {
00050     hash += key[i];
00051     hash += (hash << 10);
00052     hash ^= (hash >> 6);
00053   }
00054   hash += (hash << 3);
00055   hash ^= (hash >> 11);
00056   hash += (hash << 15);
00057   return hash;
00058 #endif
00059 }