#ifndef __CPM__DATASTRUCTURES__QUADEDGEMESH__H__ #define __CPM__DATASTRUCTURES__QUADEDGEMESH__H__ #include #include #include #include #include namespace cpm { namespace DataStructures { /** */ template< typename P, unsigned int D = 3, typename T = itk::DefaultStaticMeshTraits< P, D, D > > class QuadEdgeMesh : public itk::Mesh< P, D, T > { public: typedef QuadEdgeMesh Self; typedef itk::Mesh< P, D, T > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; /// Types from superclass typedef typename Superclass::BoundaryAssignmentsContainer BoundaryAssignmentsContainer; typedef typename Superclass::BoundaryAssignmentsContainerPointer BoundaryAssignmentsContainerPointer; typedef typename Superclass::BoundingBoxType BoundingBoxType; typedef typename Superclass::CellAutoPointer CellAutoPointer; typedef typename Superclass::CellsContainer CellsContainer; typedef typename Superclass::CellDataContainer CellDataContainer; typedef typename Superclass::CellFeatureCount CellFeatureCount; typedef typename Superclass::CellFeatureIdentifier CellFeatureIdentifier; typedef typename Superclass::CellIdentifier CellIdentifier; typedef typename Superclass::CellLinksContainer CellLinksContainer; typedef typename Superclass::CellMultiVisitorType CellMultiVisitorType; typedef typename Superclass::CellPixelType CellPixelType; typedef typename Superclass::CellType CellType; typedef typename Superclass::PointIdentifier PointIdentifier; typedef typename Superclass::PointsContainer PointsContainer; typedef typename Superclass::PointType PointType; /// QuadEdge types (primal and dual) typedef QuadEdge< PointIdentifier, CellIdentifier > TPrimalEdge; typedef typename TPrimalEdge::TDual TDualEdge; typedef QuadEdgeCell< CellType, TPrimalEdge > TQuadEdgeCell; /// Memory management objects typedef std::set< typename TPrimalEdge::Pointer > CntPrimalEdges; typedef std::set< typename TDualEdge::Pointer > CntDualEdges; typedef std::vector< TPrimalEdge* > CntOnextRings; /// More geometry types typedef typename PointType::VectorType VectorType; typedef typename VectorType::ValueType TScalar; typedef std::vector< VectorType > CntNormals; typedef typename CntNormals::const_iterator NormalsIterator; protected: typedef std::vector< TPrimalEdge* > _TEdges; public: itkNewMacro( Self ); itkTypeMacro( QuadEdgeMesh, itkMesh ); public: // Edge related methods TPrimalEdge* FindEdge( const PointIdentifier& a ) const; TPrimalEdge* FindEdge( const PointIdentifier& a, const PointIdentifier& b ) const; TPrimalEdge* FindEntryEdge( const CellIdentifier& i ) const; /// New geometric methods const CntNormals& GetPointNormalsContainer( ) const; NormalsIterator BeginPointNormals( ) const; NormalsIterator EndPointNormals( ) const; const VectorType& GetPointNormal( const PointIdentifier& id ) const; /// itk::DataObject methods overloading virtual bool RequestedRegionIsOutsideOfTheBufferedRegion( ); /// itk::PointSet methods overloading virtual void SetPoints( PointsContainer* points ); virtual void SetPoint( PointIdentifier id , PointType point ); /// itk::Mesh methods overloading virtual void PassStructure( Self* inputMesh ) { std::cout << "PassStructure" << std::endl; std::exit( 1 ); } virtual void Initialize( ); virtual void Graft( const itk::DataObject* data ); void SetCellLinks( CellLinksContainer* cellLinks ) { std::cout << "SetCellLinks" << std::endl; std::exit( 1 ); } virtual CellLinksContainer* GetCellLinks( ) { std::cout << "GetCellLinks" << std::endl; std::exit( 1 ); } virtual const CellLinksContainer* GetCellLinks( ) const { std::cout << "GetCellLinks (const)" << std::endl; std::exit( 1 ); } virtual void SetCells( CellsContainer* cells ); virtual void SetCellData( CellDataContainer* data ); virtual CellDataContainer* GetCellData( ) { std::cout << "GetCellData" << std::endl; std::exit( 1 ); } virtual const CellDataContainer* GetCellData( ) const { std::cout << "GetCellData (const)" << std::endl; std::exit( 1 ); } #if !defined( CABLE_CONFIGURATION ) virtual void SetBoundaryAssignments( int dimension, BoundaryAssignmentsContainer* container ) { std::cout << "SetBoundaryAssignments" << std::endl; std::exit( 1 ); } virtual BoundaryAssignmentsContainerPointer GetBoundaryAssignments( int dimension ) { std::cout << "GetBoundaryAssignments" << std::endl; std::exit( 1 ); } virtual const BoundaryAssignmentsContainerPointer GetBoundaryAssignments( int dimension ) const { std::cout << "GetBoundaryAssignments (const)" << std::endl; std::exit( 1 ); } #endif virtual void SetCell( CellIdentifier id, CellAutoPointer& ptr ); virtual void SetCellData( CellIdentifier id, CellPixelType data ); virtual bool GetCellData( CellIdentifier id, CellPixelType* data ) const { std::cout << "GetCellData" << std::endl; std::exit( 1 ); } virtual void SetBoundaryAssignment( int dimension, CellIdentifier cellId, CellFeatureIdentifier featureId, CellIdentifier boundaryId ) { std::cout << "SetBoundaryAssignment" << std::endl; std::exit( 1 ); } virtual bool GetBoundaryAssignment( int dimension, CellIdentifier cellId, CellFeatureIdentifier featureId, CellIdentifier* boundaryId ) const { std::cout << "GetBoundaryAssignment" << std::endl; std::exit( 1 ); } virtual bool RemoveBoundaryAssignment( int dimension, CellIdentifier cellId, CellFeatureIdentifier featureId ) { std::cout << "RemoveBoundaryAssignment" << std::endl; std::exit( 1 ); } virtual CellFeatureCount GetNumberOfCellBoundaryFeatures( int dimension, CellIdentifier id ) const { std::cout << "GetNumberOfCellBoundaryFeatures" << std::endl; std::exit( 1 ); } virtual bool GetCellBoundaryFeature( int dimension, CellIdentifier id, CellFeatureIdentifier fid, CellAutoPointer& ptr ) const { std::cout << "GetCellBoundaryFeature" << std::endl; std::exit( 1 ); } virtual CellIdentifier GetCellBoundaryFeatureNeighbors( int dimension, CellIdentifier id, CellFeatureIdentifier fid, std::set< CellIdentifier >* cellSet ) { std::cout << "GetCellBoundaryFeatureNeighbors" << std::endl; std::exit( 1 ); } virtual CellIdentifier GetCellNeighbors( CellIdentifier cellId, std::set< CellIdentifier >* cellSet ) { std::cout << "GetCellNeighbors" << std::endl; std::exit( 1 ); } virtual bool GetAssignedCellBoundaryIfOneExists( int dimension, CellIdentifier id, CellFeatureIdentifier fid, CellAutoPointer& ptr ) const { std::cout << "GetAssignedCellBoundaryIfOneExists" << std::endl; std::exit( 1 ); } virtual void BuildCellLinks( ) const; virtual void Accept( CellMultiVisitorType* mv ) const { std::cout << "Accept" << std::endl; std::exit( 1 ); } protected: QuadEdgeMesh( ); virtual ~QuadEdgeMesh( ); virtual void ReleaseCellsMemory( ) { std::cout << "ReleaseCellsMemory" << std::endl; std::exit( 1 ); } inline bool _CheckPoints( const CellAutoPointer& ptr ) const; inline void _DeletePoint( const PointIdentifier& pId ); inline TPrimalEdge* _CreateQuadEdge( const PointIdentifier& a, const PointIdentifier& b ); inline void _DeleteEdge( TPrimalEdge* edge ); inline void _DeleteFace( const CellIdentifier& f ); inline void _ConstructEdges( _TEdges& edges, const CellAutoPointer& ptr ); virtual VectorType _ComputePointNormal( const TPrimalEdge* e ) const; inline void _ReleaseQuadEdgeObjects( ); private: QuadEdgeMesh( const Self& ); // Not implemented void operator=( const Self& ); // Not implemented protected: CntPrimalEdges m_PrimalEdges; CntDualEdges m_DualEdges; CntOnextRings m_OnextRings; CntNormals m_PointNormals; }; } // ecapseman } // ecapseman #include #endif // __CPM__DATASTRUCTURES__QUADEDGEMESH__H__ // eof - $RCSfile$