1 #ifndef __CPEXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__H__
2 #define __CPEXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__H__
8 #include <cpExtensions/DataStructures/QuadEdgeCell.h>
9 #include <cpExtensions/DataStructures/QuadEdge.h>
11 namespace cpExtensions
13 namespace DataStructures
17 template< typename P, unsigned int D = 3, typename T = itk::DefaultStaticMeshTraits< P, D, D > >
19 : public itk::Mesh< P, D, T >
22 typedef QuadEdgeMesh Self;
23 typedef itk::Mesh< P, D, T > Superclass;
24 typedef itk::SmartPointer< Self > Pointer;
25 typedef itk::SmartPointer< const Self > ConstPointer;
27 /// Types from superclass
29 Superclass::BoundaryAssignmentsContainer
30 BoundaryAssignmentsContainer;
33 Superclass::BoundaryAssignmentsContainerPointer
34 BoundaryAssignmentsContainerPointer;
36 typedef typename Superclass::BoundingBoxType BoundingBoxType;
37 typedef typename Superclass::CellAutoPointer CellAutoPointer;
38 typedef typename Superclass::CellsContainer CellsContainer;
39 typedef typename Superclass::CellDataContainer CellDataContainer;
40 typedef typename Superclass::CellFeatureCount CellFeatureCount;
41 typedef typename Superclass::CellFeatureIdentifier CellFeatureIdentifier;
42 typedef typename Superclass::CellIdentifier CellIdentifier;
43 typedef typename Superclass::CellLinksContainer CellLinksContainer;
44 typedef typename Superclass::CellMultiVisitorType CellMultiVisitorType;
45 typedef typename Superclass::CellPixelType CellPixelType;
46 typedef typename Superclass::CellType CellType;
47 typedef typename Superclass::PointIdentifier PointIdentifier;
48 typedef typename Superclass::PointsContainer PointsContainer;
49 typedef typename Superclass::PointType PointType;
51 /// QuadEdge types (primal and dual)
52 typedef QuadEdge< PointIdentifier, CellIdentifier > TPrimalEdge;
53 typedef typename TPrimalEdge::TDual TDualEdge;
54 typedef QuadEdgeCell< CellType, TPrimalEdge > TQuadEdgeCell;
56 /// Memory management objects
57 typedef std::set< typename TPrimalEdge::Pointer > CntPrimalEdges;
58 typedef std::set< typename TDualEdge::Pointer > CntDualEdges;
59 typedef std::vector< TPrimalEdge* > CntOnextRings;
61 /// More geometry types
62 typedef typename PointType::VectorType VectorType;
63 typedef typename VectorType::ValueType TScalar;
64 typedef std::vector< VectorType > CntNormals;
65 typedef typename CntNormals::const_iterator NormalsIterator;
68 typedef std::vector< TPrimalEdge* > _TEdges;
72 itkTypeMacro( QuadEdgeMesh, itkMesh );
75 // Edge related methods
76 TPrimalEdge* FindEdge( const PointIdentifier& a ) const;
77 TPrimalEdge* FindEdge(
78 const PointIdentifier& a, const PointIdentifier& b
80 TPrimalEdge* FindEntryEdge( const CellIdentifier& i ) const;
82 /// New geometric methods
83 const CntNormals& GetPointNormalsContainer( ) const;
84 NormalsIterator BeginPointNormals( ) const;
85 NormalsIterator EndPointNormals( ) const;
86 const VectorType& GetPointNormal( const PointIdentifier& id ) const;
88 /// itk::DataObject methods overloading
89 virtual bool RequestedRegionIsOutsideOfTheBufferedRegion( );
91 /// itk::PointSet methods overloading
92 virtual void SetPoints( PointsContainer* points );
93 virtual void SetPoint( PointIdentifier id , PointType point );
95 /// itk::Mesh methods overloading
96 virtual void PassStructure( Self* inputMesh )
98 std::cout << "PassStructure" << std::endl;
102 virtual void Initialize( );
103 virtual void Graft( const itk::DataObject* data );
105 void SetCellLinks( CellLinksContainer* cellLinks )
107 std::cout << "SetCellLinks" << std::endl;
110 virtual CellLinksContainer* GetCellLinks( )
112 std::cout << "GetCellLinks" << std::endl;
115 virtual const CellLinksContainer* GetCellLinks( ) const
117 std::cout << "GetCellLinks (const)" << std::endl;
120 virtual void SetCells( CellsContainer* cells );
121 virtual void SetCellData( CellDataContainer* data );
122 virtual CellDataContainer* GetCellData( )
124 std::cout << "GetCellData" << std::endl;
127 virtual const CellDataContainer* GetCellData( ) const
129 std::cout << "GetCellData (const)" << std::endl;
133 #if !defined( CABLE_CONFIGURATION )
134 virtual void SetBoundaryAssignments(
135 int dimension, BoundaryAssignmentsContainer* container
138 std::cout << "SetBoundaryAssignments" << std::endl;
141 virtual BoundaryAssignmentsContainerPointer
142 GetBoundaryAssignments( int dimension )
144 std::cout << "GetBoundaryAssignments" << std::endl;
147 virtual const BoundaryAssignmentsContainerPointer
148 GetBoundaryAssignments( int dimension ) const
150 std::cout << "GetBoundaryAssignments (const)" << std::endl;
155 virtual void SetCell( CellIdentifier id, CellAutoPointer& ptr );
156 virtual void SetCellData( CellIdentifier id, CellPixelType data );
157 virtual bool GetCellData( CellIdentifier id, CellPixelType* data ) const
159 std::cout << "GetCellData" << std::endl;
162 virtual void SetBoundaryAssignment(
163 int dimension, CellIdentifier cellId,
164 CellFeatureIdentifier featureId,
165 CellIdentifier boundaryId
168 std::cout << "SetBoundaryAssignment" << std::endl;
171 virtual bool GetBoundaryAssignment(
172 int dimension, CellIdentifier cellId,
173 CellFeatureIdentifier featureId,
174 CellIdentifier* boundaryId
177 std::cout << "GetBoundaryAssignment" << std::endl;
180 virtual bool RemoveBoundaryAssignment(
181 int dimension, CellIdentifier cellId,
182 CellFeatureIdentifier featureId
185 std::cout << "RemoveBoundaryAssignment" << std::endl;
188 virtual CellFeatureCount GetNumberOfCellBoundaryFeatures(
193 std::cout << "GetNumberOfCellBoundaryFeatures" << std::endl;
196 virtual bool GetCellBoundaryFeature(
197 int dimension, CellIdentifier id,
198 CellFeatureIdentifier fid,
202 std::cout << "GetCellBoundaryFeature" << std::endl;
205 virtual CellIdentifier GetCellBoundaryFeatureNeighbors(
208 CellFeatureIdentifier fid,
209 std::set< CellIdentifier >* cellSet )
211 std::cout << "GetCellBoundaryFeatureNeighbors" << std::endl;
214 virtual CellIdentifier GetCellNeighbors(
215 CellIdentifier cellId,
216 std::set< CellIdentifier >* cellSet
219 std::cout << "GetCellNeighbors" << std::endl;
222 virtual bool GetAssignedCellBoundaryIfOneExists(
223 int dimension, CellIdentifier id,
224 CellFeatureIdentifier fid,
228 std::cout << "GetAssignedCellBoundaryIfOneExists" << std::endl;
231 virtual void BuildCellLinks( ) const;
233 virtual void Accept( CellMultiVisitorType* mv ) const
235 std::cout << "Accept" << std::endl;
241 virtual ~QuadEdgeMesh( );
243 virtual void ReleaseCellsMemory( )
245 std::cout << "ReleaseCellsMemory" << std::endl;
249 inline bool _CheckPoints( const CellAutoPointer& ptr ) const;
250 inline void _DeletePoint( const PointIdentifier& pId );
251 inline TPrimalEdge* _CreateQuadEdge(
252 const PointIdentifier& a, const PointIdentifier& b
254 inline void _DeleteEdge( TPrimalEdge* edge );
255 inline void _DeleteFace( const CellIdentifier& f );
256 inline void _ConstructEdges(
257 _TEdges& edges, const CellAutoPointer& ptr
259 virtual VectorType _ComputePointNormal( const TPrimalEdge* e ) const;
260 inline void _ReleaseQuadEdgeObjects( );
263 QuadEdgeMesh( const Self& ); // Not implemented
264 void operator=( const Self& ); // Not implemented
267 CntPrimalEdges m_PrimalEdges;
268 CntDualEdges m_DualEdges;
270 CntOnextRings m_OnextRings;
272 CntNormals m_PointNormals;
279 #ifndef ITK_MANUAL_INSTANTIATION
280 #include <cpExtensions/DataStructures/QuadEdgeMesh.hxx>
281 #endif // ITK_MANUAL_INSTANTIATION
283 #endif // __CPEXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__H__