/********************************************************************/ /* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno */ /* All rights reserved. */ /********************************************************************/ #ifndef _MGCellNB_HH_ #define _MGCellNB_HH_ #include #include "topo/CellBase.h" #include "mg/Position.h" // //Defines MGCellNB Class. class MGBox; class MGComplex; class MGGeometry; class MGCellBase; class MGBVertex; class MGCellMap; /** @addtogroup TOPO * @{ */ ///CellNB is a cell without boundaries(No Boundaries). ///MGCellNB ia an abstract class and the super class of ///MGBVertex, MGEdge, and MGCell. ///There are two types of cells. One is parameter cell(pcell) and ///the other is binder cell(bcell). They are exclusive, that is, if ///a cell is a parameter cell, the cell cannot be binder cell and ///vice versa. ///Parameter cell is a constituent of a complex and MGCellNB's are stored ///in MGComplex. ///Binder cell is a binder of parameter cells. Plural cells are connected ///through a binder. class MG_DLL_DECLR MGCellNB:public MGCellBase{ public: typedef std::vector::iterator partnerItr; typedef std::vector::const_iterator const_partnerItr; typedef std::vector::reverse_iterator partnerRItr; typedef std::vector::const_reverse_iterator const_partnerRItr; enum CELL_KIND{ UNKNOWN=0, PCELL=1, BCELL=2 }; ///////Constructor///////// ///Void constructor. Constructor of pcell. MGCellNB(); ///Copy constructor. Result cell is not a member of any complex. ///Partners of cell will not be copied. MGCellNB(const MGCellNB& cell); ///CellNB of whole geometry(no boundary). ///The second form that input MGGeometry* takes the ownership of the geo ///into the MGCellNB, must not delete the object and the object must be ///newed one. MGCellNB(const MGGeometry& geo); explicit MGCellNB( MGGeometry* geo///=1;}; ///Make a binder cell of this parameter cell. ///Returned is the binder pointer generated by new. ///The binder has no geometry, only has binder and parameter cell relationship. virtual MGCellNB* make_binder() const=0; ///Obtain manifold dimension. virtual int manifold_dimension() const=0; ///Obtain the i-th member partner. This must be a binder cell. const MGCellBase* member_partner(int i)const{return m_partners[i];}; ///Obtain member partners. This must be a binder cell. const std::vector& member_partners()const{return m_partners;}; std::vector& member_partners(){return m_partners;}; ///Negate the direction of the cell. virtual void negate(); ///Return nummber of partners stored in m_partners. int number_of_partner_members() const{return int(m_partners.size());}; ///Obtain all the neighbours. ///The neighbours do not contain this cell except when this cell is ///connected to this cell itself(closed cell). virtual std::vector neighbours() const=0; ///Return parameter space error of the cell. virtual double parameter_error()const=0; ///Obtain parent complex. const MGComplex* parent_complex() const{return m_parent_complex;}; MGComplex* parent_complex() {return m_parent_complex;}; ///Set extent of this cell. virtual void set_extent(MGGeometry* extent=0); ///Obtain star cells. const MGCellNB* star() const; MGCellNB* star(); /// Output virtual function. virtual std::ostream& out(std::ostream&) const; virtual std::string whoami()const{return "CellNB";}; protected: mutable MGComplex* m_parent_complex; /// m_partners; ///& cvec) const=0; ///Make this cell's binder cell's extent expression. ///Returned is a MGGeometry pointer generated by new. ///When this cell does not have star cell, null pointer will be returned. ///make_binder_extent() only makes the expression, and does nothing to ///the topology structure. virtual MGGeometry* make_binder_extent() const=0; ///Make sure that this has an extent expression. ///When this did not have an extent, make the extent from the partner ///member's parameter expression and the star cell. ///This must be a binder cell that has partner members that are ///boundaries. When this is not the case or this had an extent already, ///it does nothing. virtual void make_extent() const=0; ///Merge two bcells. ///bcell2 will be destructed. virtual void merge_bcell(MGCellNB* bcell2); ///Negate the boundary. virtual void negate_boundary()=0; friend class MGCellBase; friend class MGComplex; friend class MGEdge; }; /** @} */ // end of TOPO group #endif