MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
Cell.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGCell_HH_
6 #define _MGCell_HH_
7 
8 #include <vector>
9 #include "mg/Box.h"
10 #include "mg/Position.h"
11 #include "topo/CellNB.h"
12 class MGComplex;
13 class MGBoundary;
14 class MGGeometry;
15 class MGCellMap;
16 
17 //
18 //Define MGCell Class.
19 
24 
35 class MG_DLL_DECLR MGCell:public MGCellNB{
36 
37 public:
38 
39 typedef std::vector<MGBoundary*>::iterator boundaryItr;
40 typedef std::vector<MGBoundary*>::const_iterator const_boundaryItr;
41 typedef std::vector<MGBoundary*>::reverse_iterator boundaryRItr;
42 typedef std::vector<MGBoundary*>::const_reverse_iterator const_boundaryRItr;
43 typedef boundaryItr iterator;
44 typedef const_boundaryItr const_iterator;
45 typedef boundaryRItr reverse_iterator;
46 typedef const_boundaryRItr const_reverse_iterator;
47 
49 
51 MGCell();
52 
56 MGCell(const MGCell& cell);
57 
63 MGCell(const MGGeometry& geo);
64 explicit MGCell(MGGeometry* geo);
65 
70 MGCell(
71  MGGeometry* geo,
72  std::vector<MGBoundary*>& boundaries,
73  MGCell* binder
74 );
75 
79 MGCell(const MGGeometry& geo,
80  const std::vector<MGBoundary*>& boundaries);
81 MGCell(MGGeometry* geo,
82  const std::vector<MGBoundary*>& boundaries);
83 
85 virtual ~MGCell();
86 
90 virtual MGCell& operator=(const MGCell& gel2);
91 
93 virtual bool operator<(const MGCell& gel2)const;
94 
96 
99 virtual int append_boundary(MGBoundary* bound);
100 
102 MGBoundary* boundary(int i) {return m_boundaries[i];};
103 const MGBoundary* boundary(int i) const {return m_boundaries[i];};
104 
106 const std::vector<MGBoundary*>& boundaries() const{return m_boundaries;};
107 
112 MGVector boundary_direction(int i, int j) const;
113 
115 const_boundaryItr boundaryIterator(const MGBoundary* bnd) const;
116 boundaryItr boundaryIterator(MGBoundary* bnd);
117 
119 const MGBox& box() const;
120 
122 MGPosition center_param() const;
123 
126 virtual MGCell* clone() const=0;
127 virtual MGCell* clone_without_boundaries() const=0;
128 
131 virtual MGCell* clone_binder(const MGCellBase& c) const=0;
132 
136 void connect(int i1, int j1,
137  MGCell* cell2, int i2, int j2);
138 
142 virtual void draw3DVertex(mgVBO& vbo)const=0;
143 
146 void erase_boundary(iterator i);
147 void erase_boundary(int i);
148 
150 void erase_boundary(MGBoundary* bnd);
151 
156 virtual MGBoundary* free_boundary(const MGBoundary* bound);
157 
159 void free_neighbourhood(int i, int j=0);
160 
162 virtual long identify_type()const=0;
163 
167 virtual MGCellNB* make_binder() const=0;
168 
170 virtual int manifold_dimension() const=0;
171 
175 std::vector<const MGCellNB*> neighbours() const;
176 
180 std::vector<const MGCellNB*> neighbours(int i, int j=0) const;
181 
183 int number_of_boundaries() const{ return int(m_boundaries.size());};
184 
186 double parameter_error()const;
187 
190 virtual int prepend_boundary(MGBoundary* bound);
191 
194 virtual void sort_boundaries();
195 
197 virtual std::ostream& out(std::ostream&) const;
198 
199 protected:
200  mutable MGBox m_box;
201  std::vector<MGBoundary*> m_boundaries;
205  mutable double m_perror;
206 
212 virtual MGCell* clone(MGCellMap& cmap)const=0;
213 
215 virtual void compute_box() const;
216 
218 virtual void set_box_as_null()const{m_box.set_null();};
219 
221 void copy_all_boundaries(const MGCellBase& cell);
222 
226 void copy_all_boundaries(const MGCellBase& cell, MGCellMap& cmap);
227 
229 void copy_box(const MGCellBase& cell2) const;
230 
232 void copy_perror(const MGCellBase& cell2) const;
233 
237 MGCell& set_cell(const MGCell& cell);
238 
239 virtual std::string whoami()const{return "Cell";};
240 
242 virtual void ReadMembers(MGIfstream& buf);
243 
245 virtual void WriteMembers(MGOfstream& buf) const;
246 
247 private:
248 
250 void bn_binder_tr(const MGVector& v);
251 void bn_binder_tr(double s);
252 void bn_binder_tr(const MGMatrix& mat);
253 void bn_binder_tr(const MGTransf& tr);
254 
257 void get_all_boundary_binders(std::vector<MGCellNB*>& cvec) const;
258 
264 virtual MGGeometry* make_binder_extent() const=0;
265 
272 virtual void make_extent() const=0;
273 
275 void negate_boundary();
276 
277 friend class MGComplex;
278 friend class MGBoundary;
279 
280 };
281  // end of TOPO group
283 #endif
CellNB is a cell without boundaries(No Boundaries).
Definition: CellNB.h:38
Is an abstract class and the super class of MGPVertex and MGCellNB.
Definition: CellBase.h:38
virtual void WriteMembers(MGOfstream &buf) const
Write Object's Member Data.
int number_of_boundaries() const
Return number of boundaries.
Definition: Cell.h:183
virtual void free_neighbourhood(int i, int j=0)=0
Free neighbourhood relation at j-th boundary's i-th pcell of this cell.
boundaryItr iterator
Definition: Cell.h:43
MGTransf represents a transformation of a space dimension.
Definition: Transf.h:35
virtual void set_box_as_null() const
set box as null(to set the box as initial)
Definition: Cell.h:218
const_boundaryRItr const_reverse_iterator
Definition: Cell.h:46
virtual bool operator<(const MGGel &gel2) const
virtual long identify_type() const =0
Return Object's type ID (TID)
const MGBox & box() const =0
Obtain the box of the cell.
double m_perror
Definition: Cell.h:205
virtual MGCellNB & operator=(const MGCellNB &gel2)
virtual void compute_box() const =0
compute box of the cell in m_box.
void set_null()
Set this box as a null box.
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
Vector of a general n space dimension.
Definition: Vector.h:26
virtual void connect(MGCellBase &cell2)
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 MGCellNB * clone_without_boundaries() const =0
virtual double parameter_error() const =0
Return parameter space error of the cell.
Defines a Box of any space dimendion.
Definition: Box.h:34
const std::vector< MGBoundary * > & boundaries() const
Obtain boundaries of this cell.
Definition: Cell.h:106
MGCell is a general cell that has bound.
Definition: Cell.h:35
std::vector< MGBoundary * >::iterator boundaryItr
Definition: Cell.h:39
Represent a positional data.
Definition: Position.h:28
boundaryRItr reverse_iterator
Definition: Cell.h:45
MGBoundary is a boundary of more than 1 manifold dimension.
Definition: Boundary.h:35
virtual MGCellNB * clone_binder(const MGCellBase &c) const =0
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
const_boundaryItr const_iterator
Definition: Cell.h:44
std::vector< MGBoundary * >::const_reverse_iterator const_boundaryRItr
Definition: Cell.h:42
MGBoundary * boundary(int i)
Obtain i-th boundary pointer.
Definition: Cell.h:102
std::vector< MGBoundary * >::const_iterator const_boundaryItr
Definition: Cell.h:40
MGBox m_box
Definition: Cell.h:200
MGComplex is a container of parameter cells and binder cells.
Definition: Complex.h:25
std::vector< MGBoundary * >::reverse_iterator boundaryRItr
Definition: Cell.h:41
virtual MGCellNB * make_binder() const =0
virtual int manifold_dimension() const =0
Obtain manifold dimension.
virtual void draw3DVertex(mgVBO &vbo) const =0
virtual std::string whoami() const
Definition: Cell.h:239
virtual std::vector< const MGCellNB * > neighbours() const =0
virtual void ReadMembers(MGIfstream &buf)
Read Object's member data.
OpenGL 4 用描画のためのクラス, in other words, display list.
Definition: VBO.h:76
virtual MGPosition center_param() const =0
Obtain the center parameter value of this cell.
const MGBoundary * boundary(int i) const
Definition: Cell.h:103
virtual MGCellNB * clone() const =0
MGMatrix is a matix of m by m, where m is the space dimension.
Definition: Matrix.h:30