47 int global_id = i->
id();
57 imap[ pane_id] = l_id;
63 int global_id = i->
id();
73 imap[ pane_id] = l_id;
85 int global_id = i->
id();
94 int global_id = i->
id();
100 return _subnode_imap_g.find( global_id)->second.find( pane_id)->second;
109 int global_id = i->
id();
114 int global_id = i->
id();
124 int pane_id,
int &lid,
138 if ( b->facet() != h->
facet()) {
143 while ( !win.is_same_node( b->origin(), h->
destination())) {
166 std::map<
int,std::pair<int,int> > &cnts) {
181 if ( pane_id == last_id)
continue;
193 bool first_iter =
true;
196 if ( !first_iter && (pane_id==last_id||panes.find(pane_id)!=panes.end()))
199 panes.insert(last_id=pane_id);
213 std::map<
int,std::pair<int,int> > &cnts) {
219 bool first_iter =
true;
222 if ( !first_iter && (pane_id==last_id||panes.find(pane_id)!=panes.end()))
224 ++(cnts[ pane_id].second);
225 panes.insert(last_id=pane_id);
237 std::vector<RFC_Pane_overlay*> b_ps, g_ps;
241 std::map< int, std::pair<int,int> > b_vertex_counts;
242 std::map< int, std::pair<int,int> > g_vertex_counts;
244 std::vector<RFC_Pane_overlay*>::iterator
pi;
245 for ( pi=b_ps.begin(); pi!=b_ps.end(); ++
pi)
246 b_vertex_counts[(*pi)->id()] = std::make_pair(0,0);
247 for ( pi=g_ps.begin(); pi!=g_ps.end(); ++
pi)
248 g_vertex_counts[(*pi)->id()] = std::make_pair(0,0);
252 for ( std::list< INode*>::const_iterator
265 for ( std::list< INode*>::const_iterator
273 for ( pi=b_ps.begin(); pi!=b_ps.end(); ++
pi)
274 (*pi)->allocate_subnodes( b_vertex_counts[(*pi)->id()].second);
275 for ( pi=g_ps.begin(); pi!=g_ps.end(); ++
pi)
276 (*pi)->allocate_subnodes( g_vertex_counts[(*pi)->id()].second);
282 std::vector<RFC_Pane_overlay*> b_ps, g_ps;
285 typedef std::map< int, std::vector< int> > Subface_counts;
286 Subface_counts cnts_b, cnts_g;
288 std::vector<RFC_Pane_overlay*>::iterator
pi;
289 for ( pi=b_ps.begin(); pi!=b_ps.end(); ++
pi)
290 cnts_b[(*pi)->id()].resize( (*pi)->size_of_faces(), 0);
291 for ( pi=g_ps.begin(); pi!=g_ps.end(); ++
pi)
292 cnts_g[(*pi)->id()].resize( (*pi)->size_of_faces(), 0);
295 for ( pi=b_ps.begin(); pi!=b_ps.end(); ++
pi) {
297 Subface_counts::iterator cnts_it_b = cnts_b.find(pane_b->
id());
298 Subface_counts::iterator cnts_it_g = cnts_g.begin();
300 for ( HDS::Facet_iterator fi=pane_b->
hds().facets_begin();
301 fi!=pane_b->
hds().facets_end(); ++fi) {
309 bool ret =
subdivide( nodes, ++nodes.begin(), sub_faces,
BLUE);
311 std::cerr <<
"ERROR: Got error code " << ret
312 <<
" when subdividing face "
313 << fi - pane_b->
hds().facets_begin() + 1
315 << pane_b->
get_index( fi->halfedge()->origin())+1
316 <<
" in pane " << pane_b->
id() << std::endl;
322 if (sub_faces.empty()) {
323 std::cerr <<
"ERROR: Error in enumerating subface in face "
324 << fi - pane_b->
hds().facets_begin() + 1
325 <<
" in pane " << pane_b->
id() << std::endl;
330 for (Subface_list::iterator
331 si=sub_faces.begin(), send=sub_faces.end(); si != send; ++si) {
332 int num_tris = si->size()-2;
335 if ( cnts_it_g->first != pane_g->
id())
336 cnts_it_g=cnts_g.find(pane_g->
id());
338 cnts_it_b->second[pane_b->
get_index(&*fi)] += num_tris;
345 for ( pi=b_ps.begin(); pi!=b_ps.end(); ++
pi) {
346 std::vector< int> &cnts = cnts_b[ (*pi)->id()];
348 if ( cnts.empty())
continue;
352 for (
int i=1,
n=cnts.size();
i<
n; ++
i) {
354 cnts[
i] = cnts[
i-1] + t1;
359 for ( pi=g_ps.begin(); pi!=g_ps.end(); ++
pi) {
360 std::vector< int> &cnts = cnts_g[ (*pi)->id()];
361 (*pi)->allocate_subfaces( cnts);
362 if ( cnts.empty())
continue;
366 for (
int i=1,
n=cnts.size();
i<
n; ++
i) {
368 cnts[
i] = cnts[
i-1] + t1;
373 Subface_counts &offsets_b=cnts_b, &offsets_g=cnts_g;
376 for ( pi=b_ps.begin(); pi!=b_ps.end(); ++
pi) {
378 const int pane_id_b = pane_b->
id();
380 Subface_counts::iterator offsets_it_b = offsets_b.find(pane_b->
id());
381 Subface_counts::iterator offsets_it_g = offsets_g.begin();
383 for ( HDS::Facet_iterator fi=(*pi)->hds().facets_begin();
384 fi!=(*pi)->hds().facets_end(); ++fi) {
401 for (Subface_list::iterator
402 si=sub_faces.begin(), send=sub_faces.end(); si != send; ++si) {
403 int n = si->size(), num_tris = n-2;
408 std::vector< Point_2> pnts_b( n), pnts_g( n);
409 for (
int k=0;
k<
n; ++
k) {
414 std::vector< Three_tuple<int> > tris( num_tris);
420 const int pane_id_g = pane_g->
id();
422 for (
int k=0;
k<num_tris; ++
k) {
423 int lids_b[3], lids_g[3];
427 for (
int i=0;
i<3; ++
i) {
431 lids_b[i], eids_b[i], ncs_b[i]);
433 lids_g[i], eids_g[i], ncs_g[i]);
436 if ( offsets_it_g->first != pane_g->
id())
437 offsets_it_g=offsets_g.find(pane_g->
id());
439 int idx_b = offsets_it_b->second[pane_b->
get_index(&*fi)]++;
440 int idx_g = offsets_it_g->second[pane_g->
get_index(g->
facet())]++;
443 lids_b, eids_b, ncs_b,
444 pane_id_g, idx_g+1, lids_g);
446 lids_g, eids_g, ncs_g,
447 pane_id_b, idx_b+1, lids_b);
std::pair< int, int > Node_ID
int face_id
local face id.
std::vector< Node_ID > _subnode_ids_b
int node_id
the local id within the pane starting from 1.
std::list< const INode * > INode_const_list
Parent_type parent_type(const int color) const
void set_subnode_id(INode *i, int color, int pane_id, int l_id)
void insert_subface(int idx, int plid, const int *lids, const Edge_ID *eids, const Point_2 *nc, int rp_id, int cnt, const int *rids)
Insert all the infomation related to a subface into the database.
Halfedge_overlay * halfedge()
An adaptor for enumerating node IDs of an element.
Halfedge * get_opposite(Halfedge *h) const
Vertex_overlay * destination()
#define COM_assertion_msg(EX, msg)
RFC_Pane_overlay * get_pane(Vertex *v) const
void normalize_nat_coor(int idx, int e, Point &nc) const
Base * base()
The id of its base COM::Pane object.
std::map< int, std::map< int, int > > _subnode_imap_g
Halfedge * get_parent_face(const Subface &sf, int color)
void triangulate(const Point_2 *ps, int n, Connectivity *tri)
Main entry for triangulation.
SURF::Generic_element_2 Generic_element
int get_lid(const Vertex *v) const
int get_lvid(const Element_node_enumerator &ene, const int v) const
void panes(std::vector< Pane * > &ps)
Get a vector of local panes contained in the window.
std::vector< char > _subnode_copies_g
void number_a_subnode(INode *i, int color, std::map< int, std::pair< int, int > > &cnts)
A window is a collection of panes.
Vertex_overlay * origin()
void get_inodes_of_face(const Facet *f, INode_const_list &nodes)
#define RFC_END_NAME_SPACE
int pane_id
the id of the owner pane.
void convert_nat_coordinates(const INode *i, Halfedge *h, int color, int pane_id, int &lid, RFC_Pane_overlay::Edge_ID &eid, Point_2 &nc) const
const Point_2S & nat_coor(const int color) const
void export_windows(RFC_Window_base *, RFC_Window_base *)
Export the subdivisions to the two given windows.
A window is a collection of panes.
std::vector< Node_ID > _subnode_ids_g
int edge_id
edge id within the face.
#define RFC_BEGIN_NAME_SPACE
Triangulating a convex polygon by ear-removal.
int get_subnode_id(const INode *i, int color, int pane_id) const
std::map< int, std::map< int, int > > _subnode_imap_b
int count_edges(const Halfedge *e) const
Halfedge * halfedge(const int color) const
HDS_accessor< Tag_true > acc
Halfedge_overlay * next()
bool subdivide(const INode_const_list &face, INode_const_list::const_iterator last_checked, Subface_list &sub_faces, int color, int depth=0) const
std::list< Subface > Subface_list
#define RFC_assertion_code
int get_index(const Vertex *v) const
Halfedge * get_next_around_origin(Halfedge *h) const
std::vector< char > _subnode_copies_b
Point_2 get_nat_coor(const INode &i, const Generic_element &e, const Halfedge *h, int color) const
void export_window(RFC_Window_base *) const
int get_subnode_copies(const INode *i, int color) const
void allocate_subfaces(const std::vector< int > &cnts)
Allocate memory space for the arrays for storing the subdivision.
std::list< INode * > inodes
void count_subnodes(INode *i, int color, std::map< int, std::pair< int, int > > &cnts)
SURF::Vector_2< Real > Point_2