MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
TL2Fan.h
1 #ifndef _mgTL2Fan_HH_
2 #define _mgTL2Fan_HH_
3 
4 #include <algorithm>
5 #include <vector>
6 #include <iosfwd>
7 
8 #include "mg/MGCL.h"
9 
10 /****************************************************************/
11 /* Copyright (c) 2011 by DG Technologies, Inc. */
12 /* All rights reserved. */
13 /****************************************************************/
14 
16 
23 // private class for tessellation.
24 
26 
38 class mgTL2Fan{
39  typedef std::deque<int> mgTL2deqIndex;
40 
41 private:
42  bool m_used;
43  mgTL2deqIndex m_indices;
44  std::vector<int> m_used_edges;
48 
49 public:
50  typedef mgTL2deqIndex::iterator IndexItr;
51  typedef mgTL2deqIndex::const_iterator CIndexItr;
52  typedef mgTL2deqIndex::reverse_iterator ritr;
53  typedef std::vector<int>::iterator EUitr;
54  typedef std::vector<int>::const_iterator CEUitr;
55 
56 friend std::ostream& operator<< (std::ostream& out, const mgTL2Fan& fan);
57 
59 
60  mgTL2Fan():m_used(false){;};
61  mgTL2Fan(int v1):m_indices(1,v1){;};
62  mgTL2Fan(int v1, int v2):m_used(false),m_indices(2){m_indices[0]=v1;m_indices[1]=v2;};
63  mgTL2Fan(mgTL2deqIndex& index):m_used(false),m_indices(index){;};
64 
66  int operator[](int i)const{return m_indices[i];};
67 
69 
70  int back()const{return m_indices.back();};
71  IndexItr begin(){return m_indices.begin();};
72  CIndexItr begin()const{return m_indices.begin();};
73 
75  bool edge_is_used(int j)const;
76 
77  IndexItr end(){return m_indices.end();};
78  CIndexItr end()const{return m_indices.end();};
79  void erase(IndexItr iter){m_indices.erase(iter);};
80 
82  CIndexItr find(int index)const{
83  return std::find(m_indices.begin(), m_indices.end(), index);
84  }
86  IndexItr find(int index){
87  return std::find(m_indices.begin(), m_indices.end(), index);
88  }
89 
91  IndexItr find_aft(int index);
92 
93  int front()const{return m_indices.front();};
94 
96  IndexItr insert(IndexItr iter, int index){
97  return m_indices.insert(iter, index);
98  };
99 
100  const mgTL2deqIndex& indices()const{return m_indices;};
101  void push_back(int index){m_indices.push_back(index);};
102  void push_front(int index){m_indices.push_front(index);};
103  void pop_back(){m_indices.pop_back();};
104  void pop_front(){m_indices.pop_front();};
105 
107  void print_indices(std::ostream& out)const;
108 
109  ritr rbegin(){return m_indices.rbegin();};
110  ritr rend(){return m_indices.rend();};
111 
113  void set_vertex_used(){m_used=true;};
114 
116  void set_edge_used(int j);
117 
118  int size()const{return (int)m_indices.size();};
119 
120  bool vertex_is_used()const{return m_used;};
121 
122 };
123  // end of UseTessellation group
125 #endif
mgTL2Fan(mgTL2deqIndex &index)
Definition: TL2Fan.h:63
int back() const
Definition: TL2Fan.h:70
mgTL2Fan(int v1)
Definition: TL2Fan.h:61
mgTL2deqIndex::iterator IndexItr
Definition: TL2Fan.h:50
int size() const
Definition: TL2Fan.h:118
std::vector< int >::iterator EUitr
Edge Used iterator.
Definition: TL2Fan.h:53
CIndexItr end() const
Definition: TL2Fan.h:78
void push_back(int index)
Definition: TL2Fan.h:101
std::vector< int >::const_iterator CEUitr
Edge Used iterator.
Definition: TL2Fan.h:54
mgTL2Fan()
Definition: TL2Fan.h:60
void push_front(int index)
Definition: TL2Fan.h:102
int operator[](int i) const
Definition: TL2Fan.h:66
void set_edge_used(int j)
Set the edge(i,j) as used where i is the index of this fan's vertex.
void print_indices(std::ostream &out) const
Print out indices as "|n0,n1,....
void set_vertex_used()
Set this vertex as used.
Definition: TL2Fan.h:113
mgTL2deqIndex::const_iterator CIndexItr
Definition: TL2Fan.h:51
IndexItr begin()
Definition: TL2Fan.h:71
mgTL2Fan is a point list to constitue a fan.
Definition: TL2Fan.h:38
void erase(IndexItr iter)
Definition: TL2Fan.h:79
ritr rend()
Definition: TL2Fan.h:110
mgTL2deqIndex::reverse_iterator ritr
Definition: TL2Fan.h:52
int front() const
Definition: TL2Fan.h:93
void pop_front()
Definition: TL2Fan.h:104
CIndexItr begin() const
Definition: TL2Fan.h:72
void pop_back()
Definition: TL2Fan.h:103
IndexItr insert(IndexItr iter, int index)
Insert the index before the position iter.
Definition: TL2Fan.h:96
bool vertex_is_used() const
Definition: TL2Fan.h:120
IndexItr find_aft(int index)
頂点周辺の頂点リストからindexを検索する(後ろから検索)
mgTL2Fan(int v1, int v2)
Definition: TL2Fan.h:62
ritr rbegin()
Definition: TL2Fan.h:109
const mgTL2deqIndex & indices() const
Definition: TL2Fan.h:100
bool edge_is_used(int j) const
Test if the edge(i,j) is used or not where i is the index of this edge.
IndexItr find(int index)
頂点周辺の頂点リストからindexを検索する(前から検索)
Definition: TL2Fan.h:86
friend std::ostream & operator<<(std::ostream &out, const mgTL2Fan &fan)
CIndexItr find(int index) const
頂点周辺の頂点リストからindexを検索する(前から検索)
Definition: TL2Fan.h:82
IndexItr end()
Definition: TL2Fan.h:77