MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
CellNB.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGCellNB_HH_
6 #define _MGCellNB_HH_
7 
8 #include <vector>
9 #include "topo/CellBase.h"
10 #include "mg/Position.h"
11 
12 //
13 //Defines MGCellNB Class.
14 
15 class MGBox;
16 class MGComplex;
17 class MGGeometry;
18 class MGCellBase;
19 class MGBVertex;
20 class MGCellMap;
21 
26 
38 class MG_DLL_DECLR MGCellNB:public MGCellBase{
39 
40 public:
41 
42 typedef std::vector<MGCellBase*>::iterator partnerItr;
43 typedef std::vector<const MGCellBase*>::const_iterator const_partnerItr;
44 typedef std::vector<MGCellBase*>::reverse_iterator partnerRItr;
45 typedef std::vector<const MGCellBase*>::const_reverse_iterator const_partnerRItr;
46 
47 enum CELL_KIND{
48  UNKNOWN=0,
49  PCELL=1,
50  BCELL=2
51 };
52 
54 
56 MGCellNB();
57 
60 MGCellNB(const MGCellNB& cell);
61 
66 MGCellNB(const MGGeometry& geo);
67 explicit MGCellNB(
68  MGGeometry* geo
69 );
71 
74 MGCellNB(
75  MGGeometry* geo,
76  MGCellNB* binder
77 );
78 
80 virtual ~MGCellNB();
81 
83 
87 virtual MGCellNB& operator=(const MGCellNB& gel2);
88 
90 virtual MGCellNB& operator+=(const MGVector& v);
91 virtual MGCellNB& operator-=(const MGVector& v);
92 virtual MGCellNB& operator*=(double scale);
93 virtual MGCellNB& operator*=(const MGMatrix& mat);
94 virtual MGCellNB& operator*=(const MGTransf& tr);
95 
97 
102 void add_partner(const MGCellBase& partner);
103 
105 const MGBox& box() const=0;
106 
108 MGPosition center() const;
109 
111 virtual MGPosition center_param() const=0;
112 
115 virtual MGCellNB* clone() const=0;
116 
119 virtual MGCellNB* clone_without_boundaries() const=0;
120 
123 virtual MGCellNB* clone_binder(const MGCellBase& c) const=0;
124 
126 virtual MGUnit_vector direction() const;
127 
131 virtual void draw3DVertex(mgVBO& vbo)const=0;
132 
134 const MGGeometry* extent() const{ return m_extent;};
135 MGGeometry* extent() {return m_extent;};
136 
139 MGGeometry* free_extent();
140 
144 MGComplex* free_from_parent();
145 
147 virtual void free_neighbourhood(int i, int j=0)=0;
148 
150 void free_partner(const MGCellBase* cellin) const;
151 
153 virtual long identify_type()const=0;
154 
156 bool is_bcell() const{return m_partners.size()>=1;};
157 
161 virtual MGCellNB* make_binder() const=0;
162 
164 virtual int manifold_dimension() const=0;
165 
167 const MGCellBase* member_partner(int i)const{return m_partners[i];};
168 
170 const std::vector<const MGCellBase*>& member_partners()const{return m_partners;};
171 std::vector<const MGCellBase*>& member_partners(){return m_partners;};
172 
174 virtual void negate();
175 
177 int number_of_partner_members() const{return int(m_partners.size());};
178 
182 virtual std::vector<const MGCellNB*> neighbours() const=0;
183 
185 virtual double parameter_error()const=0;
186 
188 const MGComplex* parent_complex() const{return m_parent_complex;};
189 MGComplex* parent_complex() {return m_parent_complex;};
190 
192 virtual void set_extent(MGGeometry* extent=0);
193 
195 const MGCellNB* star() const;
196 MGCellNB* star();
197 
199 virtual std::ostream& out(std::ostream&) const;
200 virtual std::string whoami()const{return "CellNB";};
201 
202 protected:
203 
204  mutable MGComplex* m_parent_complex;
209  mutable std::vector<const MGCellBase*> m_partners;
211 
213 bool bn_binder_tr_necessary()const{ return !parent_complex();}
214 
219 virtual MGCellNB* clone(MGCellMap& cmap) const;
220 
222 virtual void compute_box() const=0;
223 
225 bool is_less_than(const MGCellNB& cell2)const;
226 
228 virtual void ReadMembers(MGIfstream& buf);
229 
233 
235 virtual void WriteMembers(MGOfstream& buf) const;
236 
240 MGCellNB& set_cellnb(const MGCellNB& cell2);
241 
242 private:
243 
245 virtual void bn_binder_tr(const MGVector& v)=0;
246 virtual void bn_binder_tr(double s)=0;
247 virtual void bn_binder_tr(const MGMatrix& mat)=0;
248 virtual void bn_binder_tr(const MGTransf& tr)=0;
249 
251 virtual void set_box_as_null() const=0;
252 
254 virtual void copy_all_boundaries(const MGCellBase& cell2)=0;
255 
259 virtual void copy_all_boundaries(const MGCellBase& cell2, MGCellMap& cmap)=0;
260 
262 virtual void copy_box(const MGCellBase& cell2) const=0;
263 
265 virtual void copy_perror(const MGCellBase& cell2) const=0;
266 
268 void free_partner(const_partnerItr itr) const;
269 
272 virtual void get_all_boundary_binders(std::vector<MGCellNB*>& cvec) const=0;
273 
279 virtual MGGeometry* make_binder_extent() const=0;
280 
287 virtual void make_extent() const=0;
288 
291 virtual void merge_bcell(MGCellNB* bcell2);
292 
294 virtual void negate_boundary()=0;
295 
296 friend class MGCellBase;
297 friend class MGComplex;
298 friend class MGEdge;
299 
300 };
301  // end of TOPO group
303 #endif
bool is_bcell() const
Ask if this is binder cell.
Definition: CellNB.h:156
CellNB is a cell without boundaries(No Boundaries).
Definition: CellNB.h:38
MGBVertex is 0 manifold dimension binder cell, is an point.
Definition: BVertex.h:30
Is an abstract class and the super class of MGPVertex and MGCellNB.
Definition: CellBase.h:38
MGTransf represents a transformation of a space dimension.
Definition: Transf.h:35
const std::vector< const MGCellBase * > & member_partners() const
Obtain member partners. This must be a binder cell.
Definition: CellNB.h:170
std::vector< const MGCellBase * >::const_reverse_iterator const_partnerRItr
Definition: CellNB.h:45
std::vector< const MGCellBase * >::const_iterator const_partnerItr
Definition: CellNB.h:43
virtual MGCellBase & operator+=(const MGVector &v)=0
Object transformation.
virtual long identify_type() const =0
Return This object's typeID.
CELL_KIND
Definition: CellNB.h:47
std::vector< MGCellBase * >::reverse_iterator partnerRItr
Definition: CellNB.h:44
virtual std::string whoami() const
Definition: CellNB.h:200
const MGComplex * parent_complex() const
Obtain parent complex.
Definition: CellNB.h:188
virtual void ReadMembers(MGIfstream &buf)
Read Object's member data.
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
int number_of_partner_members() const
Return nummber of partners stored in m_partners.
Definition: CellNB.h:177
MGComplex * parent_complex()
Definition: CellNB.h:189
std::vector< const MGCellBase * > & member_partners()
Definition: CellNB.h:171
Vector of a general n space dimension.
Definition: Vector.h:26
virtual std::ostream & out(std::ostream &) const
Output virtual function.
MGGeometry is an abstract class which represents a whole geometry.
Definition: Geometry.h:36
virtual MGCellBase * clone() const =0
Defines a Box of any space dimendion.
Definition: Box.h:34
virtual void negate()=0
Negate the direction of the cell.
virtual void draw3DVertex(mgVBO &vbo) const =0
friend class MGCellNB
Definition: CellBase.h:212
virtual void WriteMembers(MGOfstream &buf) const
Write Object's Member Data.
bool bn_binder_tr_necessary() const
check if boundary's binder transformation is necessary or not.
Definition: CellNB.h:213
MGEdge is an instance of MGCellNB, represents a boundary element of 2D manifold.
Definition: Edge.h:33
MGGeometry * extent()
Definition: CellNB.h:135
virtual MGCellNB * make_binder() const =0
Represent a positional data.
Definition: Position.h:28
virtual MGCellBase & operator=(const MGCellBase &gel2)
const MGBox & box() const =0
Obtain the box of the cell.
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
virtual int manifold_dimension() const =0
Obtain manifold dimension.
const MGCellBase * member_partner(int i) const
Obtain the i-th member partner. This must be a binder cell.
Definition: CellNB.h:167
const MGGeometry * extent() const
Get extent geometry, may be null if this does not have extent.
Definition: CellNB.h:134
MGComplex is a container of parameter cells and binder cells.
Definition: Complex.h:25
std::vector< MGCellBase * >::iterator partnerItr
Definition: CellNB.h:42
virtual MGCellBase & operator*=(double scale)=0
virtual MGCellBase & operator-=(const MGVector &v)=0
MGGeometry * m_extent
Geometry.
Definition: CellNB.h:208
virtual const MGCellNB * star() const =0
Obtain star cells.
OpenGL 4 用描画のためのクラス, in other words, display list.
Definition: VBO.h:76
virtual MGCellBase * clone_without_boundaries() const =0
std::vector< const MGCellBase * > m_partners
vector of partner cells who share this bcell(for bcell).
Definition: CellNB.h:209
Define a unit vector, is a MGVector.
Definition: Unit_vector.h:17
MGMatrix is a matix of m by m, where m is the space dimension.
Definition: Matrix.h:30