Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Simple_manifold_2.h
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 // $Id: Simple_manifold_2.h,v 1.9 2008/12/06 08:43:20 mtcampbe Exp $
24 
25 //=======================================================================
26 // This file defines a data structures for accessing a pane of a surface
27 // mesh. It mimics the halfedge data structure.
28 //
29 // Author: Xiangmin Jiao
30 // Last modified: July 18, 2003
31 //=======================================================================
32 
33 #ifndef __SIMPLE_MANIFOLD_2_H_
34 #define __SIMPLE_MANIFOLD_2_H_
35 
36 #include "mapbasic.h"
37 #include "roccom_devel.h"
38 #include <cassert>
39 
41 
49 class Facet_ID {
50 public:
51  enum { nDigits=4, BndID=15 };
52 
53  Facet_ID( ) : _code(0) {}
54  Facet_ID( int eid, char lid) : _code( (eid<<nDigits)+(BndID&lid)) {}
55 
57  int eid() const { return _code>>nDigits; }
59  char lid() const { return _code&BndID; }
60 
62  bool is_border() const { return lid()==BndID; }
63 
65  bool operator==( const Facet_ID e) const
66  { return _code==e._code; }
67  bool operator!=( const Facet_ID e) const
68  { return _code!=e._code; }
69  bool operator<( const Facet_ID e) const
70  { return lid()<e.lid() || lid()==e.lid() && _code<e._code; }
71 private:
72  int _code;
73 };
74 
81 public:
82  typedef Facet_ID Edge_ID;
83 
86  : _pane(NULL), _is_str(0), _with_ghost(0), _nspe(0),
89 
91  explicit Simple_manifold_2( const COM::Pane *p,
92  const Simple_manifold_2 *parent=NULL,
93  bool with_ghost=true)
94  { init(p, parent, with_ghost); }
95 
97  const COM::Pane *pane() const { return _pane; }
98 
102  int size_of_nodes() const { return _pane->size_of_nodes(); }
104 
106  int maxsize_of_nodes() const { return _pane->maxsize_of_nodes(); }
107 
109  int size_of_real_nodes() const { return _pane->size_of_real_nodes(); }
110 
113 
115  int size_of_ghost_nodes() const { return _pane->size_of_ghost_nodes(); }
116 
118  int maxsize_of_ghost_nodes() const { return _pane->maxsize_of_ghost_nodes();}
119  //\}
120 
123  int size_of_elements() const { return _pane->size_of_elements(); }
125 
127  int maxsize_of_elements() const { return _pane->maxsize_of_elements(); }
128 
130  int size_of_real_elements() const { return _pane->size_of_real_elements(); }
131 
134 
136  int size_of_ghost_elements() const { return _pane->size_of_ghost_elements(); }
137 
139  int maxsize_of_ghost_elements() const { return _pane->maxsize_of_ghost_elements(); }
140 
142  int size_of_faces() const { return _pane->size_of_elements(); }
143 
145  int maxsize_of_faces() const { return _pane->maxsize_of_elements(); }
146 
148  int size_of_real_faces() const { return _pane->size_of_real_elements(); }
149 
151  int maxsize_of_real_faces() const { return _pane->maxsize_of_real_elements(); }
152 
154  int size_of_ghost_faces() const { return _pane->size_of_ghost_elements(); }
155 
157  int maxsize_of_ghost_faces() const { return _pane->maxsize_of_ghost_elements(); }
158 
160  int size_of_triangles() const;
161 
163  int maxsize_of_triangles() const;
164 
166  int size_of_real_triangles() const;
167 
169  int maxsize_of_real_triangles() const;
170 
172  int size_of_ghost_triangles() const;
173 
175  int maxsize_of_ghost_triangles() const;
176 
178  int size_of_quadrilaterals() const;
179 
181  int maxsize_of_quadrilaterals() const;
182 
184  int size_of_real_quadrilaterals() const;
185 
187  int maxsize_of_real_quadrilaterals() const;
188 
190  int size_of_ghost_quadrilaterals() const;
191 
194  //\}
195 
198  int size_of_halfedges() const;
200 
202  int size_of_real_halfedges() const;
203 
205  int size_of_ghost_halfedges() const;
206 
208  int size_of_edges() const;
209 
211  int size_of_real_edges() const;
212 
214  int size_of_ghost_edges() const;
215  //\}
216 
219  int size_of_border_edges() const
222 
226 
230 
233  { return _isovIDs.size(); }
234  //\}
235 
239  Edge_ID get_opposite_real_edge( const Edge_ID &eID) const {
242  COM_assertion( eID.is_border() || is_real_element( eID.eid()));
243 
244  if ( eID.is_border())
245  return get_opposite_real_edge_border(eID);
246  else
248  }
249 
253  COM_assertion( eID.is_border() || is_ghost_element( eID.eid()));
254 
255  if ( eID.is_border())
256  return get_opposite_ghost_edge_border(eID);
257  else
259  }
260 
263  Edge_ID get_opposite_edge( const Edge_ID &eID) const {
264 
265  if ( eID.is_border())
266  return get_opposite_edge_border(eID);
267  else
268  return get_opposite_edge_interior(eID);
269  }
270  //\}
271 
275  Edge_ID get_prev_edge( const Edge_ID &eID) const {
277  if ( !eID.is_border())
278  return get_prev_edge_interior( eID);
279  else {
280  Edge_ID oeID = get_opposite_edge( eID);
281  while ( !oeID.is_border())
283  return oeID;
284  }
285  }
286 
288  Edge_ID get_prev_real_edge( const Edge_ID &eID) const {
289  if ( !eID.is_border())
290  return get_prev_real_edge_interior( eID);
291  else {
292  Edge_ID oeID = get_opposite_real_edge( eID);
293  while ( !oeID.is_border())
295  ( get_next_real_edge_interior( oeID));
296  return oeID;
297  }
298  }
299 
301  Edge_ID get_prev_ghost_edge( const Edge_ID &eID) const {
302  if ( !eID.is_border())
303  return get_prev_ghost_edge_interior(eID);
304  else {
305  Edge_ID oeID = get_opposite_ghost_edge( eID);
306  while ( !oeID.is_border())
309  return oeID;
310  }
311  }
312 
314  Edge_ID get_next_edge( const Edge_ID &eID) const {
315  if ( !eID.is_border())
316  return get_next_edge_interior( eID);
317  else {
318  Edge_ID oeID = get_opposite_edge_border( eID);
319  while ( !oeID.is_border())
321  return oeID;
322  }
323  }
324 
326  Edge_ID get_next_real_edge( const Edge_ID &eID) const {
327  if ( !eID.is_border())
328  return get_next_real_edge_interior( eID);
329  else {
330  Edge_ID oeID = get_opposite_real_edge( eID);
331  while ( !oeID.is_border())
333  ( get_prev_real_edge_interior( oeID));
334  return oeID;
335  }
336  }
337 
339  Edge_ID get_next_ghost_edge( const Edge_ID &eID) const {
340  if ( !eID.is_border())
341  return get_next_ghost_edge_interior( eID);
342  else {
343  Edge_ID oeID = get_opposite_ghost_edge( eID);
344  while ( !oeID.is_border())
347  return oeID;
348  }
349  }
350  //\}
351 
355  int get_origin( Edge_ID eID, Element_node_enumerator *ene_in=NULL) const {
358  if ( eID.is_border()) {
359  Edge_ID opp;
360  if (is_real_border_edge( eID)) opp = get_opposite_real_edge_border( eID);
361  else opp = get_opposite_ghost_edge_border( eID);
362 
363  Element_node_enumerator ene( _pane, opp.eid());
364  return ene[opp.lid()+1==ene.size_of_edges()?0:opp.lid()+1];
365  }
366  else {
367  if ( ene_in)
368  return (*ene_in)[eID.lid()];
369  else
370  return Element_node_enumerator( _pane, eID.eid())[eID.lid()];
371  }
372  }
373 
375  int get_destination( Edge_ID eID, Element_node_enumerator *ene_in=NULL) const {
376  if ( eID.is_border()) {
377  Edge_ID opp;
378  if (is_real_border_edge( eID)) opp = get_opposite_real_edge_border( eID);
379  else opp = get_opposite_ghost_edge_border( eID);
380 
381  Element_node_enumerator ene( _pane, opp.eid());
382  return ene[opp.lid()];
383  }
384  else {
385  if ( ene_in)
386  return (*ene_in)[eID.lid()+1==ene_in->size_of_edges()?0:eID.lid()+1];
387  else {
388  Element_node_enumerator ene( _pane, eID.eid());
389  return ene[eID.lid()+1==ene.size_of_edges()?0:eID.lid()+1];
390  }
391  }
392  }
393 
400  Edge_ID get_incident_edge( int vID) const {
401  Edge_ID eID;
402  if ( _is_str || !is_ghost_node( vID))
403  eID = _ieIDs_real_or_str[ vID-1];
404  else
405  eID = _ieIDs_ghost[ vID-_maxsize_real_nodes-1];
406 
407  // If the edge is between real and ghost, then return the real edge.
408  if ( eID.is_border() && eID.eid()>_size_real_borders &&
410  eID = _oeIDs_real_or_str[ get_edge_index(_beIDs[eID.eid()-1])];
411  COM_assertion( get_origin( eID)==vID);
412  }
413  return eID;
414  }
415 
418  Edge_ID get_incident_real_edge( int vID) const {
419  COM_assertion( is_real_node( vID));
420  Edge_ID eID = _ieIDs_real_or_str[ vID-1];
421 
422  if ( eID.is_border() && eID.eid()<=int(_beIDs.size()) &&
424  // If vID is between real and ghost, and on the ghost boundary,
425  // get the border edge between real and ghost.
426  Edge_ID eID0 = eID = get_opposite_ghost_edge_border( eID);
427  while ( (eID = get_opposite_ghost_edge_interior
428  ( get_next_ghost_edge_interior(eID))) != eID0 &&
429  !is_real_border_edge( eID));
430  COM_assertion_msg( eID.is_border() && get_origin( eID)==vID,
431  "No real edge incident on given vertex");
432  }
433 
434  return eID;
435  }
436 
440  bool isghost = is_ghost_node( vID);
441  Edge_ID eID;
442  if ( _is_str || !isghost)
443  eID = _ieIDs_real_or_str[ vID-1];
444  else
445  eID = _ieIDs_ghost[ vID-_maxsize_real_nodes-1];
446  if ( isghost) return eID;
447 
448  if ( eID.is_border() && eID.eid()<=_size_real_borders) {
449  // If vID is between real and ghost, and on the real boundary,
450  // get the border edge between real and ghost.
451  eID = get_opposite_real_edge_border( eID);
452  Edge_ID eID0 = eID;
453  while ( (eID = get_opposite_real_edge_interior
454  ( get_next_real_edge_interior(eID))) != eID0 &&
455  !is_ghost_border_edge( eID));
457  "No ghost edge incident on given vertex");
458  }
459 
460  return eID;
461  }
462  //\}
463 
467  bool is_border_edge( const Edge_ID &eID) const {
469  if ( !eID.is_border()) return false;
470  if ( eID.eid()>int(_beIDs.size())) return false;
471 
472  return !_with_ghost || eID.eid() <= _size_real_borders ||
474  }
475 
478  bool is_pure_real_border_edge( const Edge_ID & eID) const {
479  if ( !eID.is_border()) return false;
480 
481  return !_with_ghost || eID.eid() <= _size_real_borders;
482  }
483 
486  bool is_real_border_edge( const Edge_ID & eID) const {
487  if ( !eID.is_border()) return false;
488 
490  }
491 
494  bool is_ghost_border_edge( const Edge_ID & eID) const {
495  if ( !eID.is_border()) return false;
496  if ( eID.eid()>int(_beIDs.size())) return false;
497 
498  return _with_ghost && eID.eid() > _size_real_borders;
499  }
500 
502  bool is_isolated_node( int vID) const {
503  // Ghost nodes are not allowed to be isolated.
504  if ( _is_str || vID>_maxsize_real_nodes) return false;
505 
506  Edge_ID eID = _ieIDs_real_or_str[ vID-1];
507  return eID.is_border() && eID.eid()>int(_beIDs.size());
508  }
509 
511  bool is_real_border_node( int vID) const {
512  if ( !is_real_node( vID)) return false;
513  Edge_ID eID;
514  if ( _is_str || !is_ghost_node( vID))
515  eID = _ieIDs_real_or_str[ vID-1];
516  else
517  eID = _ieIDs_ghost[ vID-_maxsize_real_nodes-1];
518 
519  return eID.is_border() && eID.eid() <= int(_beIDs.size());
520  }
521 
524  bool is_ghost_border_node( int vID) const {
525  Edge_ID eID;
526  if ( _is_str || !is_ghost_node( vID))
527  eID = _ieIDs_real_or_str[ vID-1];
528  else
529  eID = _ieIDs_ghost[ vID-_maxsize_real_nodes-1];
530 
531  return eID.is_border() && eID.eid() <= int(_beIDs.size());
532  }
533 
535  bool is_border_node( int vID) const {
536  Edge_ID eID;
537  if ( _is_str || !is_ghost_node( vID))
538  eID = _ieIDs_real_or_str[ vID-1];
539  else
540  eID = _ieIDs_ghost[ vID-_maxsize_real_nodes-1];
541 
542  return is_border_edge( eID);
543  }
544 
546  int get_border_edgeID( Edge_ID eID) const {
547  if ( !eID.is_border()) { assert(false); return -1; }
548  else return eID.eid();
549  }
550 
554  return Edge_ID( 1, Edge_ID::BndID);
555  else
556  return Edge_ID();
557  }
558 
564  else
565  return Edge_ID();
566  }
567 
570  if ( _size_real_borders>0)
571  return Edge_ID( 1, Edge_ID::BndID);
572  else if ( _size_ghost_borders>0)
574  else
575  return Edge_ID();
576  }
577 
579  int get_a_real_border_node() const {
581  return get_origin(_beIDs[0]);
582  else
583  return -1;
584  }
585 
591  else
592  return -1;
593  }
594 
596  int get_a_border_node() const {
597  if ( _size_real_borders>0)
598  return get_origin(_beIDs[0]);
599  else if ( _size_ghost_borders>0)
601  else
602  return -1;
603  }
604  //\}
605 
607  bool is_real_node( int vID) const {
608  if ( !_is_str) // Unstructured mesh
609  return vID <= _maxsize_real_nodes;
610  else // Structured mesh
611  return _isghostnode.empty() || !_isghostnode[ vID-1];
612  }
613 
615  bool is_ghost_node( int vID) const {
616  if ( !_is_str) // Unstructured mesh
617  return vID > _maxsize_real_nodes;
618  else // Structured mesh
619  return !_isghostnode.empty() && _isghostnode[ vID-1];
620  }
621 
623  bool is_real_element( int eid ) const {
624  if ( !_is_str) // Unstructured mesh
625  return eid <= _maxsize_real_elmts;
626  else // Structured mesh
627  return _isghostelmt.empty() || !_isghostelmt[ eid-1];
628  }
629 
631  bool is_ghost_element( int eid ) const {
632  if ( !_is_str) // Unstructured mesh
633  return eid > _maxsize_real_elmts;
634  else // Structured
635  return !_isghostelmt.empty() && _isghostelmt[ eid-1];
636  }
637 
639  int get_edge_index( const Edge_ID &eid, const int offset=0) const
640  { return (eid.eid()-offset-1)*_nspe+eid.lid(); }
641 
644  { return size_of_elements()*_nspe; }
645 
649  void get_borders( std::vector< bool> &is_border,
650  std::vector< bool> &is_isolated,
651  std::vector< Edge_ID > *b,
652  int *ng=NULL) const;
653 
654 protected:
658  void init (const COM::Pane *p, const Simple_manifold_2 *parent=NULL,
659  bool with_ghost=true);
660 
663  void determine_ghosts();
664 
669 
676 
677 private:
681  inline Edge_ID get_opposite_edge_interior( const Edge_ID &eID) const {
683  COM_assertion( !eID.is_border());
684 
685  if ( _is_str || !is_ghost_element( eID.eid())) {
686  return _oeIDs_real_or_str[ get_edge_index( eID)];
687  }
688  else {
689  Edge_ID opp;
691 
692  if ( !opp.is_border() || opp.eid()>_size_rg_borders+_size_real_borders)
693  return opp;
694  else {
695  Edge_ID opp2 = _beIDs[ opp.eid()-1];
696  COM_assertion( opp2 != eID);
697  return opp2;
698  }
699  }
700  }
701 
703  inline Edge_ID get_opposite_real_edge_interior( const Edge_ID &eID) const {
704  COM_assertion( !eID.is_border() && is_real_element( eID.eid()));
705 
707 
708  // If points to a ghost element, then we need to follow the link
709  if ( !opp.is_border() && is_ghost_element( opp.eid()))
711 
712  return opp;
713  }
714 
717  COM_assertion( !eID.is_border() && is_ghost_element( eID.eid()));
718 
719  if ( _is_str)
720  return _oeIDs_real_or_str[ get_edge_index(eID)];
721  else
723  }
724 
726  inline Edge_ID get_opposite_edge_border( const Edge_ID &eID) const {
727  // Precondition: eID is a border edge of the whole pane
728  COM_assertion( eID.is_border() && eID.eid()<=int(_beIDs.size()) &&
729  (eID.eid()<=_size_real_borders ||
731 
732  return _beIDs[ eID.eid()-1];
733  }
734 
736  inline Edge_ID get_opposite_real_edge_border( const Edge_ID &eID) const {
737  // Precondition: eID is a border edge
738  COM_assertion( eID.is_border() &&
740 
741  Edge_ID opp = _beIDs[ eID.eid()-1];
742 
743  // Postcondition: opp is incident on a real element.
744  COM_assertion( is_real_element( opp.eid()));
745  return opp;
746  }
747 
749  inline Edge_ID get_opposite_ghost_edge_border( const Edge_ID &eID) const {
750  // Precondition: eID is a border edge
751  COM_assertion( eID.is_border() && eID.eid()>_size_real_borders &&
752  eID.eid()<=int(_beIDs.size()));
753 
754  Edge_ID opp = _beIDs[ eID.eid()-1];
755 
756  if ( is_real_element( opp.eid())) {
757  opp = _oeIDs_real_or_str[ get_edge_index(opp)];
758  COM_assertion( opp != eID);
759  }
760  return opp;
761  }
762  //\}
763 
768  // If not a border edge, then track it within an element.
769  int i=(eID.lid()?eID.lid()-1:_nspe-1);
770 
771  if ( _is_str || !is_ghost_element( eID.eid())) {
772  int eindex = get_edge_index( Edge_ID(eID.eid(), i));
773  while ( _oeIDs_real_or_str[eindex--]==Edge_ID()) { --i; assert(i); }
774  }
775  else {
776  int eindex = get_edge_index( Edge_ID(eID.eid(), i), _maxsize_real_elmts);
777  while ( _oeIDs_ghost[eindex--]==Edge_ID()) { --i; assert(i); }
778  }
779  return Edge_ID( eID.eid(), i);
780  }
781 
784 
785  // If not a border edge, then track it within an element.
786  int i=(eID.lid()?eID.lid()-1:_nspe-1);
787 
788  int eindex = get_edge_index( Edge_ID(eID.eid(), i));
789  while ( _oeIDs_real_or_str[eindex--]==Edge_ID()) { --i; assert(i); }
790 
791  return Edge_ID( eID.eid(), i);
792  }
793 
796 
797  // If not a border edge, then track it within an element.
798  int i=(eID.lid()?eID.lid()-1:_nspe-1);
799 
800  if ( _is_str) {
801  int eindex = get_edge_index( Edge_ID(eID.eid(), i));
802  while ( _oeIDs_real_or_str[eindex--]==Edge_ID()) { --i; assert(i); }
803  }
804  else {
805  int eindex = get_edge_index( Edge_ID(eID.eid(), i), _maxsize_real_elmts);
806  while ( _oeIDs_ghost[eindex--]==Edge_ID()) { --i; assert(i); }
807  }
808  return Edge_ID( eID.eid(), i);
809  }
810 
812  // If not a border edge, then track it within an element.
813  int i=eID.lid()+1;
814  if ( i>=_nspe) return Edge_ID( eID.eid(), 0);
815 
816  if ( _is_str || !is_ghost_element( eID.eid())) {
817  int eindex = get_edge_index( Edge_ID(eID.eid(), i));
818  if ( _oeIDs_real_or_str[eindex]==Edge_ID()) i=0;
819  }
820  else {
821  int eindex = get_edge_index( Edge_ID(eID.eid(), i), _maxsize_real_elmts);
822  if ( _oeIDs_ghost[eindex]==Edge_ID()) i=0;
823  }
824  return Edge_ID( eID.eid(), i);
825  }
826 
829 
830  // If not a border edge, then track it within an element.
831  int i=eID.lid()+1;
832  if ( i>=_nspe) return Edge_ID( eID.eid(), 0);
833 
834  int eindex = get_edge_index( Edge_ID(eID.eid(), i));
835  if ( _oeIDs_real_or_str[eindex]==Edge_ID()) i=0;
836 
837  return Edge_ID( eID.eid(), i);
838  }
839 
842 
843  // If not a border edge, then track it within an element.
844  int i=eID.lid()+1;
845  if ( i>=_nspe) return Edge_ID( eID.eid(), 0);
846 
847  if ( _is_str) {
848  int eindex = get_edge_index( Edge_ID(eID.eid(), i));
849  if ( _oeIDs_real_or_str[eindex]==Edge_ID()) i=0;
850  }
851  else {
852  int eindex = get_edge_index( Edge_ID(eID.eid(), i), _maxsize_real_elmts);
853  if ( _oeIDs_ghost[eindex]==Edge_ID()) i=0;
854  }
855  return Edge_ID( eID.eid(), i);
856  }
857 
858  //\}
859 protected:
860  const COM::Pane *_pane; // The associated pane object
861 
862  bool _is_str; // Whether the pane is structured.
863  bool _with_ghost; // Whether has ghost nodes/elements.
864 
865  // Element connectivity tables for unstructured meshes.
866  std::vector<const COM::Connectivity*> _elem_conns;
867  int _nspe; // Max number of sides per element
868 
869  int _maxsize_real_nodes; // maxnumber of real nodes.
870  int _maxsize_real_elmts; // maxnumber of real elements.
871 
872  int _size_real_borders; // #real border edges
873  int _size_ghost_borders; // #ghost border edges
874  int _size_rg_borders; // #edges between real and ghost
875 
876  std::vector<bool> _isghostnode; // Is ghost node
877  std::vector<bool> _isghostelmt; // Is ghost element
878 
879  // Opposite halfedge ID of each edge in real elements or in structured meshes
880  std::vector<Edge_ID> _oeIDs_real_or_str;
881  // Opposite halfedge ID of each edge in ghost elements of unstructured meshes
882  std::vector<Edge_ID> _oeIDs_ghost;
883 
884  // Incident edge ID of each real node of unstructured mesh,
885  // or each node of structured meshes.
886  std::vector<Edge_ID> _ieIDs_real_or_str;
887  // Incident edge ID of each ghost node of unstructured mesh
888  std::vector<Edge_ID> _ieIDs_ghost;
889 
890  // Mapping from border edges to their opposites.
891  // It has three parts: pure-real, between real and ghost, and pure ghost.
892  // If an edge is between real and ghost, then it has three IDs
893  // (one in real element, one in ghost element, and one with border ID),
894  // and they point to each other as follows:
895  // 1. beID of the border instance points to the real instance
896  // 2. oeID of the real instance points to the ghost instance
897  // 3. oeID of the ghost instance points to the border instance.
898  std::vector<Edge_ID> _beIDs;
899 
900  // Isolated node IDs
901  std::vector<int> _isovIDs;
902 };
903 
905 
906 #endif
907 
908 
909 
910 
911 
912 
std::vector< Edge_ID > _oeIDs_real_or_str
int size_of_ghost_faces() const
Number of ghost elements of the pane.
Edge_ID get_a_real_border_edge() const
Obtain a border edge on real part of the pane.
#define MAP_END_NAMESPACE
Definition: mapbasic.h:29
int maxsize_of_nodes() const
Maximum number of nodes allowed in the pane.
Edge_ID get_incident_ghost_edge(int vID) const
Get the ID of an incident real edge within the pane of a given node The incident edge may encode an i...
int maxsize_of_real_triangles() const
Maximum number of real triangles allowed in the pane.
void get_borders(std::vector< bool > &is_border, std::vector< bool > &is_isolated, std::vector< Edge_ID > *b, int *ng=NULL) const
Obtain all the border nodes, isolated nodes, and border edges.
bool is_pure_real_border_edge(const Edge_ID &eID) const
Determine whether a given edge is a border edge of real part of the whole pane (on physical border)...
bool is_ghost_border_edge(const Edge_ID &eID) const
Determine whether a given edge is a border edge of ghost part of the pane (either on physical border ...
std::vector< const COM::Connectivity * > _elem_conns
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
Edge_ID get_prev_edge_interior(const Edge_ID &eID) const
int size_of_real_elements() const
Number of real elements of the pane.
int size_of_halfedges() const
Number of halfedges of the pane.
int size_of_triangles() const
Total number of triangles of the pane.
An adaptor for enumerating node IDs of an element.
int size_of_edges() const
Number of edges of the pane.
bool operator==(const Facet_ID e) const
Comparison operators.
bool is_real_border_edge(const Edge_ID &eID) const
Determine whether a given edge is a border edge of real part of the pane (either on physical border o...
bool is_real_node(int vID) const
Is the given node a real node?
Edge_ID get_opposite_edge_border(const Edge_ID &eID) const
Get the opposite edge of a border edge for the whole pane.
int size_of_ghost_edges() const
Number of ghost edges of the pane.
int maxsize_of_elements() const
Maximum number of elements allowed in the pane.
int maxsize_of_quadrilaterals() const
Maximum number of quadrilaterals allowed in the pane.
Facet_ID(int eid, char lid)
int size_of_quadrilaterals() const
Total number of quadrilaterals of the pane.
int size_of_ghost_elements() const
Number of ghost elements of the pane.
Simple_manifold_2()
Default constructors.
#define COM_assertion_msg(EX, msg)
int size_of_ghost_triangles() const
Number of ghost triangles of the pane.
Edge_ID get_next_edge_interior(const Edge_ID &eID) const
const COM::Pane * pane() const
Obtain a const pointer to the pane.
MAP::Facet_ID Edge_ID
Definition: Manifold_2.h:49
char lid() const
Local edge ID of the halfedge within its element.
bool is_real_border_node(int vID) const
Is the node on the pane boundary of real part (not isolated)?
Simple_manifold_2(const COM::Pane *p, const Simple_manifold_2 *parent=NULL, bool with_ghost=true)
Constructors.
std::vector< Edge_ID > _ieIDs_ghost
int size_of_faces() const
Number of elements of the pane.
int get_a_ghost_border_node() const
Obtain the ID of a border node of the ghost part of the pane.
int size_of_real_nodes() const
Number of real nodes of the pane.
bool is_border_edge(const Edge_ID &eID) const
Is a given edge on the boundary of the whole pane?
int size_of_real_halfedges() const
Number of real halfedges of the pane.
int size_of_real_quadrilaterals() const
Number of real quadrilaterals of the pane.
int size_of_border_edges() const
Number of border edges of the whole pane.
int get_destination(Edge_ID eID, Element_node_enumerator *ene_in=NULL) const
Get the ID of the destination of a given edge.
Edge_ID get_incident_real_edge(int vID) const
Get the ID of an incident real edge within the pane of a given node.
real *8 function offset(vNorm, x2, y2, z2)
Definition: PlaneNorm.f90:211
std::vector< Edge_ID > _ieIDs_real_or_str
int get_border_edgeID(Edge_ID eID) const
Get the border edge index. Return -1 if not a border edge.
int eid() const
Element ID of the halfedge.
int maxsize_of_ghost_quadrilaterals() const
Maximum number of ghost quadrilaterals allowed in the pane.
Edge_ID get_opposite_edge(const Edge_ID &eID) const
Get the ID of the opposite edge of a given interior or border edge.
int maxsize_of_triangles() const
Maximum number of triangles allowed in the pane.
int get_a_border_node() const
Obtain the ID of a border node.
int maxsize_of_faces() const
Maximum number of elements allowed in the pane.
std::vector< bool > _isghostelmt
int size_of_elements() const
Number of elements of the pane.
int maxsize_of_real_nodes() const
Maximum number of real nodes allowed in the pane.
Edge_ID get_opposite_real_edge(const Edge_ID &eID) const
Get the ID of the opposite real edge of a given real or border edge.
Edge_ID get_opposite_ghost_edge_interior(const Edge_ID &eID) const
Get the opposite edge of an interior edge of the ghost part.
Edge_ID get_next_real_edge_interior(const Edge_ID &eID) const
int maxsize_of_real_elements() const
Maximum number of real elements allowed in the pane.
void init(const COM::Pane *p, const Simple_manifold_2 *parent=NULL, bool with_ghost=true)
Initialize the database for the pane, including ghost information, opposite halfedges, incident halfedges, and border halfedges.
Edge_ID get_next_ghost_edge(const Edge_ID &eID) const
Get the ID of the next ghost edge of the element or along the boundary.
int get_edge_index(const Edge_ID &eid, const int offset=0) const
Get an index for internal edges.
std::vector< Edge_ID > _oeIDs_ghost
int maxsize_of_ghost_nodes() const
Maximum number of ghost nodes allowed in the pane.
int get_a_real_border_node() const
Obtain the ID of a border node of the real part of the pane.
Edge_ID get_opposite_edge_interior(const Edge_ID &eID) const
Get the opposite edge of an interior edge of the whole pane.
Edge_ID get_opposite_ghost_edge(const Edge_ID &eID) const
Get the ID of the opposite ghost edge of a given real or border edge.
Edge_ID get_next_ghost_edge_interior(const Edge_ID &eID) const
Edge_ID get_prev_ghost_edge(const Edge_ID &eID) const
Get the ID of the previous ghost edge of the element or along the boundary.
int maxsize_of_real_faces() const
Maximum number of real elements allowed in the pane.
int upperbound_edge_index() const
Get size of internal edges.
blockLoc i
Definition: read.cpp:79
bool is_ghost_element(int eid) const
Is the element incident on the give edge a ghost element?
bool is_ghost_node(int vID) const
Is the given node a ghost node?
bool is_real_element(int eid) const
Is the element incident on the give edge a real element?
int size_of_real_triangles() const
Number of real triangles of the pane.
Provides a data structure accessing nodes, elements, and edges in a pane, in a manner similar to the ...
int maxsize_of_ghost_triangles() const
Maximum number of ghost triangles allowed in the pane.
std::vector< int > _isovIDs
Edge_ID get_next_real_edge(const Edge_ID &eID) const
Get the ID of the next real edge of the element or along the boundary.
bool operator!=(const Facet_ID e) const
int size_of_ghost_nodes() const
Number of ghost nodes of the pane.
Edge_ID get_prev_edge(const Edge_ID &eID) const
Get the ID of the previous edge of the element or along the boundary.
int maxsize_of_real_quadrilaterals() const
Maximum number of real quadrilaterals allowed in the pane.
const COM::Pane * _pane
Edge_ID get_opposite_ghost_edge_border(const Edge_ID &eID) const
Get the opposite edge of a border edge for the ghost pane.
int size_of_nodes() const
Number of nodes of the pane.
Edge_ID get_a_ghost_border_edge() const
Obtain a border edge on ghost part of the pane.
Edge_ID get_a_border_edge() const
Obtain the ID of a border edge of the whole pane.
int size_of_real_faces() const
Number of real elements of the pane.
int size_of_real_edges() const
Number of real edges of the pane.
The ID of a facet (edge in 2D and face in 3D) encodes an element ID and the local facet&#39;s ID internal...
std::vector< bool > _isghostnode
int size_of_real_border_edges() const
Number of border edges of the real part of the pane.
#define MAP_BEGIN_NAMESPACE
Definition: mapbasic.h:28
bool is_ghost_border_node(int vID) const
Is the node on pane boundary (not isolated)? It assumes vID is incident on the ghost (no checking is ...
int size_of_ghost_border_edges() const
Number of border edges of the ghost part of the pane.
std::vector< Edge_ID > _beIDs
Edge_ID get_prev_real_edge(const Edge_ID &eID) const
Get the ID of the previous real edge of the element or along the boundary.
Edge_ID get_opposite_real_edge_border(const Edge_ID &eID) const
Get the opposite edge of a border edge for the real pane.
Edge_ID get_prev_ghost_edge_interior(const Edge_ID &eID) const
int size_of_ghost_quadrilaterals() const
Number of ghost quadrilaterals of the pane.
void determine_incident_halfedges()
Determine an incident halfedge for each node.
int size_of_ghost_halfedges() const
Number of ghost halfedges of the pane.
int get_origin(Edge_ID eID, Element_node_enumerator *ene_in=NULL) const
Get the ID of the origin of a given edge.
bool is_border_node(int vID) const
Is the node on pane boundary (not isolated)?
Edge_ID get_opposite_real_edge_interior(const Edge_ID &eID) const
Get the opposite edge of an interior edge of the real part.
bool operator<(const Facet_ID e) const
Edge_ID get_prev_real_edge_interior(const Edge_ID &eID) const
void determine_ghosts()
Determine the ghost nodes and elements.
bool is_border() const
Determines whether the facet is on border.
int maxsize_of_ghost_faces() const
Maximum number of ghost elements allowed in the pane.
void determine_opposite_halfedges()
Determine the opposite halfedges of each halfedge, and identify border halfedge.
Edge_ID get_next_edge(const Edge_ID &eID) const
Get the ID of the next edge of the element or along the boundary.
int size_of_isolated_nodes() const
Number of isolated nodes.
bool is_isolated_node(int vID) const
Is the node isolated (i.e. not incident on any element)?
Edge_ID get_incident_edge(int vID) const
Get the ID of an incident edge within the pane of a given node that originated from the node...
int maxsize_of_ghost_elements() const
Maximum number of ghost elements allowed in the pane.