1 #ifndef __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__H__
2 #define __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__H__
8 #include <cpPlugins/Extensions/DataStructures/QuadEdgeCell.h>
9 #include <cpPlugins/Extensions/DataStructures/QuadEdge.h>
15 namespace DataStructures
19 template< typename P, unsigned int D = 3, typename T = itk::DefaultStaticMeshTraits< P, D, D > >
21 : public itk::Mesh< P, D, T >
24 typedef QuadEdgeMesh Self;
25 typedef itk::Mesh< P, D, T > Superclass;
26 typedef itk::SmartPointer< Self > Pointer;
27 typedef itk::SmartPointer< const Self > ConstPointer;
29 /// Types from superclass
31 Superclass::BoundaryAssignmentsContainer
32 BoundaryAssignmentsContainer;
35 Superclass::BoundaryAssignmentsContainerPointer
36 BoundaryAssignmentsContainerPointer;
38 typedef typename Superclass::BoundingBoxType BoundingBoxType;
39 typedef typename Superclass::CellAutoPointer CellAutoPointer;
40 typedef typename Superclass::CellsContainer CellsContainer;
41 typedef typename Superclass::CellDataContainer CellDataContainer;
42 typedef typename Superclass::CellFeatureCount CellFeatureCount;
43 typedef typename Superclass::CellFeatureIdentifier CellFeatureIdentifier;
44 typedef typename Superclass::CellIdentifier CellIdentifier;
45 typedef typename Superclass::CellLinksContainer CellLinksContainer;
46 typedef typename Superclass::CellMultiVisitorType CellMultiVisitorType;
47 typedef typename Superclass::CellPixelType CellPixelType;
48 typedef typename Superclass::CellType CellType;
49 typedef typename Superclass::PointIdentifier PointIdentifier;
50 typedef typename Superclass::PointsContainer PointsContainer;
51 typedef typename Superclass::PointType PointType;
53 /// QuadEdge types (primal and dual)
54 typedef QuadEdge< PointIdentifier, CellIdentifier > TPrimalEdge;
55 typedef typename TPrimalEdge::TDual TDualEdge;
56 typedef QuadEdgeCell< CellType, TPrimalEdge > TQuadEdgeCell;
58 /// Memory management objects
59 typedef std::set< typename TPrimalEdge::Pointer > CntPrimalEdges;
60 typedef std::set< typename TDualEdge::Pointer > CntDualEdges;
61 typedef std::vector< TPrimalEdge* > CntOnextRings;
63 /// More geometry types
64 typedef typename PointType::VectorType VectorType;
65 typedef typename VectorType::ValueType TScalar;
66 typedef std::vector< VectorType > CntNormals;
67 typedef typename CntNormals::const_iterator NormalsIterator;
70 typedef std::vector< TPrimalEdge* > _TEdges;
74 itkTypeMacro( QuadEdgeMesh, itkMesh );
77 // Edge related methods
78 TPrimalEdge* FindEdge( const PointIdentifier& a ) const;
79 TPrimalEdge* FindEdge(
80 const PointIdentifier& a, const PointIdentifier& b
82 TPrimalEdge* FindEntryEdge( const CellIdentifier& i ) const;
84 /// New geometric methods
85 const CntNormals& GetPointNormalsContainer( ) const;
86 NormalsIterator BeginPointNormals( ) const;
87 NormalsIterator EndPointNormals( ) const;
88 const VectorType& GetPointNormal( const PointIdentifier& id ) const;
90 /// itk::DataObject methods overloading
91 virtual bool RequestedRegionIsOutsideOfTheBufferedRegion( );
93 /// itk::PointSet methods overloading
94 virtual void SetPoints( PointsContainer* points );
95 virtual void SetPoint( PointIdentifier id , PointType point );
97 /// itk::Mesh methods overloading
98 virtual void PassStructure( Self* inputMesh )
100 std::cout << "PassStructure" << std::endl;
104 virtual void Initialize( );
105 virtual void Graft( const itk::DataObject* data );
107 void SetCellLinks( CellLinksContainer* cellLinks )
109 std::cout << "SetCellLinks" << std::endl;
112 virtual CellLinksContainer* GetCellLinks( )
114 std::cout << "GetCellLinks" << std::endl;
117 virtual const CellLinksContainer* GetCellLinks( ) const
119 std::cout << "GetCellLinks (const)" << std::endl;
122 virtual void SetCells( CellsContainer* cells );
123 virtual void SetCellData( CellDataContainer* data );
124 virtual CellDataContainer* GetCellData( )
126 std::cout << "GetCellData" << std::endl;
129 virtual const CellDataContainer* GetCellData( ) const
131 std::cout << "GetCellData (const)" << std::endl;
135 #if !defined( CABLE_CONFIGURATION )
136 virtual void SetBoundaryAssignments(
137 int dimension, BoundaryAssignmentsContainer* container
140 std::cout << "SetBoundaryAssignments" << std::endl;
143 virtual BoundaryAssignmentsContainerPointer
144 GetBoundaryAssignments( int dimension )
146 std::cout << "GetBoundaryAssignments" << std::endl;
149 virtual const BoundaryAssignmentsContainerPointer
150 GetBoundaryAssignments( int dimension ) const
152 std::cout << "GetBoundaryAssignments (const)" << std::endl;
157 virtual void SetCell( CellIdentifier id, CellAutoPointer& ptr );
158 virtual void SetCellData( CellIdentifier id, CellPixelType data );
159 virtual bool GetCellData( CellIdentifier id, CellPixelType* data ) const
161 std::cout << "GetCellData" << std::endl;
164 virtual void SetBoundaryAssignment(
165 int dimension, CellIdentifier cellId,
166 CellFeatureIdentifier featureId,
167 CellIdentifier boundaryId
170 std::cout << "SetBoundaryAssignment" << std::endl;
173 virtual bool GetBoundaryAssignment(
174 int dimension, CellIdentifier cellId,
175 CellFeatureIdentifier featureId,
176 CellIdentifier* boundaryId
179 std::cout << "GetBoundaryAssignment" << std::endl;
182 virtual bool RemoveBoundaryAssignment(
183 int dimension, CellIdentifier cellId,
184 CellFeatureIdentifier featureId
187 std::cout << "RemoveBoundaryAssignment" << std::endl;
190 virtual CellFeatureCount GetNumberOfCellBoundaryFeatures(
195 std::cout << "GetNumberOfCellBoundaryFeatures" << std::endl;
198 virtual bool GetCellBoundaryFeature(
199 int dimension, CellIdentifier id,
200 CellFeatureIdentifier fid,
204 std::cout << "GetCellBoundaryFeature" << std::endl;
207 virtual CellIdentifier GetCellBoundaryFeatureNeighbors(
210 CellFeatureIdentifier fid,
211 std::set< CellIdentifier >* cellSet )
213 std::cout << "GetCellBoundaryFeatureNeighbors" << std::endl;
216 virtual CellIdentifier GetCellNeighbors(
217 CellIdentifier cellId,
218 std::set< CellIdentifier >* cellSet
221 std::cout << "GetCellNeighbors" << std::endl;
224 virtual bool GetAssignedCellBoundaryIfOneExists(
225 int dimension, CellIdentifier id,
226 CellFeatureIdentifier fid,
230 std::cout << "GetAssignedCellBoundaryIfOneExists" << std::endl;
233 virtual void BuildCellLinks( ) const;
235 virtual void Accept( CellMultiVisitorType* mv ) const
237 std::cout << "Accept" << std::endl;
243 virtual ~QuadEdgeMesh( );
245 virtual void ReleaseCellsMemory( )
247 std::cout << "ReleaseCellsMemory" << std::endl;
251 inline bool _CheckPoints( const CellAutoPointer& ptr ) const;
252 inline void _DeletePoint( const PointIdentifier& pId );
253 inline TPrimalEdge* _CreateQuadEdge(
254 const PointIdentifier& a, const PointIdentifier& b
256 inline void _DeleteEdge( TPrimalEdge* edge );
257 inline void _DeleteFace( const CellIdentifier& f );
258 inline void _ConstructEdges(
259 _TEdges& edges, const CellAutoPointer& ptr
261 virtual VectorType _ComputePointNormal( const TPrimalEdge* e ) const;
262 inline void _ReleaseQuadEdgeObjects( );
265 QuadEdgeMesh( const Self& ); // Not implemented
266 void operator=( const Self& ); // Not implemented
269 CntPrimalEdges m_PrimalEdges;
270 CntDualEdges m_DualEdges;
272 CntOnextRings m_OnextRings;
274 CntNormals m_PointNormals;
283 #include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.hxx>
285 #endif // __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__H__