vtf-logo

Node_OneIncCell.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00008 #if !defined(__geom_mesh_simplicial_Node_OneIncCell_h__)
00009 #define __geom_mesh_simplicial_Node_OneIncCell_h__
00010 
00011 #if defined(DEBUG_geom) && !defined(DEBUG_Node_OneIncCell)
00012 #define DEBUG_Node_OneIncCell
00013 #endif
00014 
00015 #ifdef DEBUG_Node_OneIncCell
00016 #ifndef DEBUG_Node_VertSelfId
00017 // Debug the base class.
00018 #define DEBUG_Node_VertSelfId
00019 #endif
00020 #endif
00021 
00022 #include "Node_VertSelfId.h"
00023 
00024 BEGIN_NAMESPACE_GEOM
00025 
00027 
00033 template <class Mesh>
00034 class Node_OneIncCell :
00035   public Node_VertSelfId<Mesh>
00036 {
00037   //
00038   // Private types.
00039   //
00040 
00041 private:
00042 
00043   typedef Node_VertSelfId<Mesh> base_type;
00044 
00045   //
00046   // Enumerations.
00047   //
00048 
00049 public:
00050 
00052   enum { N = base_type::N };
00053 
00054   //
00055   // Public types.
00056   //
00057 
00058 public:
00059 
00061   typedef Mesh mesh_type;
00062 
00064   typedef typename mesh_type::cell_iterator cell_iterator;
00066   typedef typename mesh_type::cell_const_iterator cell_const_iterator;
00067 
00069   typedef typename base_type::node_iterator node_iterator;
00071   typedef typename base_type::node_const_iterator node_const_iterator;
00072 
00074   typedef typename base_type::number_type number_type;
00076   typedef typename base_type::vertex_type vertex_type;
00077 
00078   //
00079   // Data
00080   //
00081       
00082 private:
00083       
00085   cell_iterator _cell;
00086 
00087 public:
00088 
00089   //--------------------------------------------------------------------------
00092 
00094   Node_OneIncCell() :
00095     base_type(),
00096     _cell( 0 )
00097   {}
00098 
00100   Node_OneIncCell( const vertex_type& point, const int identifier = -1,
00101                    const cell_iterator cell = 0 ) :
00102     base_type( point, identifier ),
00103     _cell( cell )
00104   {}
00105 
00107   void
00108   build( const vertex_type& point, const int identifier = -1, 
00109          const cell_iterator cell = 0 )
00110   {
00111     base_type::build( point, identifier );
00112     _cell = cell;
00113   }
00114 
00116   Node_OneIncCell( const Node_OneIncCell& x ) :
00117     base_type( x ),
00118     _cell( x._cell )
00119   {}
00120 
00122   ~Node_OneIncCell()
00123   {}
00124 
00126   //--------------------------------------------------------------------------
00129       
00131   Node_OneIncCell& 
00132   operator=( const Node_OneIncCell& x )
00133   {
00134     if ( &x != this ) {
00135       base_type::operator=( x );
00136       _cell = x._cell;
00137     }
00138     return *this;
00139   }
00140 
00142   //--------------------------------------------------------------------------
00145 
00147   const vertex_type&
00148   vertex() const
00149   { 
00150     return base_type::vertex();
00151   }
00152 
00154 
00158   int
00159   identifier() const
00160   {
00161     return base_type::identifier();
00162   }
00163 
00165   node_const_iterator
00166   self() const
00167   { 
00168     return base_type::self();
00169   }
00170 
00172   cell_const_iterator
00173   cell() const
00174   { 
00175     return _cell;
00176   }
00177 
00179   //--------------------------------------------------------------------------
00182 
00184   void
00185   set_vertex( const vertex_type& vertex )
00186   { 
00187     base_type::set_vertex( vertex );
00188   }
00189 
00191 
00195   void
00196   set_identifier( const int identifier ) const
00197   { 
00198     base_type::set_identifier( identifier );
00199   }
00200 
00202   node_iterator
00203   self()
00204   { 
00205     return base_type::self();
00206   }
00207 
00209   void
00210   set_self( const node_iterator v )
00211   { 
00212     base_type::set_self( v );
00213   }
00214 
00216   cell_iterator
00217   cell()
00218   { 
00219     return _cell;
00220   }
00221 
00223   void
00224   add_cell( const cell_iterator c )
00225   { 
00226     _cell = c;
00227   }
00228 
00230   void
00231   remove_cell( const cell_iterator c )
00232   { 
00233     // Look for another adjacent cell.
00234     // CONTINUE;
00235     assert( false );
00236   }
00237 
00239   //--------------------------------------------------------------------------
00242   
00244   bool
00245   operator==( const Node_OneIncCell& x ) const
00246   {
00247     return base_type::operator==( x ) && _cell == x._cell;
00248   }
00249 
00251   bool
00252   operator!=( const Node_OneIncCell& x ) const
00253   {
00254     return ! operator==( x );
00255   }
00256 
00258   //--------------------------------------------------------------------------
00261 
00263   void
00264   put( std::ostream& out ) const
00265   {
00266     // Write the point and the vertex identifier.
00267     base_type::put( out );
00268     // Write the incident cell identifier.
00269     out << " " << _cell->identifier();
00270   }
00271 
00273 };
00274 
00275 END_NAMESPACE_GEOM
00276 
00277 #endif

Generated on Fri Aug 24 12:55:55 2007 for Computational Geometry Package by  doxygen 1.4.7