proj home

Files   Classes   Functions   Hierarchy  

simplexD1indexed.h

Go to the documentation of this file.
00001 #ifndef SIMPLEXD1INDEXED_H
00002 #define SIMPLEXD1INDEXED_H
00003 
00004 #include <typedefs.h>
00005 
00013 template< typename INDX=uint >
00014 class simplexD1indexed
00015 {
00016 public:
00017 
00019   INDX pi[2];
00020 
00022   simplexD1indexed()
00023     { pi[0] = pi[1] = 0; }
00025   simplexD1indexed(INDX const a, INDX const b )
00026     { pi[0]=a; pi[1]=b; }
00027 
00029   boolc operator == (simplexD1indexed<INDX> const & t) const;
00030 
00032   void setnull()
00033     { pi[0] = pi[1] = 0; }
00035   boolc isnull() const;
00036 
00038   ostream & print(ostream & os) const
00039     { return os << pi[0] << " " << pi[1]; }
00040 
00042   operator stringc () const;
00043 
00044 };
00045 
00046 template< typename INDX >
00047 ostream & operator << ( ostream & os, simplexD1indexed<INDX> const & s)
00048   { return s.print(os); }
00049 
00050 
00051 //---------------------------------------------------------
00052 // Implementation
00053 
00054 template< typename INDX >
00055 simplexD1indexed<INDX>::operator stringc () const
00056 {
00057   stringstream ss;
00058   ss << pi[0] << " " << pi[1];
00059   return ss.str();
00060 }
00061 
00062 template< typename INDX >
00063 boolc simplexD1indexed<INDX>::operator == 
00064 (
00065   simplexD1indexed<INDX> const & t
00066 ) const
00067 {
00068   if (pi[0]==t.pi[0])
00069   {
00070     if (pi[1]==t.pi[1])
00071       return true;
00072   }
00073 
00074   if (pi[0]==t.pi[1])
00075   {
00076     if (pi[1]==t.pi[0])
00077       return true;
00078   }
00079 
00080   return false;
00081 }
00082 
00083 template< typename INDX >
00084 boolc simplexD1indexed<INDX>::isnull() const
00085 {
00086   if (pi[0]!=0)
00087     return false;
00088 
00089   if (pi[1]!=0)
00090     return false;
00091 
00092   return true;
00093 }
00094 
00095 
00096 
00097 #endif
00098 
00099 

Generated on Fri Mar 4 00:49:26 2011 for Chelton Evans Source by  doxygen 1.5.8