This class implements a data structure for 2-manifold over a whole window, which can be composed of multiple panes. More...
#include <Manifold_2.h>
Public Types | |
typedef std::vector < Pane_manifold_2 >::iterator | PM_iterator |
typedef std::vector < Pane_manifold_2 > ::const_iterator | PM_const_iterator |
Public Member Functions | |
Window_manifold_2 () | |
Default constructor. More... | |
Window_manifold_2 (const COM::Attribute *pmesh) | |
Construct a Window_manifold_2 from a given window. More... | |
~Window_manifold_2 () | |
int | size_of_nodes (Access_Mode mode) const |
Obtain the number of nodes (shared nodes are counted only once. More... | |
int | size_of_faces (Access_Mode mode) const |
Obtain the number of faces. More... | |
int | size_of_triangles (Access_Mode mode) const |
Obtain the number of triangles. More... | |
int | size_of_quadrilaterals (Access_Mode mode) const |
Obtain the number of quadrilaterals. More... | |
int | size_of_edges (Access_Mode mode) const |
Obtain the number of edges. More... | |
int | pconn_nblocks () const |
Obtain the number of pconn blocks. More... | |
void | serialize_window (COM::Window *outwin) const |
Create a serial window (with single pane) from the current window. More... | |
Buffer window management | |
COM::Window * | window () |
Obtain the underlying window object. More... | |
const COM::Window * | window () const |
Pane management | |
Pane_manifold_2 * | get_pane_manifold (int pid) |
Obtain a Pane_manifold_2 from a pane ID. More... | |
const Pane_manifold_2 * | get_pane_manifold (int pid) const |
Obtain a const Pane_manifold_2 from a pane ID. More... | |
int | size_of_panes () const |
Obtain the number of panes. More... | |
PM_iterator | pm_begin () |
Obtain an iterator to the first pane manifold of the window. More... | |
PM_const_iterator | pm_begin () const |
PM_iterator | pm_end () |
Obtain an iterator to the past-the-last pane manifold of the window. More... | |
PM_const_iterator | pm_end () const |
Communication | |
void | init_communicator () |
Initialize a pane communicator. More... | |
void | reduce_on_shared_nodes (COM::Attribute *attr, MPI_Op op) |
Perform reduction over a given nodal attributes. More... | |
Utilities | |
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. More... | |
void | update_bd_normals (const COM::Attribute *normals, bool to_normalize=false) |
Update the normals for border faces. More... | |
void | update_bd_flags (const COM::Attribute *flags) |
Update the flags for border faces. More... | |
void | update_bdedge_bitmap (const COM::Attribute *bitmap) |
Update bitmap for border edges. More... | |
void | accumulate_bd_values (const COM::Attribute *vals) |
Accumulate the values for border faces. More... | |
void | compute_mcn (COM::Attribute *mcn_in, COM::Attribute *lbmcn_in) |
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. More... | |
void | shortest_edge_length (COM::Attribute *lens) |
Obtain shortest edge length of incident edges of each node or element. More... | |
void | perturb_mesh (double range) |
Perturb the given mesh along its normal direction by length equal to a random number between -range and range times shortest edge length. More... | |
Helper | |
void | init (const COM::Attribute *pmesh) |
Initialize the manifold by inheriting the given mesh. More... | |
void | determine_counterparts (const COM::Attribute *pconn_e) |
Determine the counterparts of pane-border edges for across-pane access. More... | |
void | determine_primaries (const COM::Attribute *pconn_n) |
Determine the primary nodes for across-pane access. More... | |
void | compute_shortest_edgelen_nodes (COM::Attribute *lens) |
Obtain shortest edge length of incident edges of each nodes. More... | |
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. More... | |
void | assign_global_nodeIDs (std::vector< std::vector< int > > &gids) const |
static void | compute_shortest_edgelen_elements (COM::Attribute *lens) |
Obtain shortest edge length of incident edges of each element. More... | |
Data members | |
static MPI_Op | OP_MAX =MPI_MAX |
static MPI_Op | OP_MIN =MPI_MIN |
static MPI_Op | OP_SUM =MPI_SUM |
static MPI_Op | OP_PROD =MPI_PROD |
static MPI_Op | OP_MAXABS =MPI_MAXLOC |
static MPI_Op | OP_DIFF =MPI_MINLOC |
static MPI_Op | OP_BOR =MPI_BOR |
static MPI_Op | OP_BAND =MPI_BAND |
static MPI_Op | OP_LOR =MPI_LOR |
static MPI_Op | OP_LAND =MPI_LAND |
COM::Window * | _buf_window |
std::vector< Pane_manifold_2 > | _pms |
std::map< int, int > | _pi_map |
MAP::Pane_communicator * | _cc |
int | _pconn_nb |
This class implements a data structure for 2-manifold over a whole window, which can be composed of multiple panes.
It supports different modes in accessing the nodes and halfedges of the window.
Definition at line 185 of file Manifold_2.h.
typedef std::vector< Pane_manifold_2>::const_iterator PM_const_iterator |
Definition at line 188 of file Manifold_2.h.
typedef std::vector< Pane_manifold_2>::iterator PM_iterator |
Definition at line 187 of file Manifold_2.h.
|
inline |
|
inlineexplicit |
Construct a Window_manifold_2 from a given window.
Definition at line 194 of file Manifold_2.h.
References init().
~Window_manifold_2 | ( | ) |
void accumulate_bd_values | ( | const COM::Attribute * | vals | ) |
Accumulate the values for border faces.
Definition at line 647 of file Manifold_2.C.
References _buf_window, COM_assertion, COM_assertion_msg, COM_CHAR, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_FLOAT, COM_get_sizeof(), COM_INT, COM_INTEGER, COM_REAL, copy, for(), i, iend, n, pm_begin(), and pm_end().
|
protected |
Definition at line 1318 of file Manifold_2.C.
References ACROSS_PANE, COM_assertion, Node::get_primary(), i, Node::id(), iend, Node::pane(), pm_begin(), pm_end(), size_of_nodes(), size_of_panes(), and v.
Referenced by serialize_window().
void compute_mcn | ( | COM::Attribute * | mcn_in, |
COM::Attribute * | lbmcn_in | ||
) |
Definition at line 80 of file compute_curvature.C.
References _buf_window, COM_assertion, COM_DOUBLE, compute_lbop_weights(), Rocblas::copy_scalar(), Rocblas::div(), i, j, k, MPI_SUM, Element_node_enumerator::next(), Vector_3< Type >::norm(), reduce_on_shared_nodes(), sign(), and Element_node_enumerator::size_of_edges().
Referenced by Rocsurf::compute_mcn().
|
protected |
Compute nodal normals using one of the following weighting schemes: E2N_ONE, E2N_AREA, and E2N_ANGLE, and E2N_USER.
Definition at line 764 of file Manifold_2.C.
References _buf_window, _cc, COM_assertion_msg, COM_DOUBLE, Rocsurf::compute_element_normals(), E2N_AREA, E2N_ONE, elements_to_nodes(), i, init_communicator(), j, and n.
Referenced by compute_normals(), and perturb_mesh().
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.
For nodal normals, use one of the following weighting schemes: E2N_ONE: Same weight for all incident faces. E2N_AREA: Area of incident faces. E2N_ANGLE: Angle of the incident faces at the node.
Definition at line 1045 of file Manifold_2.C.
References COM_assertion_msg, COM_compatible_types(), COM_DOUBLE, Rocsurf::compute_element_normals(), and compute_nodal_normals().
Referenced by Rocsurf::compute_normals().
|
staticprotected |
Obtain shortest edge length of incident edges of each element.
Definition at line 457 of file Manifold_2.C.
References i, j, k, min(), Element_node_enumerator::next(), Element_node_enumerator::size_of_edges(), and sqrt().
Referenced by shortest_edge_length().
|
protected |
Obtain shortest edge length of incident edges of each nodes.
Obtain shortest edge length of incident edges of each element.
Definition at line 415 of file Manifold_2.C.
References Rocblas::copy_scalar(), i, j, k, min(), Element_node_enumerator::next(), OP_MIN, reduce_on_shared_nodes(), Element_node_enumerator::size_of_edges(), Element_node_enumerator::size_of_nodes(), and Rocblas::sqrt().
Referenced by perturb_mesh(), and shortest_edge_length().
|
protected |
Determine the counterparts of pane-border edges for across-pane access.
Definition at line 241 of file Manifold_2.C.
References Pane_manifold_2::_bd_cnt, Pane_manifold_2::_cnt_pn, _pi_map, _pms, ACROSS_PANE, COM_assertion_msg, Simple_manifold_2::get_border_edgeID(), Simple_manifold_2::get_opposite_real_edge(), i, j, k, n, nj, nk, p1, and Simple_manifold_2::pane().
Referenced by init().
|
protected |
Determine the primary nodes for across-pane access.
Definition at line 320 of file Manifold_2.C.
References Pane_manifold_2::_nd_prm, _pi_map, _pms, ACROSS_PANE, COM_assertion_msg, Pane_manifold_2::get_bnode_index(), Node::halfedge(), i, Halfedge::is_border(), Node::is_isolated(), j, k, n, nj, nk, and p1.
Referenced by init().
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.
The weighting scheme can be user-defined (E2N_USER, given by ews), one for each element (E2N_ONE, default), area of the element (E2N_AREA), or angle at each node (E2N_ANGLE). If nws is present, then output weights into nws. If tosum is true, then compute weighted sum instead of weighted average.
Definition at line 816 of file Manifold_2.C.
References _buf_window, _cc, cimg_library::acos(), COM_assertion_msg, COM_compatible_types(), COM_DOUBLE, Vector_3< Type >::cross_product(), d, E2N_ANGLE, E2N_AREA, E2N_ONE, E2N_SPHERE, E2N_USER, i, init_communicator(), j, Generic_element_2::Jacobian(), k, MPI_SUM, n, Element_node_enumerator::next(), OP_SUM, reduce_on_shared_nodes(), s, Element_node_vectors_k_const< Value >::set(), Element_node_vectors_k< Value >::set(), Element_vectors_k_const< Value >::set(), sin, Element_node_enumerator::size_of_edges(), Element_node_enumerator::size_of_nodes(), sqrt(), Vector_3< Type >::squared_norm(), and v.
Referenced by compute_nodal_normals(), and Rocsurf::elements_to_nodes().
|
inline |
|
inline |
|
protected |
Initialize the manifold by inheriting the given mesh.
Called by constructors of Window_manifold_2.
Definition at line 171 of file Manifold_2.C.
References _buf_window, _pconn_nb, _pi_map, _pms, ACROSS_PANE, COM_assertion_msg, COM_INT, COM_MESH, COM_PCONN, COM_PMESH, determine_counterparts(), determine_primaries(), and i.
Referenced by Window_manifold_2().
void init_communicator | ( | ) |
Initialize a pane communicator.
Must be called before any operation involving interprocess communication.
Definition at line 389 of file Manifold_2.C.
References _buf_window, and _cc.
Referenced by compute_nodal_normals(), elements_to_nodes(), and Rocsurf::initialize().
|
inline |
Obtain the number of pconn blocks.
Definition at line 312 of file Manifold_2.h.
References _pconn_nb.
void perturb_mesh | ( | double | range | ) |
Perturb the given mesh along its normal direction by length equal to a random number between -range and range times shortest edge length.
Definition at line 1065 of file Manifold_2.C.
References _buf_window, Rocblas::add(), COM_DOUBLE, COM_NC, compute_nodal_normals(), compute_shortest_edgelen_nodes(), Rocblas::mul(), OP_MAXABS, Rocblas::rand_scalar(), reduce_on_shared_nodes(), and Rocblas::sub_scalar().
|
inline |
Obtain an iterator to the first pane manifold of the window.
Definition at line 223 of file Manifold_2.h.
References _pms.
Referenced by accumulate_bd_values(), assign_global_nodeIDs(), Rocsurf::compute_edge_lengths(), serialize_window(), size_of_edges(), size_of_faces(), size_of_nodes(), size_of_quadrilaterals(), size_of_triangles(), update_bd_flags(), update_bd_normals(), and update_bdedge_bitmap().
|
inline |
|
inline |
Obtain an iterator to the past-the-last pane manifold of the window.
Definition at line 227 of file Manifold_2.h.
References _pms.
Referenced by accumulate_bd_values(), assign_global_nodeIDs(), Rocsurf::compute_edge_lengths(), serialize_window(), size_of_edges(), size_of_faces(), size_of_nodes(), size_of_quadrilaterals(), size_of_triangles(), update_bd_flags(), update_bd_normals(), and update_bdedge_bitmap().
|
inline |
void reduce_on_shared_nodes | ( | COM::Attribute * | attr, |
MPI_Op | op | ||
) |
Perform reduction over a given nodal attributes.
Definition at line 1105 of file Manifold_2.C.
References _buf_window, _cc, COM_assertion, OP_DIFF, and OP_MAXABS.
Referenced by compute_mcn(), compute_shortest_edgelen_nodes(), elements_to_nodes(), and perturb_mesh().
void serialize_window | ( | COM::Window * | outwin | ) | const |
Create a serial window (with single pane) from the current window.
Definition at line 1353 of file Manifold_2.C.
References ACROSS_PANE, assign_global_nodeIDs(), COM_assertion, copy, i, iend, j, k, pm_begin(), pm_end(), REAL_PANE, size_of_faces(), and size_of_nodes().
Referenced by Rocsurf::serialize_mesh().
void shortest_edge_length | ( | COM::Attribute * | lens | ) |
Obtain shortest edge length of incident edges of each node or element.
Definition at line 398 of file Manifold_2.C.
References COM_assertion_msg, COM_compatible_types(), COM_DOUBLE, compute_shortest_edgelen_elements(), and compute_shortest_edgelen_nodes().
int size_of_edges | ( | Access_Mode | mode | ) | const |
Obtain the number of edges.
Definition at line 1179 of file Manifold_2.C.
References iend, n, pm_begin(), and pm_end().
int size_of_faces | ( | Access_Mode | mode | ) | const |
Obtain the number of faces.
Definition at line 1143 of file Manifold_2.C.
References iend, n, pm_begin(), and pm_end().
Referenced by serialize_window().
int size_of_nodes | ( | Access_Mode | mode | ) | const |
Obtain the number of nodes (shared nodes are counted only once.
Definition at line 1132 of file Manifold_2.C.
References iend, n, pm_begin(), and pm_end().
Referenced by assign_global_nodeIDs(), and serialize_window().
|
inline |
Obtain the number of panes.
Definition at line 220 of file Manifold_2.h.
References _pms.
Referenced by assign_global_nodeIDs().
int size_of_quadrilaterals | ( | Access_Mode | mode | ) | const |
Obtain the number of quadrilaterals.
Definition at line 1167 of file Manifold_2.C.
References iend, n, pm_begin(), and pm_end().
int size_of_triangles | ( | Access_Mode | mode | ) | const |
Obtain the number of triangles.
Definition at line 1155 of file Manifold_2.C.
References iend, n, pm_begin(), and pm_end().
void update_bd_flags | ( | const COM::Attribute * | flags | ) |
Update the flags for border faces.
Definition at line 541 of file Manifold_2.C.
References _buf_window, COM_assertion, COM_compatible_types(), COM_INT, i, iend, n, pm_begin(), and pm_end().
void update_bd_normals | ( | const COM::Attribute * | normals, |
bool | to_normalize = false |
||
) |
Update the normals for border faces.
Definition at line 485 of file Manifold_2.C.
References _buf_window, COM_assertion, COM_compatible_types(), COM_DOUBLE, COM_INT, i, iend, n, Vector_3< Type >::normalize(), pm_begin(), and pm_end().
void update_bdedge_bitmap | ( | const COM::Attribute * | bitmap | ) |
Update bitmap for border edges.
Definition at line 594 of file Manifold_2.C.
References _buf_window, COM_assertion, COM_CHAR, COM_compatible_types(), COM_INT, i, iend, n, pm_begin(), and pm_end().
|
inline |
Obtain the underlying window object.
Definition at line 203 of file Manifold_2.h.
Referenced by Rocsurf::compute_edge_lengths().
|
inline |
|
protected |
Definition at line 360 of file Manifold_2.h.
Referenced by accumulate_bd_values(), compute_mcn(), compute_nodal_normals(), elements_to_nodes(), init(), init_communicator(), perturb_mesh(), reduce_on_shared_nodes(), update_bd_flags(), update_bd_normals(), update_bdedge_bitmap(), window(), and ~Window_manifold_2().
|
protected |
Definition at line 364 of file Manifold_2.h.
Referenced by compute_nodal_normals(), elements_to_nodes(), init_communicator(), reduce_on_shared_nodes(), and ~Window_manifold_2().
|
protected |
Definition at line 365 of file Manifold_2.h.
Referenced by init(), and pconn_nblocks().
|
protected |
Definition at line 363 of file Manifold_2.h.
Referenced by determine_counterparts(), determine_primaries(), get_pane_manifold(), and init().
|
protected |
Definition at line 361 of file Manifold_2.h.
Referenced by determine_counterparts(), determine_primaries(), get_pane_manifold(), init(), pm_begin(), pm_end(), and size_of_panes().
|
static |
Definition at line 353 of file Manifold_2.h.
|
static |
Definition at line 353 of file Manifold_2.h.
|
static |
Definition at line 353 of file Manifold_2.h.
Referenced by reduce_on_shared_nodes().
|
static |
Definition at line 353 of file Manifold_2.h.
|
static |
Definition at line 353 of file Manifold_2.h.
|
static |
Definition at line 353 of file Manifold_2.h.
Referenced by Rocmop::get_redist_safe_factor(), and Rocmop::identify_ridge_edges().
|
static |
Definition at line 353 of file Manifold_2.h.
Referenced by perturb_mesh(), and reduce_on_shared_nodes().
|
static |
Definition at line 353 of file Manifold_2.h.
Referenced by compute_shortest_edgelen_nodes(), and Rocmop::identify_ridge_edges().
|
static |
Definition at line 353 of file Manifold_2.h.
|
static |
Definition at line 353 of file Manifold_2.h.
Referenced by elements_to_nodes(), Rocmop::redistribute_vertices_ridge(), and Rocmop::redistribute_vertices_smooth().