Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: Manifold_2.h,v 1.18 2008/12/06 08:43:23 mtcampbe Exp $
24 
25 //=======================================================================
26 // This file defines the data structures for accessing a surface mesh.
27 // The data structures mimic the halfedge data structure, but with the
28 // extension to support partitioned meshes. Typically, the user should
29 // use Node and Halfedge to access the entities of a surface mesh.
30 //
31 // Author: Xiangmin Jiao
32 // Last modified: Oct 11, 2004
33 //=======================================================================
34 
35 #ifndef __MANIFOLD_2_H_
36 #define __MANIFOLD_2_H_
37 
38 #include "surfbasic.h"
39 #include "../Rocmap/include/Simple_manifold_2.h"
40 
41 namespace MAP { class Pane_communicator; };
42 
44 
45 using MAP::Simple_manifold_2;
46 
47 class Window_manifold_2;
48 class Halfedge;
49 class Node;
50 typedef MAP::Facet_ID Edge_ID;
51 
53 
58  friend class Window_manifold_2;
59  friend class Node;
60  friend class Halfedge;
61 public:
64 
66  explicit Pane_manifold_2( const COM::Pane *p,
67  const Pane_manifold_2 *parent=NULL);
68 
71 
76  inline const Halfedge &get_counterpart( Edge_ID eID) const;
77 
79  inline const Vector_3<Real> &get_bd_normal( Edge_ID) const;
80 
82  inline int get_bd_flag( Edge_ID) const;
83 
85  inline bool get_bdedge_flag( Edge_ID) const;
86 
88  inline Halfedge get_opposite_edge( Edge_ID, Access_Mode mode) const;
89 
92 
95 
101  inline Node get_primary( int vID, Access_Mode mode) const;
102 
104  inline bool is_primary( int vID, Access_Mode mode) const;
105 
107  inline bool is_border_edge( Edge_ID eID, Access_Mode mode) const;
108 
110  inline bool is_physical_border_edge( Edge_ID eID) const
111  { return eID.is_border() && _cnt_pn[get_border_edgeID(eID)-1]==0; }
112 
115  int size_of_nodes( Access_Mode mode) const;
116 
119  int size_of_edges( Access_Mode mode) const;
120 
122  int size_of_faces( Access_Mode mode) const {
123  switch ( mode) {
124  case REAL_PANE:
125  case ACROSS_PANE: return size_of_real_faces();
126  default: return Simple_manifold_2::size_of_faces();
127  }
128  }
129 
131  int size_of_triangles( Access_Mode mode) const {
132  switch ( mode) {
133  case REAL_PANE:
134  case ACROSS_PANE: return size_of_real_triangles();
135  default: return Simple_manifold_2::size_of_triangles();
136  }
137  }
138 
141  switch ( mode) {
142  case REAL_PANE:
145  }
146  }
147 
148 protected:
151  void convert_pconn_edge2ghost( const COM::Attribute *pconn_e,
152  COM::Attribute *pconn_g);
153 
154 
157  int get_bnode_index( int vID) const {
158  Edge_ID eID = get_incident_real_edge( vID);
159 
160  if ( !eID.is_border()) return -1;
161 
162  int bid = eID.eid()-1;
163  if ( bid>=int(_beIDs.size())) return bid-_size_ghost_borders;
164  else return bid;
165  }
166 
167  /* The following data memters are for storing the counterpart of each
168  * edge on pane boundaries, for the across-pane access mode. */
169  std::vector<int> _cnt_pn;
170 
171  //< Stores pane-id of the counterparts of border edges.
172  //< If owner pane is remote, then save the negative ID. If there is no
173  //< counterpart (i.e., edge is on physical boundary), then save 0.
174 
175  std::vector<Halfedge> _bd_cnt; //< Counterpart edges in ACROSS_PANE mode
176  std::vector<Vector_3<Real> > _bd_nrms; //< Normal of opposite face
177  std::vector<int > _bd_flgs; //< Flag of opposite face
178  std::vector<char > _bd_bm; //< Bitmap of opposite edge
179  std::vector<Node> _nd_prm; //< Primary nodes in ACROSS_PANE mode.
180 };
181 
186 public:
187  typedef std::vector< Pane_manifold_2>::iterator PM_iterator;
188  typedef std::vector< Pane_manifold_2>::const_iterator PM_const_iterator;
189 
191  Window_manifold_2() : _buf_window(NULL), _cc(NULL), _pconn_nb(0) {}
192 
194  explicit Window_manifold_2(const COM::Attribute *pmesh)
195  : _buf_window(NULL), _cc(NULL), _pconn_nb(0) { init(pmesh); }
196 
198 
202  COM::Window *window() { return _buf_window; }
204  const COM::Window *window() const { return _buf_window; }
205 
206  //\}
207 
213  { return &_pms[ _pi_map[pid]]; }
214 
216  const Pane_manifold_2 *get_pane_manifold( int pid) const
217  { return &_pms[ _pi_map.find(pid)->second]; }
218 
220  int size_of_panes() const { return _pms.size(); }
221 
223  PM_iterator pm_begin() { return _pms.begin(); }
224  PM_const_iterator pm_begin() const { return _pms.begin(); }
225 
227  PM_iterator pm_end() { return _pms.end(); }
228  PM_const_iterator pm_end() const { return _pms.end(); }
229 
230  //\}
231 
235  void init_communicator();
238 
240  void reduce_on_shared_nodes( COM::Attribute *attr, MPI_Op op);
241 
242  //\}
243 
254  void compute_normals( COM::Attribute *normals,
255  int scheme = E2N_ANGLE,
256  bool to_normalize = true);
257 
259  void update_bd_normals( const COM::Attribute *normals,
260  bool to_normalize = false);
261 
263  void update_bd_flags( const COM::Attribute *flags);
264 
266  void update_bdedge_bitmap( const COM::Attribute *bitmap);
267 
269  void accumulate_bd_values( const COM::Attribute *vals);
270 
271  // Compute mean-curvature normals and their Laplace-Beltrami operator.
272  void compute_mcn( COM::Attribute *mcn_in, COM::Attribute *lbmcn_in);
273 
281  void elements_to_nodes( const COM::Attribute *evals,
282  COM::Attribute *nvals,
283  const int scheme = E2N_ONE,
284  const COM::Attribute *ews = NULL,
285  COM::Attribute *nws = NULL,
286  const int tosum=false);
287 
289  void shortest_edge_length( COM::Attribute *lens);
290 
293  void perturb_mesh( double range);
294  //\}
295 
297  int size_of_nodes( Access_Mode mode) const;
298 
300  int size_of_faces( Access_Mode mode) const;
301 
303  int size_of_triangles( Access_Mode mode) const;
304 
306  int size_of_quadrilaterals( Access_Mode mode) const;
307 
309  int size_of_edges( Access_Mode mode) const;
310 
312  int pconn_nblocks() const { return _pconn_nb; }
313 
315  void serialize_window( COM::Window *outwin) const;
316 
317 protected:
320  void init( const COM::Attribute *pmesh);
323 
325  void determine_counterparts( const COM::Attribute *pconn_e);
326 
328  void determine_primaries( const COM::Attribute *pconn_n);
329 
331  static void compute_shortest_edgelen_elements( COM::Attribute *lens);
332 
334  void compute_shortest_edgelen_nodes( COM::Attribute *lens);
335 
340  void compute_nodal_normals( COM::Attribute *nrm,
341  int scheme = E2N_ANGLE,
342  bool to_normalize = true,
343  const COM::Attribute *weights = NULL);
344 
345  // Assign nodal IDs. Called by serialize_window()
346  void assign_global_nodeIDs( std::vector<std::vector<int> > &gids) const;
347 
348  //\}
349 
352 public:
355 
356 protected:
357  // A buffer window created by the Manifold class by inheriting from
358  // a user window when the init() function is called. in general,
359  // one must inherit a user attribute onto this window.
360  COM::Window *_buf_window;
361  std::vector< Pane_manifold_2> _pms;
362  // Create a mapping from pane ids to the corresponding indices in _pms
363  std::map< int, int> _pi_map;
364  MAP::Pane_communicator *_cc; // Pane communicator.
365  int _pconn_nb; // Number of blocks of pconn
366  //\}
367 };
368 
370 class Node {
371 public:
373  Node() : _pm(NULL), _vID(0), _mode( ACROSS_PANE) {}
374 
376  Node( const Pane_manifold_2 *pm, int vid, Access_Mode mode)
377  : _pm( pm), _vID( vid), _mode( mode) {}
378 
381  inline Halfedge halfedge() const;
382 
384  const Pane_manifold_2 *pane_manifold() const { return _pm; }
385 
387  const COM::Pane *pane() const
388  { if ( _pm) return _pm->pane(); else return NULL; }
389 
391  int id() const { return _vID; }
392 
394  const Point_3<Real> &point() const
395  { return (const Point_3<Real>&)_pm->pane()->coordinates()[ 3*_vID-3]; }
396 
400  const void *addr( const COM::Attribute *attr) const;
401 
404  const COM::Attribute *attr( const COM::Attribute *a) const {
405  COM_assertion_msg( a, "Unexpected NULL pointer");
406  return a->window()->pane( _pm->pane()->id()).attribute(a->id());
407  }
408 
410  inline bool is_border() const;
411 
413  bool is_isolated() const { return _pm->is_isolated_node( _vID); }
414 
416  bool is_primary() const { return _pm->is_primary( _vID, _mode); }
417 
419  Node get_primary() const { return _pm->get_primary( _vID, _mode); }
420 
422  bool coincide( const Node &n) const
423  { return _pm->get_primary( _vID, _mode) == n._pm->get_primary( n._vID, n._mode); }
424 
426  bool operator==( const Node &n) const
427  { return _pm == n._pm && _vID == n._vID; }
428 
430  bool operator!=( const Node &n) const
431  { return _pm != n._pm || _vID != n._vID; }
432 
434  bool operator<( const Node &n) const {
435  return _pm->pane()->id() < n._pm->pane()->id() ||
436  _pm == n._pm && _vID < n._vID;
437  }
438 
439 protected:
440  const Pane_manifold_2 *_pm; // Reference to Pane_manifold_2
441  int _vID; // Node id
442  Access_Mode _mode; // Access mode
443 };
444 
446 class Halfedge {
447 public:
448  Halfedge() : _pm(NULL) {}
451  : _pm( pm), _eID( e), _mode(mode) {}
452 
455  { return _pm->get_opposite_edge( _eID, _mode); }
456 
460  Halfedge prev() const { return _pm->get_prev_edge( _eID, _mode); }
461 
465  Halfedge next() const { return _pm->get_next_edge( _eID, _mode); }
466 
468  Node origin() const
469  { return _pm->get_primary( _pm->get_origin( _eID), _mode); }
470 
473  { return _pm->get_primary( _pm->get_destination( _eID), _mode); }
474 
476  bool is_border() const
477  { return _pm->is_border_edge( _eID, _mode); }
478 
480  bool is_physical_border() const
481  { return _pm->is_physical_border_edge( _eID); }
482 
485  { return destination().point()-origin().point(); }
486 
488  Vector_3<Real> normal() const;
489 
492  Vector_3<Real> deformed_normal( const COM::Attribute *disp) const;
493 
495  void edge_center( Point_3<Real> &mid) const
496  { edge_average( _pm->pane()->attribute( COM::COM_NC),
497  reinterpret_cast<Vector_3<Real> &>(mid)); }
498 
501  void face_center( Point_3<Real> &cnt) const
502  { face_average( _pm->pane()->attribute( COM::COM_NC),
503  reinterpret_cast<Vector_3<Real> &>(cnt)); }
504 
507  template < class Value>
508  void edge_average( const COM::Attribute *attr, Value &val) const {
509  val = 0.5*(*reinterpret_cast<const Value *>(destination().addr(attr))+
510  *reinterpret_cast<const Value *>(origin().addr(attr)));
511  }
512 
516  template < class Value>
517  void face_average( const COM::Attribute *attr, Value &val) const {
518  // If this is a border halfedge, then return its edge center.
519  if ( is_border()) { edge_average( attr, val); return; }
520 
521  // Otherwise, compute the center
522  val = Value(0);
523 
524  int count=0;
525  Halfedge h=*this, h0=h;
526 
527  do {
528  val += *reinterpret_cast<const Value*>(h.origin().addr( attr));
529  ++count;
530  } while ( (h=h.next()) != h0);
531 
532  val/=count;
533  }
534 
537  double dihedral_angle() const;
538 
540  const Pane_manifold_2 *pane_manifold() const { return _pm; }
541 
543  const COM::Pane *pane() const
544  { if ( _pm) return _pm->pane(); else return NULL; }
545 
547  Edge_ID id() const { return _eID; }
548 
553  const void *addr( const COM::Attribute *attr) const;
554 
556  const COM::Attribute *attr( const COM::Attribute *a) const {
557  COM_assertion_msg( a, "Unexpected NULL pointer");
558  return a->window()->pane( _pm->pane()->id()).attribute(a->id());
559  }
560 
562  bool operator==( const Halfedge &h) const
563  { return _pm==h._pm && _eID==h._eID; }
564 
566  bool operator!=( const Halfedge &h) const
567  { return _pm!=h._pm || _eID!=h._eID; }
568 
570  bool operator<( const Halfedge &h) const {
571  int pid1=_pm->pane()->id(), pid2=h._pm->pane()->id();
572  return pid1<pid2 || pid1==pid2 && _eID<h._eID;
573  }
574 
575 protected:
576  const Pane_manifold_2 *_pm; // Reference to Pane_manifold_2
577  Edge_ID _eID; // Edge ID
578  Access_Mode _mode; // Access mode
579 };
580 
582 {
583  COM_assertion( eID.is_border());
584  return _bd_cnt[ eID.eid()-1];
585 }
586 
588  COM_assertion_msg( eID.is_border() && !_bd_nrms.empty(),
589  "get_bd_normal must be called on border edges and be called after update_bd_normals() has been called.");
590  return _bd_nrms[ eID.eid()-1];
591 }
592 
594  COM_assertion_msg( eID.is_border() && !_bd_flgs.empty(),
595  "get_bd_flag must be called on border edges and be called after update_bd_flags() has been called.");
596  return _bd_flgs[ eID.eid()-1];
597 }
598 
600  COM_assertion_msg( eID.is_border() && !_bd_bm.empty(),
601  "get_bdedge_flag must be called on border edges and be called after update_bdedge_bitmap() has been called.");
602  return _bd_bm[ eID.eid()-1];
603 }
604 
605 // Obtain the opposite edge in a given access mode
608  Edge_ID opp;
609  switch ( mode) {
610  case REAL_PANE:
611  opp = get_opposite_real_edge( eID); break;
612  case WHOLE_PANE:
613  opp = Simple_manifold_2::get_opposite_edge( eID); break;
614  case ACROSS_PANE: {
615  opp=get_opposite_real_edge( eID);
616 
617  if ( opp.is_border()) {
618  Halfedge h = get_counterpart(opp);
619  if ( h.pane_manifold()) return h;
620  }
621 
622  break;
623  }
624  default: COM_assertion_msg(false, "Should never reach here");
625  }
626  return Halfedge( this, opp, mode);
627 }
628 
630 {
631  if ( mode != ACROSS_PANE) return Node(this, vID, mode);
632 
633  int bid = get_bnode_index( vID);
634 
635  COM_assertion( bid<int(_nd_prm.size()));
636  if ( bid >=0 && _nd_prm[ bid].pane_manifold())
637  return _nd_prm[ bid];
638  else
639  return Node( this, vID, ACROSS_PANE);
640 }
641 
642 bool Pane_manifold_2::is_primary( int vID, Access_Mode mode) const
643 {
644  if ( mode != ACROSS_PANE) return true;
645 
646  int bid = get_bnode_index( vID);
647 
648  COM_assertion( bid<int(_nd_prm.size()));
649  return bid <0 || !_nd_prm[ bid].pane_manifold();
650 }
651 
652 // Is the edge on the boundary of a given mode?
654 {
655  switch ( mode) {
656  case REAL_PANE:
657  return is_real_border_edge( eID);
658  case WHOLE_PANE:
659  // For whole pane, an edge is border only if it is pure real border edge.
660  return is_pure_real_border_edge( eID);
661  case ACROSS_PANE:
662  return eID.is_border() && get_counterpart( eID).pane_manifold() == NULL;
663  default: COM_assertion_msg(false, "Should never reach here");
664  return false;
665  }
666 }
667 
668 bool Node::is_border() const { return halfedge().is_border(); }
669 
671 {
672  Edge_ID eID;
673 
674  switch ( _mode) {
675  case REAL_PANE:
676  eID = _pm->get_incident_real_edge( _vID); break;
677  case WHOLE_PANE:
678  eID = _pm->get_incident_edge( _vID); break;
679  default: {
681  // the current node (vertex) is in general the origin of the edge or
682  // the edge center, unless the node is isolated.
683 
684  if ( eID.is_border()) {
685  Halfedge h=_pm->get_counterpart( eID);
686  if ( h.pane_manifold()) return h;
687  }
688  }
689  }
690 
691  return Halfedge(_pm, eID, _mode);
692 }
693 
695 Vector_3<Real> get_normal( const Halfedge &h, const Vector_2<Real> &nc);
696 
700  const Vector_2<Real> &nc,
701  const COM::Attribute *disp);
702 
705 { return h.tangent(); }
706 
707 
709 
710 #endif
711 
712 
713 
714 
715 
716 
This class implements a data structure for 2-manifold over a whole window, which can be composed of m...
Definition: Manifold_2.h:185
int size_of_panes() const
Obtain the number of panes.
Definition: Manifold_2.h:220
Access_Mode _mode
Definition: Manifold_2.h:442
static MPI_Op OP_LAND
Definition: Manifold_2.h:353
static MPI_Op OP_MAXABS
Definition: Manifold_2.h:353
int pconn_nblocks() const
Obtain the number of pconn blocks.
Definition: Manifold_2.h:312
void update_bd_normals(const COM::Attribute *normals, bool to_normalize=false)
Update the normals for border faces.
Definition: Manifold_2.C:485
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)...
static MPI_Op OP_SUM
Definition: Manifold_2.h:353
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
Pane_manifold_2()
Default constructors.
Definition: Manifold_2.C:52
PM_iterator pm_begin()
Obtain an iterator to the first pane manifold of the window.
Definition: Manifold_2.h:223
int size_of_triangles() const
Total number of triangles of the pane.
int size_of_triangles(Access_Mode mode) const
Obtain the number of triangles.
Definition: Manifold_2.h:131
int size_of_edges() const
Number of edges of the pane.
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...
This class encapsulate a node over a window manifold.
Definition: Manifold_2.h:370
int size_of_faces(Access_Mode mode) const
Obtain the number of faces.
Definition: Manifold_2.C:1143
bool operator==(const Halfedge &h) const
Are two halfedges the same?
Definition: Manifold_2.h:562
bool get_bdedge_flag(Edge_ID) const
Obtain flag of opposite halfedge of a border halfedge.
Definition: Manifold_2.h:599
int size_of_triangles(Access_Mode mode) const
Obtain the number of triangles.
Definition: Manifold_2.C:1155
MAP::Pane_communicator * _cc
Definition: Manifold_2.h:364
COM::Window * _buf_window
Definition: Manifold_2.h:360
Vector_3< Real > deformed_normal(const COM::Attribute *disp) const
Get the normal of the deformed shape (coordinates plus given displacements) of the incident facet of ...
Definition: Manifold_2.C:1290
int size_of_quadrilaterals() const
Total number of quadrilaterals of the pane.
static MPI_Op OP_DIFF
Definition: Manifold_2.h:353
#define COM_assertion_msg(EX, msg)
std::vector< int > _cnt_pn
Definition: Manifold_2.h:169
void elements_to_nodes(const COM::Attribute *evals, COM::Attribute *nvals, const int scheme=E2N_ONE, const COM::Attribute *ews=NULL, COM::Attribute *nws=NULL, const int tosum=false)
Convert element values to nodal values using weighted averaging.
Definition: Manifold_2.C:816
#define SURF_END_NAMESPACE
Definition: surfbasic.h:29
const COM::Pane * pane() const
Obtain a const pointer to the pane.
MAP::Facet_ID Edge_ID
Definition: Manifold_2.h:49
Node()
Default constructor.
Definition: Manifold_2.h:373
int id() const
Obtain the node ID within its Pane_manifold_2.
Definition: Manifold_2.h:391
void convert_pconn_edge2ghost(const COM::Attribute *pconn_e, COM::Attribute *pconn_g)
Convert from edge-based pconn to a ghost-node-style pconn for a pane attribute.
Definition: Manifold_2.C:735
Window_manifold_2()
Default constructor.
Definition: Manifold_2.h:191
int size_of_faces() const
Number of elements of the pane.
Halfedge get_prev_edge(Edge_ID, Access_Mode mode) const
Obtain the previous edge in a given access mode.
Definition: Manifold_2.C:71
Halfedge opposite() const
Get the ID of the opposite edge of a given edge.
Definition: Manifold_2.h:454
Halfedge get_next_edge(Edge_ID, Access_Mode mode) const
Obtain the next edge in a given access mode.
Definition: Manifold_2.C:98
const Halfedge & get_counterpart(Edge_ID eID) const
Get the counterpart of an edge in the ACROSS_PANE mode, i.e.
Definition: Manifold_2.h:581
bool operator==(const Node &n) const
Are two nodes the same?
Definition: Manifold_2.h:426
bool is_physical_border() const
Is the edge on the physical boundary?
Definition: Manifold_2.h:480
Vector_3< Real > get_tangent(const Halfedge &h)
Get the tangent of the given halfedge.
Definition: Manifold_2.h:704
Halfedge prev() const
Get the previous halfedge of its owner element.
Definition: Manifold_2.h:460
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
Edge_ID id() const
Obtain the ID of the edge.
Definition: Manifold_2.h:547
Access_Mode
Definition: Manifold_2.h:52
std::vector< Pane_manifold_2 >::const_iterator PM_const_iterator
Definition: Manifold_2.h:188
int size_of_real_quadrilaterals() const
Number of real quadrilaterals of the pane.
int size_of_edges(Access_Mode mode) const
Obtain the number of edges.
Definition: Manifold_2.C:1179
void init(const COM::Attribute *pmesh)
Initialize the manifold by inheriting the given mesh.
Definition: Manifold_2.C:171
int get_destination(Edge_ID eID, Element_node_enumerator *ene_in=NULL) const
Get the ID of the destination of a given edge.
bool is_primary(int vID, Access_Mode mode) const
Determines whether a given node is a primary copy.
Definition: Manifold_2.h:642
Halfedge next() const
Get the next halfedge of its owner element.
Definition: Manifold_2.h:465
const void * addr(const COM::Attribute *attr) const
Obtain the address of an attribute associated with its bounded element.
Definition: Manifold_2.C:1215
Edge_ID get_incident_real_edge(int vID) const
Get the ID of an incident real edge within the pane of a given node.
int _vID
Definition: Manifold_2.h:441
int get_border_edgeID(Edge_ID eID) const
Get the border edge index. Return -1 if not a border edge.
Node(const Pane_manifold_2 *pm, int vid, Access_Mode mode)
Construct a Node object from a pane manifold and its node ID.
Definition: Manifold_2.h:376
int eid() const
Element ID of the halfedge.
Edge_ID get_opposite_edge(const Edge_ID &eID) const
Get the ID of the opposite edge of a given interior or border edge.
static MPI_Op OP_BAND
Definition: Manifold_2.h:353
bool is_border() const
Is the node on the physical boundary?
Definition: Manifold_2.h:668
const COM::Attribute * attr(const COM::Attribute *a) const
Obtain the attribute on the parent pane of the node.
Definition: Manifold_2.h:404
std::map< int, int > _pi_map
Definition: Manifold_2.h:363
Node get_primary() const
Get the primary copy of the node.
Definition: Manifold_2.h:419
~Pane_manifold_2()
Destructor.
Definition: Manifold_2.C:67
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 _eID
Definition: Manifold_2.h:577
int size_of_quadrilaterals(Access_Mode mode) const
Obtain the number of quadrilaterals.
Definition: Manifold_2.h:140
std::vector< Pane_manifold_2 >::iterator PM_iterator
Definition: Manifold_2.h:187
Vector_3< Real > get_normal(const Halfedge &h, const Vector_2< Real > &nc)
Get the face normal of a point in the element incident on h.
Definition: Manifold_2.C:1240
static const int scheme
#define SURF_BEGIN_NAMESPACE
Definition: surfbasic.h:28
Vector_3< Real > tangent() const
Get the tangent of the given halfedge.
Definition: Manifold_2.h:484
Vector_3< Real > normal() const
Get the normal of the incident facet.
Definition: Manifold_2.C:1259
bool is_isolated() const
Is the node isolated?
Definition: Manifold_2.h:413
bool operator<(const Halfedge &h) const
Does the current halfedge has a smaller ID then the given one?
Definition: Manifold_2.h:570
void reduce_on_shared_nodes(COM::Attribute *attr, MPI_Op op)
Perform reduction over a given nodal attributes.
Definition: Manifold_2.C:1105
Halfedge(const Pane_manifold_2 *pm, Edge_ID e, Access_Mode mode)
Construct a Halfedge object from a pane manifold and its edge ID.
Definition: Manifold_2.h:450
static void compute_shortest_edgelen_elements(COM::Attribute *lens)
Obtain shortest edge length of incident edges of each element.
Definition: Manifold_2.C:457
const Pane_manifold_2 * _pm
Definition: Manifold_2.h:440
void edge_average(const COM::Attribute *attr, Value &val) const
Get the avarage value of the nodes of a given halfedge.
Definition: Manifold_2.h:508
int size_of_quadrilaterals(Access_Mode mode) const
Obtain the number of quadrilaterals.
Definition: Manifold_2.C:1167
void determine_primaries(const COM::Attribute *pconn_n)
Determine the primary nodes for across-pane access.
Definition: Manifold_2.C:320
void assign_global_nodeIDs(std::vector< std::vector< int > > &gids) const
Definition: Manifold_2.C:1318
void update_bdedge_bitmap(const COM::Attribute *bitmap)
Update bitmap for border edges.
Definition: Manifold_2.C:594
PM_const_iterator pm_begin() const
Definition: Manifold_2.h:224
static MPI_Op OP_MIN
Definition: Manifold_2.h:353
void accumulate_bd_values(const COM::Attribute *vals)
Accumulate the values for border faces.
Definition: Manifold_2.C:647
void face_center(Point_3< Real > &cnt) const
Get the face center of the incident face of a given halfedge.
Definition: Manifold_2.h:501
Vector_3< Real > get_deformed_normal(const Halfedge &h, const Vector_2< Real > &nc, const COM::Attribute *disp)
Get the normal of the deformed shape (coordinates plus given displacements) of the incident facet of ...
Definition: Manifold_2.C:1263
Node destination() const
Obtain the (primary copy of the) destination of the edge.
Definition: Manifold_2.h:472
void update_bd_flags(const COM::Attribute *flags)
Update the flags for border faces.
Definition: Manifold_2.C:541
void shortest_edge_length(COM::Attribute *lens)
Obtain shortest edge length of incident edges of each node or element.
Definition: Manifold_2.C:398
int size_of_real_triangles() const
Number of real triangles of the pane.
Window_manifold_2(const COM::Attribute *pmesh)
Construct a Window_manifold_2 from a given window.
Definition: Manifold_2.h:194
Provides a data structure accessing nodes, elements, and edges in a pane, in a manner similar to the ...
const NT & n
const COM::Attribute * attr(const COM::Attribute *a) const
Obtain the attribute on the parent pane of the node.
Definition: Manifold_2.h:556
bool operator<(const Node &n) const
Does the current node has a smaller ID then the given node?
Definition: Manifold_2.h:434
Encapsulates information about distribution of panes on all processes and handles across pane communi...
bool operator!=(const Node &n) const
Are two nodes different?
Definition: Manifold_2.h:430
std::vector< Node > _nd_prm
Definition: Manifold_2.h:179
static MPI_Op OP_BOR
Definition: Manifold_2.h:353
bool operator!=(const Halfedge &h) const
Are two halfedges different?
Definition: Manifold_2.h:566
const void * addr(const COM::Attribute *attr) const
Obtain the address of an attribute associated with the node.
Definition: Manifold_2.C:1191
void determine_counterparts(const COM::Attribute *pconn_e)
Determine the counterparts of pane-border edges for across-pane access.
Definition: Manifold_2.C:241
bool is_border() const
Is the edge a border edge?
Definition: Manifold_2.h:476
COM::Window * window()
Obtain the underlying window object.
Definition: Manifold_2.h:203
const Pane_manifold_2 * get_pane_manifold(int pid) const
Obtain a const Pane_manifold_2 from a pane ID.
Definition: Manifold_2.h:216
int size_of_nodes() const
Number of nodes of the pane.
void compute_mcn(COM::Attribute *mcn_in, COM::Attribute *lbmcn_in)
friend class Halfedge
Definition: Manifold_2.h:60
bool is_physical_border_edge(Edge_ID eID) const
Is the given edge a physical border edge?
Definition: Manifold_2.h:110
void compute_normals(COM::Attribute *normals, int scheme=E2N_ANGLE, bool to_normalize=true)
Compute the normals at nodes or faces, depending on the type of the attribute normals.
Definition: Manifold_2.C:1045
Halfedge get_opposite_edge(Edge_ID, Access_Mode mode) const
Obtain the opposite edge in a given access mode.
Definition: Manifold_2.h:607
bool is_border_edge(Edge_ID eID, Access_Mode mode) const
Is the edge on the boundary of a given mode?
Definition: Manifold_2.h:653
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE USE ModDataTypes USE nvals
std::vector< int > _bd_flgs
Definition: Manifold_2.h:177
void init_communicator()
Initialize a pane communicator.
Definition: Manifold_2.C:389
void serialize_window(COM::Window *outwin) const
Create a serial window (with single pane) from the current window.
Definition: Manifold_2.C:1353
std::vector< Halfedge > _bd_cnt
Definition: Manifold_2.h:175
int size_of_real_faces() const
Number of real elements of the pane.
const Point_3< Real > & point() const
Obtain the coordinates of a node.
Definition: Manifold_2.h:394
Access_Mode _mode
Definition: Manifold_2.h:578
const Pane_manifold_2 * pane_manifold() const
Obtain the pane manifold that owns the edge.
Definition: Manifold_2.h:540
Node get_primary(int vID, Access_Mode mode) const
Obtains a Node object corresponding to the primary copy of the given node.
Definition: Manifold_2.h:629
void face_average(const COM::Attribute *attr, Value &val) const
Get the average value of the nodes of the incident face of a given halfedge.
Definition: Manifold_2.h:517
The ID of a facet (edge in 2D and face in 3D) encodes an element ID and the local facet&#39;s ID internal...
const COM::Pane * pane() const
Obtain the owner Pane_manifold_2 of the node.
Definition: Manifold_2.h:387
double dihedral_angle() const
Return the dihedral angle at the edge.
Definition: Manifold_2.C:1297
friend class Node
Definition: Manifold_2.h:59
std::vector< Edge_ID > _beIDs
void edge_center(Point_3< Real > &mid) const
Get the edge center of the given halfedge.
Definition: Manifold_2.h:495
This class implements a data structure for 2-manifold on each pane.
Definition: Manifold_2.h:57
static MPI_Op OP_MAX
Definition: Manifold_2.h:353
PM_iterator pm_end()
Obtain an iterator to the past-the-last pane manifold of the window.
Definition: Manifold_2.h:227
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468
const Vector_3< Real > & get_bd_normal(Edge_ID) const
Obtain normal of incident face of border edge.
Definition: Manifold_2.h:587
const Pane_manifold_2 * _pm
Definition: Manifold_2.h:576
static MPI_Op OP_PROD
Definition: Manifold_2.h:353
void compute_nodal_normals(COM::Attribute *nrm, int scheme=E2N_ANGLE, bool to_normalize=true, const COM::Attribute *weights=NULL)
Compute nodal normals using one of the following weighting schemes: E2N_ONE, E2N_AREA, and E2N_ANGLE, and E2N_USER.
Definition: Manifold_2.C:764
const COM::Window * window() const
Definition: Manifold_2.h:204
PM_const_iterator pm_end() const
Definition: Manifold_2.h:228
void compute_shortest_edgelen_nodes(COM::Attribute *lens)
Obtain shortest edge length of incident edges of each nodes.
Definition: Manifold_2.C:415
int get_origin(Edge_ID eID, Element_node_enumerator *ene_in=NULL) const
Get the ID of the origin of a given edge.
std::vector< Pane_manifold_2 > _pms
Definition: Manifold_2.h:361
std::vector< Vector_3< Real > > _bd_nrms
Definition: Manifold_2.h:176
bool is_border() const
Determines whether the facet is on border.
static MPI_Op OP_LOR
Definition: Manifold_2.h:353
int size_of_nodes(Access_Mode mode) const
Obtain the number of nodes (shared nodes are counted only once.
Definition: Manifold_2.C:1132
int get_bnode_index(int vID) const
Obtain the border node index (equal to ID of incident border edge).
Definition: Manifold_2.h:157
bool coincide(const Node &n) const
Check whether the current node coincide with the given node.
Definition: Manifold_2.h:422
int get_bd_flag(Edge_ID) const
Obtain flag of incident face of border edge.
Definition: Manifold_2.h:593
const Pane_manifold_2 * pane_manifold() const
Obtain the pane manifold that owns the edge.
Definition: Manifold_2.h:384
Halfedge halfedge() const
Get an incident halfedge originated from the node.
Definition: Manifold_2.h:670
bool is_isolated_node(int vID) const
Is the node isolated (i.e. not incident on any element)?
Pane_manifold_2 * get_pane_manifold(int pid)
Obtain a Pane_manifold_2 from a pane ID.
Definition: Manifold_2.h:212
int size_of_faces(Access_Mode mode) const
Obtain the number of faces.
Definition: Manifold_2.h:122
bool is_primary() const
Is the node a primary?
Definition: Manifold_2.h:416
void perturb_mesh(double range)
Perturb the given mesh along its normal direction by length equal to a random number between -range a...
Definition: Manifold_2.C:1065
const COM::Pane * pane() const
Obtain the owner Pane_manifold_2 of the node.
Definition: Manifold_2.h:543
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...
std::vector< char > _bd_bm
Definition: Manifold_2.h:178