localkey.hh

Go to the documentation of this file.
00001 // -*- tab-width: 4; indent-tabs-mode: nil -*-
00002 #ifndef DUNE_LOCALKEY_HH
00003 #define DUNE_LOCALKEY_HH
00004 
00005 #include <cstddef>
00006 
00007 #include<dune/common/array.hh>
00008 
00009 namespace Dune 
00010 {
00019   class LocalKey 
00020   {
00021   public:
00022 
00024       enum {
00033           intersectionCodim=666
00034       };
00035 
00037         LocalKey ()
00038         {}
00039 
00045         LocalKey (unsigned int s, unsigned int c, unsigned int i)
00046         {
00047         values_[0] = s;
00048         values_[1] = c;
00049         values_[2] = i;
00050     }
00051 
00053         inline unsigned int subEntity () const
00054         {
00055           return values_[0];
00056         } 
00057 
00059         inline unsigned int codim () const
00060         {
00061           return values_[1];
00062         } 
00063 
00065         inline unsigned int index () const
00066         {
00067           return values_[2];
00068         } 
00069 
00071         void index (unsigned int i)
00072         {
00073           values_[2] = i;
00074         } 
00075 
00077       bool operator< (const LocalKey& other) const
00078       {
00079           return values_ < other.values_;
00080       }
00081 
00083       friend std::ostream& operator<< (std::ostream& s, const LocalKey& localKey)
00084       {
00085           return s << "[ subEntity: " << localKey.subEntity()
00086                    << ", codim: " << localKey.codim()
00087                    << ", index: " << localKey.index() << " ]";
00088       }
00089 
00090   private:      
00091 
00092       // We use an array to store the values in order to be able to use the array::operator< implementation
00093       Dune::array<unsigned int,3> values_;
00094 
00095   };
00096 
00097 }
00098 #endif

Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].