proj home

Files   Classes   Functions   Hierarchy  

cellD3< T > Class Template Reference

Cell in 3D with 6 links. The meaning of the links is relative to the context. For example on meaning is to assign 0 to North, 1 to East, 2 to South, 3 to West, 4 to Front, 5 to Back. More...

#include <cellD3.h>

Collaboration diagram for cellD3< T >:

List of all members.

Public Member Functions

 cellD3 ()
 Construct with no links.
uintc degree () const
 How many links to other cells exist?
uintc niInv (T x) const
 Returns 6 if failed.
boolc unvisited () const
 Has the node any links to other cells?
 operator stringc () const
 Serialize this object by writing it out as a string.

Public Attributes

T ni [6]
 Neighbours.
T id
 Id for this cell.


Detailed Description

template<typename T>
class cellD3< T >

Cell in 3D with 6 links. The meaning of the links is relative to the context. For example on meaning is to assign 0 to North, 1 to East, 2 to South, 3 to West, 4 to Front, 5 to Back.

However after graph simplification these may make no sense, as the structure is now a node graph.

Definition at line 19 of file cellD3.h.


Constructor & Destructor Documentation

template<typename T >
cellD3< T >::cellD3 (  )  [inline]

Construct with no links.

Definition at line 52 of file cellD3.h.

References cellD3< T >::ni.

00053 {
00054   id=0;
00055   ni[0]=0;
00056   ni[1]=0;
00057   ni[2]=0;
00058   ni[3]=0;
00059   ni[4]=0;
00060   ni[5]=0;
00061 }


Member Function Documentation

template<typename T >
uintc cellD3< T >::degree (  )  const [inline]

How many links to other cells exist?

Definition at line 83 of file cellD3.h.

References cellD3< T >::ni.

Referenced by cellD3< T >::unvisited().

00084 {
00085   uint count=0;
00086   if (ni[0])
00087     ++count;
00088   if (ni[1])
00089     ++count;
00090   if (ni[2])
00091     ++count;
00092   if (ni[3])
00093     ++count;
00094   if (ni[4])
00095     ++count;
00096   if (ni[5])
00097     ++count;
00098 
00099   return count;
00100 }

template<typename T >
uintc cellD3< T >::niInv ( T  x  )  const [inline]

Returns 6 if failed.

Definition at line 64 of file cellD3.h.

References cellD3< T >::ni.

00065 {
00066   if (ni[0]==x)
00067     return 0;
00068   if (ni[1]==x)
00069     return 1;
00070   if (ni[2]==x)
00071     return 2;
00072   if (ni[3]==x)
00073     return 3;
00074   if (ni[4]==x)
00075     return 4;
00076   if (ni[5]==x)
00077     return 5;
00078 
00079   return 6;
00080 }

template<typename T >
cellD3< T >::operator stringc (  )  const [inline]

Serialize this object by writing it out as a string.

Definition at line 104 of file cellD3.h.

References cellD3< T >::id, and cellD3< T >::ni.

00105 {
00106   string s;
00107   stringstream ss;
00108   ss << id;
00109   ss << " ";
00110   ss << ni[0];
00111   ss << " ";
00112   ss << ni[1];
00113   ss << " ";
00114   ss << ni[2];
00115   ss << " ";
00116   ss << ni[3];
00117   ss << " ";
00118   ss << ni[4];
00119   ss << " ";
00120   ss << ni[5];
00121 
00122   return ss.str();
00123 }

template<typename T>
boolc cellD3< T >::unvisited (  )  const [inline]

Has the node any links to other cells?

Definition at line 39 of file cellD3.h.

References cellD3< T >::degree().

00040     { return degree()==0; }


Member Data Documentation

template<typename T>
T cellD3< T >::id

Id for this cell.

Definition at line 27 of file cellD3.h.

Referenced by mazematrixD3< T >::add(), and cellD3< T >::operator stringc().

template<typename T>
T cellD3< T >::ni[6]

Neighbours.

Definition at line 24 of file cellD3.h.

Referenced by cellD3< T >::cellD3(), cellD3< T >::degree(), cellD3< T >::niInv(), and cellD3< T >::operator stringc().


The documentation for this class was generated from the following file:

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