Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rocmop Class Reference

A Roccom mesh optimization module. More...

#include <Rocmop.h>

Inheritance diagram for Rocmop:
Collaboration diagram for Rocmop:

Public Types

enum  { SMOOTH_VOL_MESQ_WG = 0, SMOOTH_VOL_MESQ_NG, SMOOTH_SURF_MEDIAL, SMOOTH_NONE }
 Valid Smoothing Methods. More...
 
enum  { SMOOTH_VOL_MESQ_WG = 0, SMOOTH_VOL_MESQ_NG, SMOOTH_SURF_MEDIAL, SMOOTH_NONE }
 Valid Smoothing Methods. More...
 
enum  { SMOOTH_VOL_MESQ_WG = 0, SMOOTH_VOL_MESQ_NG, SMOOTH_SURF_MEDIAL, SMOOTH_NONE }
 Valid Smoothing Methods. More...
 
enum  { WRAPPER_SHAPE = 0, WRAPPER_BOEING, WRAPPER_MAX }
 Valid Wrapper Choices. More...
 

Public Member Functions

void read_config_file (const std::string &)
 
void add_aspect_ratios (COM::Attribute *usr_att, COM::Attribute *buf_att=NULL)
 
void read_config_file (const std::string &)
 
void add_aspect_ratios (COM::Attribute *usr_att, COM::Attribute *buf_att=NULL)
 
Contructors and Destructors
 Rocmop ()
 Default Constructor. More...
 
virtual ~Rocmop ()
 Destructor. More...
 
 Rocmop ()
 Default Constructor. More...
 
virtual ~Rocmop ()
 Destructor. More...
 
 Rocmop ()
 Default Constructor. More...
 
virtual ~Rocmop ()
 Destructor. More...
 

Static Public Member Functions

Load and Unload
static void load (const std::string &mname)
 Loads Rocmop onto Roccom with a given module name. More...
 
static void unload (const std::string &mname)
 Unloads Rocmop from Roccom. More...
 
static void load (const std::string &mname)
 Loads Rocmop onto Roccom with a given module name. More...
 
static void unload (const std::string &mname)
 Unloads Rocmop from Roccom. More...
 
static void load (const std::string &mname)
 Loads Rocmop onto Roccom with a given module name. More...
 
static void unload (const std::string &mname)
 Unloads Rocmop from Roccom. More...
 

Protected Types

enum  { MOP_COOKIE =762667 }
 
enum  { MOP_COOKIE =762667 }
 
enum  { MOP_COOKIE =762667 }
 

Protected Member Functions

void perturb_stationary ()
 Randomly perturn stationary nodes on pane boundary, not on phys. surface. More...
 
bool check_displacements (COM::Attribute *disp)
 
void zero_displacements (COM::Attribute *disp)
 
void perturb_stationary ()
 Randomly perturn stationary nodes on pane boundary, not on phys. surface. More...
 
bool check_displacements (COM::Attribute *disp)
 
void zero_displacements (COM::Attribute *disp)
 
Smoothing Methods
void smooth_vol_mesq_wg (double pre_quality)
 Smooth a volume via Mesquite using ghost information. More...
 
void smooth_vol_mesq_ng (double pre_quality)
 Smooths a volume using Mesquite with only shared node information. More...
 
void smooth_surf_medial ()
 Smooths a surface using the medial quadric. More...
 
void smooth_mesquite (std::vector< COM::Pane * > &allpanes, int ghost_level=0)
 Smooth the panes of the working window using MESQUITE. More...
 
void smooth_vol_mesq_wg ()
 Smooth a volume via Mesquite using ghost information. More...
 
void smooth_vol_mesq_ng ()
 Smooths a volume using Mesquite with only shared node information. More...
 
void smooth_surf_medial ()
 Smooths a surface using the medial quadric. More...
 
void smooth_mesquite (std::vector< COM::Pane * > &allpanes, int ghost_level=0)
 Smooth the panes of the buffer window using MESQUITE. More...
 
void smooth_vol_mesq_wg ()
 Smooth a volume via Mesquite using ghost information. More...
 
void smooth_vol_mesq_ng ()
 Smooths a volume using Mesquite with only shared node information. More...
 
void smooth_surf_medial ()
 Smooths a surface using the medial quadric. More...
 
void smooth_boeing (COM::Attribute *att, int *niter)
 
void smooth_mesquite (std::vector< COM::Pane * > &allpanes, int ghost_level=0)
 Smooth the panes of the buffer window using MESQUITE. More...
 
Quality Checking
double check_marked_elem_quality (std::vector< std::vector< bool > > &marked_elems, std::vector< COM::Pane * > &allpanes)
 Get the largest dihedral angle of marked real elements. More...
 
double check_all_elem_quality (std::vector< const COM::Pane * > &allpanes, bool with_ghost=false)
 Get the largest dihedral angle of all real elements. More...
 
double check_all_elem_quality (std::vector< COM::Pane * > &allpanes, bool with_ghosts=false)
 Get the largest dihedral angle of all real elements marked. More...
 
void print_quality (std::string &s)
 Print the quality range of all elements, for debugging. More...
 
void print_mquality (std::string &s, std::vector< std::vector< bool > > &to_check)
 Print the quality range of marked elements, for debugging. More...
 
double check_marked_elem_quality (std::vector< std::vector< bool > > &marked_elems, std::vector< COM::Pane * > &allpanes)
 Get the largest dihedral angle of marked real elements. More...
 
double check_all_elem_quality (std::vector< const COM::Pane * > &allpanes, bool with_ghost=false)
 Get the largest dihedral angle of all real elements. More...
 
double check_all_elem_quality (std::vector< COM::Pane * > &allpanes, bool with_ghosts=false)
 Get the largest dihedral angle of all real elements marked. More...
 
void print_legible (int verb, const char *msg)
 Single process print message if given verbosity level is exceeded. More...
 
void constrain_displacements (COM::Attribute *w_disp)
 Contrain displacements to _maxdisp. More...
 
void print_extremal_dihedrals (COM::Window *window)
 Print the min and max dihedral angles along with their locations. More...
 
void print_quality (std::string &s, const std::string &s2)
 Print the quality range of all elements, for debugging. More...
 
void print_mquality (std::string &s, std::vector< std::vector< bool > > &to_check)
 Print the quality range of marked elements, for debugging. More...
 
double check_marked_elem_quality (std::vector< std::vector< bool > > &marked_elems, std::vector< COM::Pane * > &allpanes)
 Get the largest dihedral angle of marked real elements. More...
 
double check_all_elem_quality (std::vector< const COM::Pane * > &allpanes, bool with_ghost=false)
 Get the largest dihedral angle of all real elements. More...
 
double check_all_elem_quality (std::vector< COM::Pane * > &allpanes, bool with_ghosts=false)
 Get the largest dihedral angle of all real elements marked. More...
 
void print_legible (int verb, const char *msg)
 Single process print message if given verbosity level is exceeded. More...
 
void constrain_displacements (COM::Attribute *w_disp)
 Contrain displacements to _maxdisp. More...
 
void obtain_extremal_dihedrals (const COM::Attribute *att, double *min, double *max)
 Obtain the min and max dihedral angles. More...
 
void print_extremal_dihedrals (COM::Window *window)
 Print the min and max dihedral angles along with their locations. More...
 
void print_quality (std::string &s, const std::string &s2)
 Print the quality range of all elements, for debugging. More...
 
void print_mquality (std::string &s, std::vector< std::vector< bool > > &to_check)
 Print the quality range of marked elements, for debugging. More...
 

Protected Attributes

bool _reorthog
 Reorthogonalize? More...
 
char _wght_scheme
 Weighting scheme. More...
 
double _eig_thres
 Eigenvalue thresholds. More...
 
double _dir_thres
 Another threshold. More...
 
double _saliency_crn
 
int _rediter
 No.iterations for vertex redistribution. More...
 
const COM::Attribute * _cnstr_types
 Stores types of nodal constraints. More...
 
COM::Attribute * _cnstr_dirs
 Stores directions of nodal contraints. More...
 
std::vector< std::set< Edge_ID > > _edges
 ridge edges More...
 
std::vector< std::vector< bool > > _is_shared_node
 Is the node shared? More...
 
std::vector< std::vector< bool > > _is_shared_elem
 Does the element contain shared nodes? More...
 
std::vector< std::vector< bool > > _is_phys_bnd_node
 Is the node on the physical boundary? More...
 
std::vector< std::vector< bool > > _is_phys_bnd_elem
 Does the element contain nodes on the phys. boundary? More...
 
std::vector< std::vector< bool > > _is_pane_bnd_node
 Is the node on the pane boundary? More...
 
std::vector< std::vector< bool > > _is_pane_bnd_elem
 Does the element contain nodes on the pane boundary? More...
 
const COM::Window * _usr_window
 The user's window. More...
 
COM::Window * _wrk_window
 The working window. More...
 
bool _is_pmesh
 pmesh or mesh ? More...
 
int _method
 Choice of smoothing method. More...
 
int _verb
 Verbose level. More...
 
int _lazy
 Check quality before smoothing? More...
 
float _tol
 Smoother iterating tolerance. More...
 
int _niter
 Maximum number of iterations for smoothing. More...
 
float _ctol
 Subcycling tolerance. More...
 
int _ncycle
 Max number of subcycles for convergence. More...
 
int _monotone
 Impose non-decreasing quality? More...
 
int _cookie
 For Roccom. More...
 
int _invert
 If true (default false), then invert the mesh. More...
 
COM::Window * _buf_window
 The buffer window. More...
 
std::vector
< MAP::Pane_dual_connectivity * > 
_dcs
 
float _maxdisp
 Maximum displacement allowed. More...
 
int _smoothfreq
 
int N
 Smooth every _smoothfreq'th call. More...
 
double disp_tally
 originally a static in smooth() More...
 
float _disp_thresh
 originally a static in check_displacements More...
 
int _wrapper
 Choice of Mesquite Smoothing Wrappers. More...
 
int _invert_tets
 If true (default false), then invert tets. More...
 
int _invert_hexes
 If true (default false), then invert hexes. More...
 

Smoothing control flow

void smooth (const COM::Attribute *pmesh, COM::Attribute *disp)
 Smooth the mesh in a Rocmop managed buffer. More...
 
void smooth_in_place (COM::Attribute *pmesh)
 Smooth a mesh in place.. More...
 
void smooth (const COM::Attribute *pmesh, COM::Attribute *disp)
 Smooth the mesh in a Rocmop managed buffer. More...
 
void smooth_in_place (COM::Attribute *pmesh)
 Smooth a mesh in place.. More...
 
void smooth (const COM::Attribute *pmesh, COM::Attribute *disp, double *timestep=NULL)
 Smooth the mesh in a Rocmop managed buffer. More...
 
void smoother_specific_init ()
 Perform smoother specific initialization. More...
 
void perform_smoothing (double pre_quality)
 Perform smoothing on _wrk_window. More...
 
void perform_iterative_smoothing (double pre_quality)
 Perform iterative smoothing. More...
 
void perform_noniterative_smoothing ()
 Perform noniterative smoothing. More...
 
void smoother_specific_init ()
 Perform smoother specific initialization. More...
 
void perform_smoothing ()
 Perform smoothing on _buf_window. More...
 
void perform_iterative_smoothing ()
 Perform iterative smoothing. More...
 
void perform_noniterative_smoothing ()
 Perform noniterative smoothing. More...
 
void smoother_specific_init ()
 Perform smoother specific initialization. More...
 
void perform_smoothing ()
 Perform smoothing on _buf_window. More...
 
void perform_iterative_smoothing ()
 Perform iterative smoothing. More...
 
void perform_noniterative_smoothing ()
 Perform noniterative smoothing. More...
 
void update_buf_real_nc ()
 Update real nodal coordinates of _buf_window from _usr_window. More...
 
int check_input_pconn ()
 Check pconn block 3 of the input mesh. More...
 
void get_usr_disp (const COM::Attribute *pmesh, COM::Attribute *disp, double *timestep)
 Get displacement in _usr_window based on nc in _buf_window. More...
 

Miscellaneous

void set_value (const char *opt, const void *val)
 Set a Rocomp option. More...
 
void determine_pane_border ()
 Determine which nodes and elements are on pane borders. More...
 
void determine_physical_border (COM::Attribute *w_is_surface)
 Determine which nodes are on the physical border. More...
 
void determine_physical_border ()
 Determine which nodes and elements are on the physical border. More...
 
void determine_shared_border ()
 Determine which nodes and elements are shared. More...
 
void mark_elems_from_nodes (std::vector< std::vector< bool > > &marked_nodes, std::vector< std::vector< bool > > &marked_elems)
 Mark the nodes which contain marked elems. More...
 
void set_value (const char *opt, const void *val)
 Set a Rocomp option. More...
 
void determine_pane_border ()
 Determine which nodes and elements are on pane borders. More...
 
void determine_physical_border (COM::Attribute *w_is_surface)
 Determine which nodes are on the physical border. More...
 
void determine_physical_border ()
 Determine which nodes and elements are on the physical border. More...
 
void determine_shared_border ()
 Determine which nodes and elements are shared. More...
 
void mark_elems_from_nodes (std::vector< std::vector< bool > > &marked_nodes, std::vector< std::vector< bool > > &marked_elems)
 Mark the nodes which contain marked elems. More...
 
void set_value (const char *opt, const void *val)
 Set a Rocomp option. More...
 
void determine_pane_border ()
 Determine which nodes and elements are on pane borders. More...
 
void determine_physical_border (COM::Attribute *w_is_surface)
 Determine which nodes are on the physical border. More...
 
void determine_physical_border ()
 Determine which nodes and elements are on the physical border. More...
 
void determine_shared_border ()
 Determine which nodes and elements are shared. More...
 
void mark_elems_from_nodes (std::vector< std::vector< bool > > &marked_nodes, std::vector< std::vector< bool > > &marked_elems)
 Mark the nodes which contain marked elems. More...
 
virtual SURF::Window_manifold_2 * manifold ()
 Obtain a reference to the manifold. More...
 
int validate_object () const
 Check that the object is valid. More...
 
void invert_tets ()
 Repair inverted tets. More...
 
virtual SURF::Window_manifold_2 * manifold ()
 Obtain a reference to the manifold. More...
 
int validate_object () const
 Check that the object is valid. More...
 
void invert_tets ()
 Repair inverted tets. More...
 
virtual SURF::Window_manifold_2 * manifold ()
 Obtain a reference to the manifold. More...
 
int validate_object () const
 Check that the object is valid. More...
 
void invert_elements (int conn_type)
 Repair inverted tets or hexes. More...
 

Inter-Pane Communication

void agree_int (int &val, MPI_Op op)
 Agree on an integer value across all panes. More...
 
void agree_double (double &val, MPI_Op op)
 Agree on a double value across all panes. More...
 
void agree_int (int &val, MPI_Op op)
 Agree on an integer value across all panes. More...
 
void agree_double (double &val, MPI_Op op)
 Agree on a double value across all panes. More...
 
void agree_int (int &val, MPI_Op op)
 Agree on an integer value across all panes. More...
 
void agree_double (double &val, MPI_Op op)
 Agree on a double value across all panes. More...
 
static void reduce_sum_on_shared_nodes (COM::Attribute *att)
 Perform a sum-reduction on the shared nodes for the given attribute. More...
 
static void reduce_sum_on_shared_nodes (COM::Attribute *att)
 Perform a sum-reduction on the shared nodes for the given attribute. More...
 
static void reduce_sum_on_shared_nodes (COM::Attribute *att)
 Perform a sum-reduction on the shared nodes for the given attribute. More...
 

Functions exclusive to medial quadric smoothing.

void evaluate_face_normals ()
 Evaluate face normals (copied from FaceOffset_3.[hC]. More...
 
void identify_ridge_edges ()
 Identify ridge edges. More...
 
void redistribute_vertices_ridge ()
 Redistribute ridge vertices within their tangent spaces. More...
 
void redistribute_vertices_smooth ()
 Redistribute smooth vertices within their tangent spaces. More...
 
void compute_medial_quadric ()
 Compute medial quadric for every vertex. More...
 
int eigen_analyze_vertex (Vector_3< double > A_io[3], Vector_3< double > &b_io, Vector_3< double > *nrm_nz, double angle_defect)
 
void get_redist_safe_factor (COM::Attribute *c_attr, COM::Attribute *w_attr, int rank)
 
void evaluate_face_normals ()
 Evaluate face normals (copied from FaceOffset_3.[hC]. More...
 
void identify_ridge_edges ()
 Identify ridge edges. More...
 
void redistribute_vertices_ridge ()
 Redistribute ridge vertices within their tangent spaces. More...
 
void redistribute_vertices_smooth ()
 Redistribute smooth vertices within their tangent spaces. More...
 
void compute_medial_quadric ()
 Compute medial quadric for every vertex. More...
 
int eigen_analyze_vertex (Vector_3< double > A_io[3], Vector_3< double > &b_io, Vector_3< double > *nrm_nz, double angle_defect)
 
void get_redist_safe_factor (COM::Attribute *c_attr, COM::Attribute *w_attr, int rank)
 
void evaluate_face_normals ()
 Evaluate face normals (copied from FaceOffset_3.[hC]. More...
 
void identify_ridge_edges ()
 Identify ridge edges. More...
 
void redistribute_vertices_ridge ()
 Redistribute ridge vertices within their tangent spaces. More...
 
void redistribute_vertices_smooth ()
 Redistribute smooth vertices within their tangent spaces. More...
 
void compute_medial_quadric ()
 Compute medial quadric for every vertex. More...
 
int eigen_analyze_vertex (Vector_3< double > A_io[3], Vector_3< double > &b_io, Vector_3< double > *nrm_nz, double angle_defect)
 
void get_redist_safe_factor (COM::Attribute *c_attr, COM::Attribute *w_attr, int rank)
 
static void get_constraint_directions (int type, const Vector_3< double > &dir, int &ndirs, Vector_3< double > dirs[2])
 Get orthonormals of the constraints. More...
 
static void compute_eigenvectors (Vector_3< double > A[3], Vector_3< double > &lambdas)
 
static void compute_eigenvectors (Vector_2< double > A[2], Vector_2< double > &lambdas)
 
template<class FT >
static void solve (const FT &a1, const FT &a2, const FT &b1, const FT &b2, const FT &c1, const FT &c2, FT &x, FT &y)
 
template<class FT >
static void solve (const FT &a1, const FT &a2, const FT &a3, const FT &b1, const FT &b2, const FT &b3, const FT &c1, const FT &c2, const FT &c3, const FT &d1, const FT &d2, const FT &d3, FT &x, FT &y, FT &z)
 
static void solve (const Vector_3< double > A[3], const Vector_3< double > &q, Vector_3< double > &x)
 
static void get_constraint_directions (int type, const Vector_3< double > &dir, int &ndirs, Vector_3< double > dirs[2])
 Get orthonormals of the constraints. More...
 
static void compute_eigenvectors (Vector_3< double > A[3], Vector_3< double > &lambdas)
 
static void compute_eigenvectors (Vector_2< double > A[2], Vector_2< double > &lambdas)
 
template<class FT >
static void solve (const FT &a1, const FT &a2, const FT &b1, const FT &b2, const FT &c1, const FT &c2, FT &x, FT &y)
 
template<class FT >
static void solve (const FT &a1, const FT &a2, const FT &a3, const FT &b1, const FT &b2, const FT &b3, const FT &c1, const FT &c2, const FT &c3, const FT &d1, const FT &d2, const FT &d3, FT &x, FT &y, FT &z)
 
static void solve (const Vector_3< double > A[3], const Vector_3< double > &q, Vector_3< double > &x)
 
static void get_constraint_directions (int type, const Vector_3< double > &dir, int &ndirs, Vector_3< double > dirs[2])
 Get orthonormals of the constraints. More...
 
static void compute_eigenvectors (Vector_3< double > A[3], Vector_3< double > &lambdas)
 
static void compute_eigenvectors (Vector_2< double > A[2], Vector_2< double > &lambdas)
 
template<class FT >
static void solve (const FT &a1, const FT &a2, const FT &b1, const FT &b2, const FT &c1, const FT &c2, FT &x, FT &y)
 
template<class FT >
static void solve (const FT &a1, const FT &a2, const FT &a3, const FT &b1, const FT &b2, const FT &b3, const FT &c1, const FT &c2, const FT &c3, const FT &d1, const FT &d2, const FT &d3, FT &x, FT &y, FT &z)
 
static void solve (const Vector_3< double > A[3], const Vector_3< double > &q, Vector_3< double > &x)
 

Detailed Description

A Roccom mesh optimization module.

Definition at line 41 of file Rocmop.h.

Member Enumeration Documentation

anonymous enum

Valid Smoothing Methods.

Enumerator
SMOOTH_VOL_MESQ_WG 
SMOOTH_VOL_MESQ_NG 
SMOOTH_SURF_MEDIAL 
SMOOTH_NONE 

Definition at line 45 of file Rocmop.h.

anonymous enum
protected
Enumerator
MOP_COOKIE 

Definition at line 445 of file Rocmop.h.

445 { MOP_COOKIE=762667};
anonymous enum

Valid Smoothing Methods.

Enumerator
SMOOTH_VOL_MESQ_WG 
SMOOTH_VOL_MESQ_NG 
SMOOTH_SURF_MEDIAL 
SMOOTH_NONE 

Definition at line 46 of file Rocmop_1.h.

anonymous enum
protected
Enumerator
MOP_COOKIE 

Definition at line 472 of file Rocmop_1.h.

472 { MOP_COOKIE=762667};
anonymous enum

Valid Smoothing Methods.

Enumerator
SMOOTH_VOL_MESQ_WG 
SMOOTH_VOL_MESQ_NG 
SMOOTH_SURF_MEDIAL 
SMOOTH_NONE 

Definition at line 46 of file Rocmop_2.h.

anonymous enum

Valid Wrapper Choices.

Enumerator
WRAPPER_SHAPE 
WRAPPER_BOEING 
WRAPPER_MAX 

Definition at line 50 of file Rocmop_2.h.

anonymous enum
protected
Enumerator
MOP_COOKIE 

Definition at line 499 of file Rocmop_2.h.

499 { MOP_COOKIE=762667};

Constructor & Destructor Documentation

Rocmop ( )
inline

Default Constructor.

Definition at line 55 of file Rocmop.h.

56  _eig_thres(1.e-12),_dir_thres(.1), _saliency_crn(.1),
57  _rediter(1), _cnstr_types(NULL), _cnstr_dirs(NULL),
58  _usr_window(NULL), _wrk_window(NULL), _is_pmesh(false),
59  _method(SMOOTH_NONE), _verb(0), _lazy(0), _tol(0.0),
60  _niter(1), _ctol(.99), _ncycle(1), _monotone(0), _cookie(MOP_COOKIE),
61  _invert(0)
62  {;}
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
int _ncycle
Max number of subcycles for convergence.
Definition: Rocmop.h:479
char _wght_scheme
Weighting scheme.
Definition: Rocmop.h:419
bool _reorthog
Reorthogonalize?
Definition: Rocmop.h:418
double _eig_thres
Eigenvalue thresholds.
Definition: Rocmop.h:420
int _method
Choice of smoothing method.
Definition: Rocmop.h:447
int _cookie
For Roccom.
Definition: Rocmop.h:487
int _niter
Maximum number of iterations for smoothing.
Definition: Rocmop.h:469
int _rediter
No.iterations for vertex redistribution.
Definition: Rocmop.h:423
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
double _saliency_crn
Definition: Rocmop.h:422
int _invert
If true (default false), then invert the mesh.
Definition: Rocmop.h:489
int _monotone
Impose non-decreasing quality?
Definition: Rocmop.h:481
int _verb
Verbose level.
Definition: Rocmop.h:453
bool _is_pmesh
pmesh or mesh ?
Definition: Rocmop.h:441
double _dir_thres
Another threshold.
Definition: Rocmop.h:421
float _ctol
Subcycling tolerance.
Definition: Rocmop.h:471
COM::Attribute * _cnstr_dirs
Stores directions of nodal contraints.
Definition: Rocmop.h:425
int _lazy
Check quality before smoothing?
Definition: Rocmop.h:462
const COM::Attribute * _cnstr_types
Stores types of nodal constraints.
Definition: Rocmop.h:424
float _tol
Smoother iterating tolerance.
Definition: Rocmop.h:464
~Rocmop ( )
virtual

Destructor.

Definition at line 76 of file Rocmop.C.

76  {
77  if(_verb)
78  cout << "Entering Rocmop::~Rocmop\n";
79 
80  if (_wrk_window) {
81  delete _wrk_window; _wrk_window = NULL;
82  }
83 
84  if(_verb > 1)
85  cout << "Exiting Rocmop::~Rocmop\n";
86 }
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
int _verb
Verbose level.
Definition: Rocmop.h:453
Rocmop ( )
inline

Default Constructor.

Definition at line 56 of file Rocmop_1.h.

57  _eig_thres(1.e-12),_dir_thres(.1), _saliency_crn(.1),
58  _rediter(1), _cnstr_types(NULL), _cnstr_dirs(NULL),
59  _usr_window(NULL), _buf_window(NULL), _is_pmesh(false),
60  _method(SMOOTH_VOL_MESQ_WG), _verb(0), _lazy(0), _tol(165.0),
61  _niter(1), _ctol(.99), _ncycle(1),
63  N(-9999), disp_tally(0.0), _disp_thresh(0.0)
64  {;}
int _smoothfreq
Definition: Rocmop_1.h:514
float _maxdisp
Maximum displacement allowed.
Definition: Rocmop_1.h:512
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
int _ncycle
Max number of subcycles for convergence.
Definition: Rocmop.h:479
char _wght_scheme
Weighting scheme.
Definition: Rocmop.h:419
bool _reorthog
Reorthogonalize?
Definition: Rocmop.h:418
double _eig_thres
Eigenvalue thresholds.
Definition: Rocmop.h:420
int _method
Choice of smoothing method.
Definition: Rocmop.h:447
int _cookie
For Roccom.
Definition: Rocmop.h:487
int _niter
Maximum number of iterations for smoothing.
Definition: Rocmop.h:469
int _rediter
No.iterations for vertex redistribution.
Definition: Rocmop.h:423
double _saliency_crn
Definition: Rocmop.h:422
float _disp_thresh
originally a static in check_displacements
Definition: Rocmop_1.h:520
int _invert
If true (default false), then invert the mesh.
Definition: Rocmop.h:489
int _verb
Verbose level.
Definition: Rocmop.h:453
bool _is_pmesh
pmesh or mesh ?
Definition: Rocmop.h:441
double _dir_thres
Another threshold.
Definition: Rocmop.h:421
double disp_tally
originally a static in smooth()
Definition: Rocmop_1.h:518
float _ctol
Subcycling tolerance.
Definition: Rocmop.h:471
COM::Attribute * _cnstr_dirs
Stores directions of nodal contraints.
Definition: Rocmop.h:425
int _lazy
Check quality before smoothing?
Definition: Rocmop.h:462
const COM::Attribute * _cnstr_types
Stores types of nodal constraints.
Definition: Rocmop.h:424
int N
Smooth every _smoothfreq&#39;th call.
Definition: Rocmop_1.h:516
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464
float _tol
Smoother iterating tolerance.
Definition: Rocmop.h:464
virtual ~Rocmop ( )
virtual

Destructor.

Rocmop ( )
inline

Default Constructor.

Definition at line 59 of file Rocmop_2.h.

60  _eig_thres(1.e-12),_dir_thres(.1), _saliency_crn(.1),
61  _rediter(1), _cnstr_types(NULL), _cnstr_dirs(NULL),
62  _usr_window(NULL), _buf_window(NULL), _is_pmesh(false),
64  _niter(1), _ctol(.99), _ncycle(1),
66  _maxdisp(0.0), _smoothfreq(1),
67  _disp_thresh(0.0)
68  {;}
int _smoothfreq
Definition: Rocmop_1.h:514
float _maxdisp
Maximum displacement allowed.
Definition: Rocmop_1.h:512
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
int _ncycle
Max number of subcycles for convergence.
Definition: Rocmop.h:479
char _wght_scheme
Weighting scheme.
Definition: Rocmop.h:419
bool _reorthog
Reorthogonalize?
Definition: Rocmop.h:418
double _eig_thres
Eigenvalue thresholds.
Definition: Rocmop.h:420
int _method
Choice of smoothing method.
Definition: Rocmop.h:447
int _wrapper
Choice of Mesquite Smoothing Wrappers.
Definition: Rocmop_2.h:507
int _cookie
For Roccom.
Definition: Rocmop.h:487
int _niter
Maximum number of iterations for smoothing.
Definition: Rocmop.h:469
int _rediter
No.iterations for vertex redistribution.
Definition: Rocmop.h:423
int _invert_tets
If true (default false), then invert tets.
Definition: Rocmop_2.h:541
double _saliency_crn
Definition: Rocmop.h:422
float _disp_thresh
originally a static in check_displacements
Definition: Rocmop_1.h:520
int _verb
Verbose level.
Definition: Rocmop.h:453
bool _is_pmesh
pmesh or mesh ?
Definition: Rocmop.h:441
double _dir_thres
Another threshold.
Definition: Rocmop.h:421
float _ctol
Subcycling tolerance.
Definition: Rocmop.h:471
COM::Attribute * _cnstr_dirs
Stores directions of nodal contraints.
Definition: Rocmop.h:425
int _lazy
Check quality before smoothing?
Definition: Rocmop.h:462
const COM::Attribute * _cnstr_types
Stores types of nodal constraints.
Definition: Rocmop.h:424
int _invert_hexes
If true (default false), then invert hexes.
Definition: Rocmop_2.h:543
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464
float _tol
Smoother iterating tolerance.
Definition: Rocmop.h:464
virtual ~Rocmop ( )
virtual

Destructor.

Member Function Documentation

void add_aspect_ratios ( COM::Attribute *  usr_att,
COM::Attribute *  buf_att = NULL 
)

Definition at line 454 of file Rocmop_1.C.

References COM_assertion_msg, COM_DOUBLE, Angle_Metric_3::compute(), Rocblas::copy(), Aspect_Metric_3::getAspects(), i, Geo_Metric_Base_3::initialize(), j, ni, nj, and Rocmap::update_ghosts().

455  {
456 
457  COM::Window* usr_window = usr_att->window();
458  COM::Window* buf_window = NULL;
459 
460  bool del_buffer = false;
461 
462  if(!buf_att){
463  del_buffer = true;
464  // Create a buffer window by cloning from the user window
465  std::string buf_name(usr_window->name()+"-Rocmop_add_aspect");
466  buf_window = new COM::Window(buf_name,
467  usr_window->get_communicator());
468  buf_window->inherit( usr_att, "",
469  COM::Pane::INHERIT_CLONE, true, NULL,0);
470  buf_window->init_done();
471  }
472  else
473  buf_window = _buf_window;
474 
475  std::vector<Pane*> allpanes;
476 
477  buf_window->panes(allpanes);
478 
479  // Create and resize window level buffer attributes
480  COM::Attribute * w_buff_R =
481  buf_window->new_attribute("Aspect Ratio: R (circumradius)",'e',COM_DOUBLE,1,"");
482  COM::Attribute * w_buff_r =
483  buf_window->new_attribute("Aspect Ratio: r (inradius)",'e',COM_DOUBLE,1,"");
484  COM::Attribute * w_buff_l =
485  buf_window->new_attribute("Aspect Ratio: l (shortest edge)",'e',COM_DOUBLE,1,"");
486  COM::Attribute * w_buff_rR =
487  buf_window->new_attribute("Aspect Ratio: 3r/R",'e',COM_DOUBLE,1,"");
488  COM::Attribute * w_buff_Rr =
489  buf_window->new_attribute("Aspect Ratio: R/r",'e',COM_DOUBLE,1,"");
490  COM::Attribute * w_buff_Rl =
491  buf_window->new_attribute("Aspect Ratio: R/l",'e',COM_DOUBLE,1,"");
492  COM::Attribute * w_buff_min =
493  buf_window->new_attribute("Aspect Ratio: min dih",'e',COM_DOUBLE,1,"");
494  COM::Attribute * w_buff_max =
495  buf_window->new_attribute("Aspect Ratio: max dih",'e',COM_DOUBLE,1,"");
496 
497  buf_window->resize_array(w_buff_R,0);
498  buf_window->resize_array(w_buff_r,0);
499  buf_window->resize_array(w_buff_l,0);
500  buf_window->resize_array(w_buff_rR,0);
501  buf_window->resize_array(w_buff_Rr,0);
502  buf_window->resize_array(w_buff_Rl,0);
503  buf_window->resize_array(w_buff_min,0);
504  buf_window->resize_array(w_buff_max,0);
505  buf_window->init_done();
506 
507  // Obtain buffer attribute ids
508  int R_id = w_buff_R->id();
509  int r_id = w_buff_r->id();
510  int l_id = w_buff_l->id();
511  int rR_id = w_buff_rR->id();
512  int Rr_id = w_buff_Rr->id();
513  int Rl_id = w_buff_Rl->id();
514  int min_id = w_buff_min->id();
515  int max_id = w_buff_max->id();
516 
517  // Create and resize window level user attributes
518  COM::Attribute * w_usr_R =
519  usr_window->new_attribute("Aspect Ratio: R",'e',COM_DOUBLE,1,"");
520  COM::Attribute * w_usr_r =
521  usr_window->new_attribute("Aspect Ratio: r",'e',COM_DOUBLE,1,"");
522  COM::Attribute * w_usr_l =
523  usr_window->new_attribute("Aspect Ratio: l",'e',COM_DOUBLE,1,"");
524  COM::Attribute * w_usr_rR =
525  usr_window->new_attribute("Aspect Ratio: 3r/R",'e',COM_DOUBLE,1,"");
526  COM::Attribute * w_usr_Rr =
527  usr_window->new_attribute("Aspect Ratio: R/r",'e',COM_DOUBLE,1,"");
528  COM::Attribute * w_usr_Rl =
529  usr_window->new_attribute("Aspect Ratio: R/l",'e',COM_DOUBLE,1,"");
530  COM::Attribute * w_usr_min =
531  usr_window->new_attribute("Aspect Ratio: min dih",'e',COM_DOUBLE,1,"");
532  COM::Attribute * w_usr_max =
533  usr_window->new_attribute("Aspect Ratio: max dih",'e',COM_DOUBLE,1,"");
534 
535  usr_window->resize_array(w_usr_R,0);
536  usr_window->resize_array(w_usr_r,0);
537  usr_window->resize_array(w_usr_l,0);
538  usr_window->resize_array(w_usr_rR,0);
539  usr_window->resize_array(w_usr_Rr,0);
540  usr_window->resize_array(w_usr_Rl,0);
541  usr_window->resize_array(w_usr_min,0);
542  usr_window->resize_array(w_usr_max,0);
543  usr_window->init_done();
544 
545  double R,r,l;
546  double angles[] = {0.0,0.0};
547 
548  for(int i=0,ni=(int)allpanes.size();i<ni;++i){
549 
550  // get Pane level buffer attributes
551  double *R_ptr = reinterpret_cast<double *>
552  (allpanes[i]->attribute(R_id)->pointer());
553  double *r_ptr = reinterpret_cast<double *>
554  (allpanes[i]->attribute(r_id)->pointer());
555  double *l_ptr = reinterpret_cast<double *>
556  (allpanes[i]->attribute(l_id)->pointer());
557  double *rR_ptr = reinterpret_cast<double *>
558  (allpanes[i]->attribute(rR_id)->pointer());
559  double *Rr_ptr = reinterpret_cast<double *>
560  (allpanes[i]->attribute(Rr_id)->pointer());
561  double *Rl_ptr = reinterpret_cast<double *>
562  (allpanes[i]->attribute(Rl_id)->pointer());
563  double *min_ptr = reinterpret_cast<double *>
564  (allpanes[i]->attribute(min_id)->pointer());
565  double *max_ptr = reinterpret_cast<double *>
566  (allpanes[i]->attribute(max_id)->pointer());
567 
568  for(int j=0,nj=allpanes[i]->size_of_elements();j<nj;++j){
569 
570  Element_node_enumerator ene(allpanes[i],j+1);
571 
572  Aspect_Metric_3 aspect_met;
573  aspect_met.initialize(ene);
574  aspect_met.getAspects(R,r,l);
575 
576  Angle_Metric_3 angle_met;
577  angle_met.initialize(ene);
578  angle_met.compute(angles);
579 
580  R_ptr[j] = R;
581  r_ptr[j] = r;
582  l_ptr[j] = l;
583  COM_assertion_msg(R != 0.0,
584  "Cannot calculate aspect ratios with zero magnitude circumradius");
585  rR_ptr[j] = (3.0*r)/R;
586  COM_assertion_msg(r != 0.0,
587  "Cannot calculate aspect ratios with zero magnitude circumradius");
588  Rr_ptr[j] = R/r;
589  COM_assertion_msg(l != 0.0,
590  "Cannot calculate aspect ratios with zero magnitude circumradius");
591  Rl_ptr[j] = R/l;
592 
593  min_ptr[j] = angles[0];
594  max_ptr[j] = angles[1];
595  }
596  }
597 
598  Rocmap::update_ghosts(w_buff_R);
599  Rocmap::update_ghosts(w_buff_r);
600  Rocmap::update_ghosts(w_buff_l);
601  Rocmap::update_ghosts(w_buff_rR);
602  Rocmap::update_ghosts(w_buff_Rr);
603  Rocmap::update_ghosts(w_buff_Rl);
604  Rocmap::update_ghosts(w_buff_min);
605  Rocmap::update_ghosts(w_buff_max);
606 
607  Rocblas::copy(w_buff_R,w_usr_R);
608  Rocblas::copy(w_buff_r,w_usr_r);
609  Rocblas::copy(w_buff_l,w_usr_l);
610  Rocblas::copy(w_buff_rR,w_usr_rR);
611  Rocblas::copy(w_buff_Rr,w_usr_Rr);
612  Rocblas::copy(w_buff_Rl,w_usr_Rl);
613  Rocblas::copy(w_buff_min,w_usr_min);
614  Rocblas::copy(w_buff_max,w_usr_max);
615 
616  if(del_buffer)
617  delete buf_window;
618 }
3D Aspect Ratios Metric Class
virtual void compute(double atts[]) const
Calculate the metric value on this element.
#define COM_assertion_msg(EX, msg)
blockLoc i
Definition: read.cpp:79
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
static void update_ghosts(COM::Attribute *att, const COM::Attribute *pconn=NULL)
Update ghost nodal or elemental values for the given attribute.
Definition: Rocmap.C:87
j indices j
Definition: Indexing.h:6
void getAspects(double &R, double &r, double &l)
Get the geometric aspects.
3D Max and Min Angle Metric Class
static void copy(const Attribute *x, Attribute *y)
Wrapper for copy.
Definition: op2args.C:333
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464

Here is the call graph for this function:

void add_aspect_ratios ( COM::Attribute *  usr_att,
COM::Attribute *  buf_att = NULL 
)
void agree_double ( double &  val,
MPI_Op  op 
)
inlineprotected

Agree on a double value across all panes.

Parameters
valThe local value.
opThe type of reduction to perform.

Definition at line 239 of file Rocmop_1.h.

References _usr_window, and COMMPI_Initialized().

239  {
240  if(COMMPI_Initialized()){
241  double temp = val;
242  MPI_Allreduce(&val, &temp, 1, MPI_DOUBLE, op,
243  _usr_window->get_communicator());
244  val = temp;
245  }
246  }
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

void agree_double ( double &  val,
MPI_Op  op 
)
inlineprotected

Agree on a double value across all panes.

Parameters
valThe local value.
opThe type of reduction to perform.

Definition at line 240 of file Rocmop.h.

References _usr_window, and COMMPI_Initialized().

240  {
241  if(COMMPI_Initialized()){
242  double temp = val;
243  MPI_Allreduce(&val, &temp, 1, MPI_DOUBLE, op,
244  _usr_window->get_communicator());
245  val = temp;
246  }
247  }
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

void agree_double ( double &  val,
MPI_Op  op 
)
inlineprotected

Agree on a double value across all panes.

Parameters
valThe local value.
opThe type of reduction to perform.

Definition at line 261 of file Rocmop_2.h.

References _usr_window, and COMMPI_Initialized().

261  {
262  if(COMMPI_Initialized()){
263  double temp = val;
264  MPI_Allreduce(&val, &temp, 1, MPI_DOUBLE, op,
265  _usr_window->get_communicator());
266  val = temp;
267  }
268  }
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

void agree_int ( int &  val,
MPI_Op  op 
)
inlineprotected

Agree on an integer value across all panes.

Parameters
valThe local value.
opThe type of reduction to perform.

Definition at line 225 of file Rocmop_1.h.

References _usr_window, and COMMPI_Initialized().

225  {
226  if(COMMPI_Initialized()){
227  int temp = val;
228  MPI_Allreduce(&val, &temp, 1, MPI_INT, op,
229  _usr_window->get_communicator());
230  val = temp;
231  }
232  }
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

void agree_int ( int &  val,
MPI_Op  op 
)
inlineprotected

Agree on an integer value across all panes.

Parameters
valThe local value.
opThe type of reduction to perform.

Definition at line 226 of file Rocmop.h.

References _usr_window, and COMMPI_Initialized().

226  {
227  if(COMMPI_Initialized()){
228  int temp = val;
229  MPI_Allreduce(&val, &temp, 1, MPI_INT, op,
230  _usr_window->get_communicator());
231  val = temp;
232  }
233  }
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

void agree_int ( int &  val,
MPI_Op  op 
)
inlineprotected

Agree on an integer value across all panes.

Parameters
valThe local value.
opThe type of reduction to perform.

Definition at line 247 of file Rocmop_2.h.

References _usr_window, and COMMPI_Initialized().

247  {
248  if(COMMPI_Initialized()){
249  int temp = val;
250  MPI_Allreduce(&val, &temp, 1, MPI_INT, op,
251  _usr_window->get_communicator());
252  val = temp;
253  }
254  }
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

double check_all_elem_quality ( std::vector< const COM::Pane * > &  allpanes,
bool  with_ghost = false 
)
protected

Get the largest dihedral angle of all real elements.

Parameters
allpanesthe set of panes containing the elements

Definition at line 785 of file Rocmop.C.

References Angle_Metric_3::compute(), i, Geo_Metric_Base_3::initialize(), k, ni, nk, and rank.

786  {
787  if(_verb)
788  std::cout << "Exiting Rocmop::check_all_elem_quality" << std::endl;
789 
790  int rank =0;
791  int ierr = MPI_Comm_rank( _wrk_window->get_communicator(),
792  &rank); assert( ierr == 0);
793  double worst_angle = 0.0;
794  double angles[] = {0.0, 0.0};
795  for(int i=0,ni = allpanes.size(); i<ni; ++i){
796  int nk=allpanes[i]->size_of_real_elements();
797  if(with_ghosts)
798  nk = allpanes[i]->size_of_elements();
799  for(int k =0; k<nk; ++k){
800  Element_node_enumerator ene(allpanes[i],k+1);
801  Angle_Metric_3 am;
802  am.initialize(ene);
803  am.compute(angles);
804  if(angles[1]>worst_angle)
805  worst_angle = angles[1];
806  }
807  }
808  return worst_angle;
809 
810  if(_verb > 1)
811  std::cout << "Exiting Rocmop::check_all_elem_quality" << std::endl;
812 }
virtual void compute(double atts[]) const
Calculate the metric value on this element.
j indices k indices k
Definition: Indexing.h:6
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
int _verb
Verbose level.
Definition: Rocmop.h:453
void int int * nk
Definition: read.cpp:74
3D Max and Min Angle Metric Class
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
static int rank
Definition: advectest.C:66

Here is the call graph for this function:

double check_all_elem_quality ( std::vector< const COM::Pane * > &  allpanes,
bool  with_ghost = false 
)
protected

Get the largest dihedral angle of all real elements.

Parameters
allpanesthe set of panes containing the elements
double check_all_elem_quality ( std::vector< COM::Pane * > &  allpanes,
bool  with_ghosts = false 
)
protected

Get the largest dihedral angle of all real elements marked.

Parameters
allpanesthe set of panes containing the elements

Definition at line 814 of file Rocmop.C.

References Angle_Metric_3::compute(), i, Geo_Metric_Base_3::initialize(), k, ni, nk, and rank.

815  {
816  if(_verb)
817  std::cout << "Entering Rocmop::check_all_elem_quality" << std::endl;
818 
819  int rank =0;
820  int ierr = MPI_Comm_rank( _wrk_window->get_communicator(),
821  &rank); assert( ierr == 0);
822 
823  double worst_angle = 0.0;
824  double angles[] = {0.0, 0.0};
825  for(int i=0,ni = allpanes.size(); i<ni; ++i){
826  int nk=allpanes[i]->size_of_real_elements();
827  if(with_ghosts){
828  nk = allpanes[i]->size_of_elements();
829  }
830  for(int k =0; k<nk; ++k){
831  Element_node_enumerator ene(allpanes[i],k+1);
832  Angle_Metric_3 am;
833  am.initialize(ene);
834  am.compute(angles);
835 
836  if(angles[1]>worst_angle)
837  worst_angle = angles[1];
838  }
839  }
840  return worst_angle;
841 
842  if(_verb > 1)
843  std::cout << "Exiting Rocmop::check_all_elem_quality" << std::endl;
844 }
virtual void compute(double atts[]) const
Calculate the metric value on this element.
j indices k indices k
Definition: Indexing.h:6
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
int _verb
Verbose level.
Definition: Rocmop.h:453
void int int * nk
Definition: read.cpp:74
3D Max and Min Angle Metric Class
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
static int rank
Definition: advectest.C:66

Here is the call graph for this function:

double check_all_elem_quality ( std::vector< COM::Pane * > &  allpanes,
bool  with_ghosts = false 
)
protected

Get the largest dihedral angle of all real elements marked.

Parameters
allpanesthe set of panes containing the elements
double check_all_elem_quality ( std::vector< const COM::Pane * > &  allpanes,
bool  with_ghost = false 
)
protected

Get the largest dihedral angle of all real elements.

Parameters
allpanesthe set of panes containing the elements
double check_all_elem_quality ( std::vector< COM::Pane * > &  allpanes,
bool  with_ghosts = false 
)
protected

Get the largest dihedral angle of all real elements marked.

Parameters
allpanesthe set of panes containing the elements
bool check_displacements ( COM::Attribute *  disp)
protected

Definition at line 357 of file Rocmop_1.C.

References i, j, MPI_MAX, ni, nj, Vector_3< Type >::norm(), and nvc::norm().

358 {
359 #ifdef ROCPROF
360  Profile_begin("Rocmop::check_disp");
361 #endif
362 
363  int disp_id = w_disp->id();
364  double max_norm = 0.0;
365  // move to class member function
366  //static double disp_tally = 0.0;
367  bool retval = true;
368  // std::ofstream Ouf;
369  // Ouf.open("displacements.txt",ios::app);
370  std::vector<Pane*> allpanes;
371  const_cast<COM::Window*>(_usr_window)->panes(allpanes);
372 
373  // Find the maximum displacement on this processor
374  for(int i=0,ni = allpanes.size(); i<ni; ++i){
375 
376  Vector_3<double> *ptr = NULL;
377  COM::Attribute* ptr_att = allpanes[i]->attribute(disp_id);
378  void* void_ptr = ptr_att->pointer();
379  ptr = reinterpret_cast<Vector_3<double>*>(void_ptr);
380 
381  for(int j=0,nj = allpanes[i]->size_of_real_nodes(); j<nj; ++j){
382  double norm = ptr[j].norm();
383  // Re-assign them to zero to maintain original Rocmop behavior
384  // just in case. I'm pretty sure that any values in this array
385  // already get wiped out when the Mesquite displacements are
386  // copied in.
387  ptr[j][0] = 0.0;
388  ptr[j][1] = 0.0;
389  ptr[j][2] = 0.0;
390  // Ouf << j << ": " << norm << std::endl;
391  if(norm > max_norm)
392  max_norm = norm;
393  }
394  }
395  // Maximize the displacement across all processors
396  agree_double(max_norm,MPI_MAX);
397 
398  // Update the tally
399  disp_tally += max_norm;
400 
401  // Build a blurb about displacement
402  std::ostringstream Ostr;
403  Ostr << "Mesh Displacement: " << disp_tally;
404 
405  // Determine whether we have exceeded the threshold
406  if(disp_tally > _disp_thresh){
407  disp_tally = 0.0;
408  retval = true;
409  // If we intend to smooth - also print out the displacement
410  print_legible(0,Ostr.str().c_str());
411  }
412  else {
413  retval = false;
414  // If not smoothing, print out displacement if verbosity is higher
415  print_legible(1,Ostr.str().c_str());
416  }
417 #ifdef ROCPROF
418  Profile_end("Rocmop::check_disp");
419 #endif
420  // Ouf.close();
421  return(retval);
422 }
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
T norm(const NVec< DIM, T > &v)
blockLoc i
Definition: read.cpp:79
void print_legible(int verb, const char *msg)
Single process print message if given verbosity level is exceeded.
Definition: Rocmop_1.C:1408
float _disp_thresh
originally a static in check_displacements
Definition: Rocmop_1.h:520
double disp_tally
originally a static in smooth()
Definition: Rocmop_1.h:518
void agree_double(double &val, MPI_Op op)
Agree on a double value across all panes.
Definition: Rocmop.h:240
j indices j
Definition: Indexing.h:6
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
Type norm() const
Definition: mapbasic.h:112

Here is the call graph for this function:

bool check_displacements ( COM::Attribute *  disp)
protected
int check_input_pconn ( )
protected

Check pconn block 3 of the input mesh.

Check if all ghost nodes are listed in pconn block 3 of _usr_window

Definition at line 886 of file Rocmop_2.C.

References COM_NC, COM_PCONN, COMMPI_Initialized(), i, j, k, ni, and rank.

887 {
888  int rank =0;
889  if(COMMPI_Initialized())
890  {
891  int ierr = MPI_Comm_rank(_usr_window->get_communicator(), &rank);
892  assert( ierr == 0);
893  }
894 
895  std::vector<const Pane*> allusrpanes;
896  _usr_window->panes(allusrpanes);
897 
898  for(int i = 0, ni = allusrpanes.size(); i < ni; ++i)
899  {
900  // Obtain pane level attributes
901  const COM::Attribute *usr_nc = allusrpanes[i]->attribute(COM::COM_NC);
902  const COM::Attribute *usr_pconn = allusrpanes[i]->attribute(COM::COM_PCONN);
903  int minGhostNodeID = usr_nc->size_of_real_items() + 1;
904  int maxGhostNodeID = usr_nc->size_of_items();
905  int numGhostNodes = maxGhostNodeID - minGhostNodeID + 1;
906  int * pconnArray = (int *)usr_pconn->pointer();
907 
908  // Check pconn
909  bool OORGhostNodes = false; // found out of range ghost node
910  bool missGhostNodes = false; // ghost nodes missed from pconn
911 
912  // Allocate marking array
913  int * isMarked = new int [numGhostNodes];
914  for (int j = 0; j < numGhostNodes; j++)
915  isMarked[j] = 0;
916 
917  // Jump to pconn block 3
918  int index = 0;
919  int numNbrs = 0;
920  int numItems = 0;
921 
922  for (int j = 0; j < 2; j++)
923  {
924  numNbrs = pconnArray[index];
925  index++;
926 
927  for (int k = 0; k < numNbrs; k++)
928  {
929  index++; // step over proc id
930  numItems = pconnArray[index];
931  index++;
932  index += numItems;
933  }
934  }
935 
936  // Begin marking
937  numNbrs = pconnArray[index];
938  index++;
939 
940  for (int j = 0; j < numNbrs; j++)
941  {
942  index++; // step over proc id
943  numItems = pconnArray[index];
944  index++;
945 
946  for (int k = 0; k < numItems; k++)
947  {
948  int lid = pconnArray[index];
949  index++;
950 
951  if (lid < minGhostNodeID || lid > maxGhostNodeID)
952  {
953  std::cerr << "Rocmop: Error in check_input_pconn(): Rank "
954  << rank << ", Ghost node " << lid
955  << " is out of ghost node range.\n" << std::endl;
956  OORGhostNodes = true;
957  }
958  else if (isMarked[lid - minGhostNodeID] == 1)
959  {
960  if (_verb > 0)
961  std::cerr << "Rocmop: Warning in check_input_pconn(): Rank "
962  << rank << ", Ghost node " << lid
963  << " has > 1 owners.\n" << std::endl;
964  }
965  else
966  isMarked[lid - minGhostNodeID] = 1;
967  }
968  }
969 
970  // Check if any node is not marked
971  for (int j = 0; j < numGhostNodes; j++)
972  if (isMarked[j] == 0)
973  {
974  missGhostNodes = true;
975  std::cerr << "Rocmop: Error in check_input_pconn(): Rank "
976  << rank << ", Ghost node " << (j + minGhostNodeID)
977  << " is not listed in pconn block 3.\n" << std::endl;
978  }
979 
980  // Free up memory
981  delete isMarked;
982 
983  // Return the result
984  if (OORGhostNodes == true || missGhostNodes == true)
985  return 1;
986  }
987 
988  return 0;
989 }
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
j indices k indices k
Definition: Indexing.h:6
blockLoc i
Definition: read.cpp:79
int _verb
Verbose level.
Definition: Rocmop.h:453
j indices j
Definition: Indexing.h:6
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
static int rank
Definition: advectest.C:66
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

double check_marked_elem_quality ( std::vector< std::vector< bool > > &  marked_elems,
std::vector< COM::Pane * > &  allpanes 
)
protected

Get the largest dihedral angle of marked real elements.

Parameters
marked_elemsthe elements whose quality is to be checked.
allpanesthe set of panes containing the elements

Definition at line 760 of file Rocmop.C.

References Angle_Metric_3::compute(), i, Geo_Metric_Base_3::initialize(), k, ni, and nk.

761  {
762  if(_verb)
763  std::cout << "Entering Rocmop::check_marked_elems" << std::endl;
764 
765  double worst_angle = 0.0;
766  double angles[] = {0.0, 0.0};
767  for(int i=0,ni = allpanes.size(); i<ni; ++i){
768  for(int k =0,nk=allpanes[i]->size_of_real_elements(); k<nk; ++k){
769  if(marked_elems[i][k]){
770  Element_node_enumerator ene(allpanes[i],k+1);
771  Angle_Metric_3 am;
772  am.initialize(ene);
773  am.compute(angles);
774  if(angles[1]>worst_angle)
775  worst_angle = angles[1];
776  }
777  }
778  }
779  return worst_angle;
780 
781  if(_verb > 1)
782  std::cout << "Exiting Rocmop::check_marked_elems" << std::endl;
783 }
virtual void compute(double atts[]) const
Calculate the metric value on this element.
j indices k indices k
Definition: Indexing.h:6
blockLoc i
Definition: read.cpp:79
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
int _verb
Verbose level.
Definition: Rocmop.h:453
void int int * nk
Definition: read.cpp:74
3D Max and Min Angle Metric Class
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77

Here is the call graph for this function:

double check_marked_elem_quality ( std::vector< std::vector< bool > > &  marked_elems,
std::vector< COM::Pane * > &  allpanes 
)
protected

Get the largest dihedral angle of marked real elements.

Parameters
marked_elemsthe elements whose quality is to be checked.
allpanesthe set of panes containing the elements
double check_marked_elem_quality ( std::vector< std::vector< bool > > &  marked_elems,
std::vector< COM::Pane * > &  allpanes 
)
protected

Get the largest dihedral angle of marked real elements.

Parameters
marked_elemsthe elements whose quality is to be checked.
allpanesthe set of panes containing the elements
void compute_eigenvectors ( Vector_3< double >  A[3],
Vector_3< double > &  lambdas 
)
staticprotected

Definition at line 1191 of file smooth_medial.C.

References COM_assertion_msg, dsyevq3(), cimg_library::cimg::info(), and swap().

Referenced by eigen_analyze_vertex().

1191  {
1192 
1193  double abuf[3][3] = { {A[0][0], A[0][1], A[0][2]},
1194  {A[1][0], A[1][1], A[1][2]},
1195  {A[2][0], A[2][1], A[2][2]}};
1196  double ebuf[3][3];
1197 
1198  int info = dsyevq3( abuf, ebuf, &lambdas[0]);
1199  COM_assertion_msg( info==0, "Computation of eigenvectos failed");
1200 
1201  std::swap( ebuf[0][1], ebuf[1][0]);
1202  std::swap( ebuf[0][2], ebuf[2][0]);
1203  std::swap( ebuf[1][2], ebuf[2][1]);
1204 
1205  const Vector_3<double> *buf = (const Vector_3<double>*)&ebuf[0][0];
1206 
1207  if ( lambdas[0]<lambdas[1]) {
1208  if ( lambdas[1]<lambdas[2]) { // l2>l1>l0
1209  std::swap( lambdas[0], lambdas[2]);
1210  A[0] = buf[2]; A[1] = buf[1]; A[2] = buf[0];
1211  }
1212  else {
1213  double t = lambdas[0];
1214  lambdas[0] = lambdas[1];
1215  A[0] = buf[1];
1216 
1217  if ( t<lambdas[2]) { // l1>=l2>l0
1218  lambdas[1] = lambdas[2]; lambdas[2] = t;
1219  A[1] = buf[2]; A[2] = buf[0];
1220  }
1221  else { // l1>l0>=l2
1222  lambdas[1] = t;
1223  A[1] = buf[0]; A[2] = buf[2];
1224  }
1225  }
1226  }
1227  else if ( lambdas[0]<lambdas[2]) { // l2>l0>=l1
1228  double t = lambdas[0];
1229  lambdas[0] = lambdas[2]; lambdas[2] = lambdas[1]; lambdas[1] = t;
1230  A[0] = buf[2]; A[1] = buf[0]; A[2] = buf[1];
1231  }
1232  else {
1233  A[0] = buf[0];
1234  if ( lambdas[1]<lambdas[2]) { // l0>=l2>l1
1235  std::swap( lambdas[1], lambdas[2]);
1236  A[1] = buf[2]; A[2] = buf[1];
1237  }
1238  else {// l0>=l1>=l2
1239  A[1] = buf[1]; A[2] = buf[2];
1240  }
1241  }
1242 }
void swap(int &a, int &b)
Definition: buildface.cpp:88
#define COM_assertion_msg(EX, msg)
int dsyevq3(double A[3][3], double Q[3][3], double w[3])
void info()
Print informations about CImg environement variables.
Definition: CImg.h:5702

Here is the call graph for this function:

Here is the caller graph for this function:

static void compute_eigenvectors ( Vector_2< double >  A[2],
Vector_2< double > &  lambdas 
)
staticprotected
static void compute_eigenvectors ( Vector_3< double >  A[3],
Vector_3< double > &  lambdas 
)
staticprotected
static void compute_eigenvectors ( Vector_2< double >  A[2],
Vector_2< double > &  lambdas 
)
staticprotected
static void compute_eigenvectors ( Vector_3< double >  A[3],
Vector_3< double > &  lambdas 
)
staticprotected
static void compute_eigenvectors ( Vector_2< double >  A[2],
Vector_2< double > &  lambdas 
)
staticprotected
void compute_medial_quadric ( )
protected

Compute medial quadric for every vertex.

Definition at line 286 of file smooth_medial.C.

References _cnstr_dirs, _cnstr_types, _verb, _wght_scheme, _wrk_window, cimg_library::acos(), angle(), COM_NC, Rocblas::copy_scalar(), Vector_3< Type >::cross_product(), d, E2N_ANGLE, E2N_AREA, E2N_ONE, E2N_SPHERE, eigen_analyze_vertex(), half_pi, i, j, k, max(), ni, nj, Vector_3< Type >::norm(), Vector_3< Type >::normalize(), pi, REAL_PANE, rs(), s, sin, and sqrt().

Referenced by smooth_surf_medial().

286  {
287  if(_verb > 1)
288  std::cout << "Entering Rocmop::compute_medial_quadric" << std::endl;
289  // Use the following buffer spaces: _eigvecs for matrix A;
290  // _eigvalues to store bm; disps to store bo, _weights to store r
291  const std::string att1("eigvecs"), att2("lambda"), att3("weights"),
292  att4("facenormals"), att5("facecenters"), att6("tangranks"),
293  att7("cntnranks"), att8("cntnvecs"), att9("vnormals"), att10("disps"),
294  att11("awnormals"), att12("uwnormals");
295  COM::Attribute *A_attr = _wrk_window->attribute(att1);
296  COM::Attribute *bm_attr = _wrk_window->attribute(att2);
297  COM::Attribute *aw_attr = _wrk_window->attribute(att11);
298  COM::Attribute *uw_attr = _wrk_window->attribute(att12);
299  COM::Attribute *r_attr = _wrk_window->attribute(att3);
300 
301  int facenormals_id = _wrk_window->attribute(att4)->id();
302  int facecenters_id = _wrk_window->attribute(att5)->id();
303  int tangranks_id = _wrk_window->attribute(att6)->id();
304  int cntnranks_id = _wrk_window->attribute(att7)->id();
305  int cntnvecs_id = _wrk_window->attribute(att8)->id();
306  int vnormals_id = _wrk_window->attribute(att9)->id();
307  int awnormals_id = _wrk_window->attribute(att11)->id();
308  int uwnormals_id = _wrk_window->attribute(att12)->id();
309  int disps_id = _wrk_window->attribute(att10)->id();
310 
311  double zero = 0.;
312  Rocblas::copy_scalar( &zero, A_attr);
313  Rocblas::copy_scalar( &zero, bm_attr);
314  Rocblas::copy_scalar( &zero, r_attr);
315 
316  // Initialize disps to 0
317  std::vector< COM::Pane*> allpanes;
318  _wrk_window->panes(allpanes);
319  for(int i =0, local_npanes = allpanes.size();
320  i<local_npanes; ++i){
321  Vector_3<double> *ds = reinterpret_cast<Vector_3<double>*>
322  ( allpanes[i]->attribute(disps_id)->pointer());
323  for(int i =0, ni = allpanes[i]->size_of_real_nodes(); i<ni; ++i){
324  ds[i] = Vector_3<double>(0.0,0.0,0.0);
325  }
326  }
327 
328  // Loop through the panes and its real faces, calculate A, b, and c = sum_i(wi)
329  std::vector< COM::Pane*>::iterator it = allpanes.begin();
330  SURF::Window_manifold_2::PM_iterator pm_it=_wm->pm_begin();
331  for ( int i=0, local_npanes = allpanes.size();
332  i<local_npanes; ++i, ++it, ++pm_it) {
333  COM::Pane *pane = *it;
334 
335  // Obtain nodal coordinates of current pane, assuming contiguous layout
336  const Vector_3<double> *pnts = reinterpret_cast<Vector_3<double>*>
337  (pane->attribute(COM_NC)->pointer());
338  Vector_3<double> *nrms = reinterpret_cast<Vector_3<double>*>
339  ( pane->attribute(facenormals_id)->pointer());
340 
341  // Obtain pointers to A_attr, bm_attr, and r_attr
342  Vector_3<double> *As = reinterpret_cast<Vector_3<double>*>
343  ( pane->attribute(A_attr->id())->pointer());
344  Vector_3<double> *bs_m = reinterpret_cast<Vector_3<double>*>
345  ( pane->attribute(bm_attr->id())->pointer());
346  Vector_3<double> *aws = reinterpret_cast<Vector_3<double>*>
347  ( pane->attribute(aw_attr->id())->pointer());
348  Vector_3<double> *uws = reinterpret_cast<Vector_3<double>*>
349  ( pane->attribute(uw_attr->id())->pointer());
350  double *rs = reinterpret_cast<double*>
351  ( pane->attribute(r_attr->id())->pointer());
352  Vector_3<double> *cnts = reinterpret_cast<Vector_3<double>*>
353  ( pane->attribute(facecenters_id)->pointer());
354 
355  // Loop through real elements of the current pane
356  Element_node_enumerator ene( pane, 1);
357  for ( int j=0, nj=pane->size_of_real_elements(); j<nj; ++j, ene.next()) {
358  // If speed is uniform within a face, then unit normal is the same
359  // after propagation.
360  const Vector_3<double> &ns_nz = nrms[j];
361  Vector_3<double> nrm = ns_nz;
362 
363  int ne = ene.size_of_edges();
364  int uindex=ene[ne-1]-1, vindex=ene[0]-1;
365 
366  // Loop through all vertices of current face.
367  for ( int k=0; k<ne; ++k) {
368  int windex = ene[(k+1==ne)?0:k+1]-1;
369 
370  Vector_3<double> cnt = cnts[j];
371 
372  // Calculate the weight of the current face for this node.
373  double w=1;
374 
375 
376  Vector_3<double> ts[2] = { pnts[uindex]-pnts[vindex],
377  pnts[windex]-pnts[vindex]};
378 
379  double s = std::sqrt((ts[0]*ts[0])*(ts[1]*ts[1]));
380  double angle=0;
381  if ( s>=0) {
382  double cosw = ts[0]*ts[1]/s;
383  if (cosw>1) cosw=1; else if ( cosw<-1) cosw=-1;
384  angle = std::acos( cosw);
385  }
386 
387  if ( _wght_scheme!=SURF::E2N_ONE) {
388 
389  switch ( _wght_scheme) {
390  case SURF::E2N_ANGLE:
391  case SURF::E2N_SPHERE: {
392 
394  w = std::sin(angle)/s;
395  else if ( w>half_pi)
396  w = std::max(0.,pi-angle);
397  else
398  w = angle;
399  break;
400  }
401  case SURF::E2N_AREA: {
402  w = Vector_3<double>::cross_product(ts[0],ts[1]).norm()/2.; break;
403  }
404  }
405  nrm = w*ns_nz;
406  }
407 
408  // Obtain the addresses of the linear system and weight
409  Vector_3<double> *A_v = &As[3*vindex];
410  Vector_3<double> &b_mv = bs_m[vindex];
411  Vector_3<double> &aw = aws[vindex];
412  Vector_3<double> &uw = uws[vindex];
413  double &r_v = rs[vindex];
414 
415  // Update A, b_m, and r for the current vertex
416  A_v[0] += ns_nz[0]*nrm;
417  A_v[1] += ns_nz[1]*nrm;
418  A_v[2] += ns_nz[2]*nrm;
419  b_mv -= nrm;
420  aw += (std::sin(angle)/s)*ns_nz;
421  uw += ns_nz;
422  r_v += angle;
423 
424  // Update indices for next node
425  uindex=vindex; vindex=windex;
426  }
427 
428 #if defined(BOUNDARY_TREATMENT) && BOUNDARY_TREATMENT
429  // Loop through the halfedges of the face to handle border edges
430  Halfedge h( &*pm_it, Edge_ID(j+1,0), SURF::REAL_PANE), h0=h;
431  do {
432  if ( h.is_border()) {
433  // Incorporate normal plane passing through the border edge into
434  // its incident vertices with weight pi/2.
435  Vector_3<double> nrm_nz = Vector_3<double>::cross_product( ns_nz, h.tangent()).normalize();
436  Vector_3<double> nrm = half_pi*nrm_nz;
437 
438  // Update the origin and destination of h with the orthogonal pane
439  for ( int k=0; k<2; ++k) {
440  int vindex = ene[ (k?h:h.next()).id().lid()]-1;
441  // Obtain the addresses of the linear system and weight
442  Vector_3<double> *A_v = &As[3*vindex];
443  Vector_3<double> &b_mv = bs_m[vindex];
444  double &r_v = rs[vindex];
445 
446  // Update A, b_m, and r for the current vertex.
447  // No need to update as sigma is 0 for it.
448  A_v[0] += nrm_nz[0]*nrm;
449  A_v[1] += nrm_nz[1]*nrm;
450  A_v[2] += nrm_nz[2]*nrm;
451  b_mv -= nrm;
452  r_v += half_pi;
453  }
454  }
455  } while ( (h=h.next()) != h0);
456 #endif
457  }
458  }
459 
460  // Reduce on shared nodes for A, b_m, and r
461  _wm->reduce_on_shared_nodes( A_attr, SURF::Window_manifold_2::OP_SUM);
462  _wm->reduce_on_shared_nodes( bm_attr, SURF::Window_manifold_2::OP_SUM);
463  _wm->reduce_on_shared_nodes( aw_attr, SURF::Window_manifold_2::OP_SUM);
464  _wm->reduce_on_shared_nodes( uw_attr, SURF::Window_manifold_2::OP_SUM);
465  _wm->reduce_on_shared_nodes( r_attr, SURF::Window_manifold_2::OP_SUM);
466 
467  // Loop through the panes and its real vertices
468  it = allpanes.begin();
469  for (int i=0, local_npanes = allpanes.size(); i<local_npanes; ++i, ++it) {
470 
471  COM::Pane *pane = *it;
472 
473  // Obtain pointers to A_attr, bo_attr, bm_attr, and r_attr
474  Vector_3<double> *As = reinterpret_cast<Vector_3<double>*>
475  ( pane->attribute(A_attr->id())->pointer());
476  Vector_3<double> *bs_m = reinterpret_cast<Vector_3<double>*>
477  ( pane->attribute(bm_attr->id())->pointer());
478  double *rs = reinterpret_cast<double*>
479  ( pane->attribute(r_attr->id())->pointer());
480  int *tranks = reinterpret_cast<int*>
481  ( pane->attribute(tangranks_id)->pointer());
482  int *cranks = reinterpret_cast<int*>
483  ( pane->attribute(cntnranks_id)->pointer());
484  Vector_3<double> *cvecs = reinterpret_cast<Vector_3<double>*>
485  ( pane->attribute(cntnvecs_id)->pointer());
486  int *cnstrs = _cnstr_types?reinterpret_cast<int*>
487  ( pane->attribute(_cnstr_types->id())->pointer()):NULL;
488  Vector_3<double> *cnstr_dirs = _cnstr_dirs?reinterpret_cast<Vector_3<double>*>
489  ( pane->attribute(_cnstr_dirs->id())->pointer()):NULL;
490  Vector_3<double> *vnrms = reinterpret_cast<Vector_3<double>*>
491  ( pane->attribute(vnormals_id)->pointer());
492  Vector_3<double> *awnrms = reinterpret_cast<Vector_3<double>*>
493  ( pane->attribute(awnormals_id)->pointer());
494  Vector_3<double> *uwnrms = reinterpret_cast<Vector_3<double>*>
495  ( pane->attribute(uwnormals_id)->pointer());
496 
497 
498  // Loop through all real nodes of the pane
499  //std::cout << "Number of nodes = " << pane->size_of_real_nodes() << std::endl;
500  for ( int j=0, jn=pane->size_of_real_nodes(); j<jn; ++j) {
501 
502  // Skip vertices with zero weight, such as those at
503  // edge- and face-centers for quadratic elements
504  if ( rs[j]==0) continue;
505  Vector_3<double> *es = &As[3*j]; // eigen-vectors of current vertex.
506  Vector_3<double> *cs = &cvecs[2*j]; // cnstr-tangent of current vertex.
507  // Make copy of matrix A as it will be overwritten by eigenvectors
508  Vector_3<double> A_v[3] = {es[0], es[1], es[2]};
509  // Likewise, b will be overwritten by eigenvalues
510  Vector_3<double> b_v = bs_m[j];
511  awnrms[j].normalize();
512  uwnrms[j].normalize();
513 
514 
515  // Perform eigen-analysis for the vertex using medial quadric
516  // orank is the rank of the orthogonal (primar) space of A.
517  // The non-constrained solution is stored in vnrm.
518  int orank = eigen_analyze_vertex( es, bs_m[j], &vnrms[j], 2*pi-rs[j]);
519  // EDIT
520  //orank = (orank == 3) ? 2 : orank;
521 
522  //COM_assertion_msg((orank <=3) && (orank >= 1), "Orank is invalid\n");
523 
524  // Store the rank of the tangent space.
525  tranks[j] = 3-orank;
526 
527  // Copy eigenvectors into cvecs.
528  for ( int k=tranks[j]-1; k>=0; --k)
529  cs[k] = es[orank+k];
530 
531  // Compute normal estimate using medial quadric,
532  // and save it into vnrms (overwrite the non-constrained solution)
533  Vector_3<double> d(0,0,0);
534  // Set the tolerance to avoid perturbation due to small eigenvalues
535  double tol = bs_m[j][0]*5.e-3;
536  for ( int k=0; k<orank; ++k)
537  d += (es[k]*b_v/-std::max(bs_m[j][k],tol))*es[k];
538  vnrms[j] = d;
539  }
540  }
541  if(_verb > 1)
542  std::cout << "Exiting Rocmop::compute_medial_quadric" << std::endl;
543 }
int eigen_analyze_vertex(Vector_3< double > A_io[3], Vector_3< double > &b_io, Vector_3< double > *nrm_nz, double angle_defect)
subroutine rs(nm, n, a, w, matz, z, fv1, fv2, ierr)
An adaptor for enumerating node IDs of an element.
const NT & d
static const double half_pi
Definition: smooth_medial.C:42
j indices k indices k
Definition: Indexing.h:6
char _wght_scheme
Weighting scheme.
Definition: Rocmop.h:419
double s
Definition: blastest.C:80
MAP::Facet_ID Edge_ID
Definition: Manifold_2.h:49
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
double sqrt(double d)
Definition: double.h:73
Vector_3 & normalize()
Definition: mapbasic.h:114
static const double pi
Definition: smooth_medial.C:43
NT & sin
blockLoc i
Definition: read.cpp:79
double angle(Vector_3< double > v1, Vector_3< double > v2)
Compute the angle between two vectors.
Definition: geometry.C:61
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
static Vector_3 cross_product(const Vector_3 &v, const Vector_3 &w)
Definition: mapbasic.h:104
int _verb
Verbose level.
Definition: Rocmop.h:453
static void copy_scalar(const void *x, Attribute *y)
Operation wrapper for copy (x is a scalar pointer).
Definition: op2args.C:583
j indices j
Definition: Indexing.h:6
COM::Attribute * _cnstr_dirs
Stores directions of nodal contraints.
Definition: Rocmop.h:425
const COM::Attribute * _cnstr_types
Stores types of nodal constraints.
Definition: Rocmop.h:424
CImg< _cimg_Tfloat > acos(const CImg< T > &instance)
Definition: CImg.h:6051
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
Type norm() const
Definition: mapbasic.h:112

Here is the call graph for this function:

Here is the caller graph for this function:

void compute_medial_quadric ( )
protected

Compute medial quadric for every vertex.

void compute_medial_quadric ( )
protected

Compute medial quadric for every vertex.

void constrain_displacements ( COM::Attribute *  w_disp)
protected

Contrain displacements to _maxdisp.

Definition at line 1424 of file Rocmop_1.C.

References Rocblas::div_scalar(), i, j, MPI_MAX, ni, nj, Vector_3< Type >::norm(), and nvc::norm().

1424  {
1425 #ifdef ROCPROF
1426  Profile_begin("Rocmop::const_disp");
1427 #endif
1428 
1429  if(_maxdisp > 0.0){
1430 
1431  int disp_id = w_disp->id();
1432  double max_norm = 0.0;
1433 
1434  std::vector<Pane*> allpanes;
1435  const_cast<COM::Window*>(_usr_window)->panes(allpanes);
1436 
1437  for(int i=0,ni = allpanes.size(); i<ni; ++i){
1438 
1439  Vector_3<double> *ptr = NULL;
1440  COM::Attribute* ptr_att = allpanes[i]->attribute(disp_id);
1441  void* void_ptr = ptr_att->pointer();
1442  ptr = reinterpret_cast<Vector_3<double>*>(void_ptr);
1443 
1444  for(int j=0,nj = allpanes[i]->size_of_real_nodes(); j<nj; ++j){
1445  double norm = ptr[j].norm();
1446  if(norm > max_norm)
1447  max_norm = norm;
1448  }
1449  }
1450 
1451  agree_double(max_norm,MPI_MAX);
1452 
1453  if(max_norm > _maxdisp){
1454  double div = max_norm/_maxdisp;
1455  Rocblas::div_scalar(const_cast<const COM::Attribute*>(w_disp),&div,w_disp);
1456  }
1457  }
1458 #ifdef ROCPROF
1459  Profile_end("Rocmop::const_disp");
1460 #endif
1461 }
static void div_scalar(const Attribute *x, const void *y, Attribute *z, int swap=0)
Operation wrapper for division with y as a scalar pointer.
Definition: op3args.C:363
float _maxdisp
Maximum displacement allowed.
Definition: Rocmop_1.h:512
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
T norm(const NVec< DIM, T > &v)
blockLoc i
Definition: read.cpp:79
void agree_double(double &val, MPI_Op op)
Agree on a double value across all panes.
Definition: Rocmop.h:240
j indices j
Definition: Indexing.h:6
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
Type norm() const
Definition: mapbasic.h:112

Here is the call graph for this function:

void constrain_displacements ( COM::Attribute *  w_disp)
protected

Contrain displacements to _maxdisp.

void determine_pane_border ( )

Determine which nodes and elements are on pane borders.

void determine_pane_border ( )

Determine which nodes and elements are on pane borders.

Definition at line 603 of file Rocmop.C.

References i.

603  {
604  if(_verb)
605  std::cout << "Entering Rocmop::determine_pane_border" << std::endl;
606 
607  std::vector<const COM::Pane*> allpanes;
608  _wrk_window->panes(allpanes);
609  int local_npanes = (int)allpanes.size();
610 
611  _is_pane_bnd_node.resize(local_npanes);
612  _is_pane_bnd_elem.resize(local_npanes);
613 
614  for(int i=0; i< local_npanes; ++i){
615  int size_of_real_nodes = allpanes[i]->size_of_real_nodes();
616  int size_of_real_elems = allpanes[i]->size_of_real_elements();
617  _is_pane_bnd_node[i].resize(size_of_real_nodes,0);
618 
619  std::vector<bool> is_isolated; // is a node isolated?
620  MAP::Pane_boundary pb (allpanes[i]);
621  pb.determine_border_nodes(_is_pane_bnd_node[i], is_isolated);
622  }
623 
625 
626  if(_verb > 1)
627  std::cout << "Exiting Rocmop::determine_pane_border" << std::endl;
628 }
std::vector< std::vector< bool > > _is_pane_bnd_node
Is the node on the pane boundary?
Definition: Rocmop.h:435
std::vector< std::vector< bool > > _is_pane_bnd_elem
Does the element contain nodes on the pane boundary?
Definition: Rocmop.h:436
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
int _verb
Verbose level.
Definition: Rocmop.h:453
void mark_elems_from_nodes(std::vector< std::vector< bool > > &marked_nodes, std::vector< std::vector< bool > > &marked_elems)
Mark the nodes which contain marked elems.
Definition: Rocmop.C:712
void determine_pane_border ( )

Determine which nodes and elements are on pane borders.

void determine_physical_border ( COM::Attribute *  w_is_surface)

Determine which nodes are on the physical border.

void determine_physical_border ( COM::Attribute *  w_is_surface)

Determine which nodes are on the physical border.

Definition at line 473 of file smooth_mesquite_ng.C.

References COM_assertion_msg, COM_compatible_types(), COM_INT, COM_PCONN, else, i, j, k, max(), nj, nk, Rocmap::reduce_maxabs_on_shared_nodes(), total_npanes, and Rocmap::update_ghosts().

473  {
474  COM_assertion_msg( w_is_surface, "Unexpected NULL pointer");
475  COM_assertion_msg( COM_compatible_types( w_is_surface->data_type(), COM_INT),
476  "Surface-list must have integer type");
477  COM_assertion_msg( w_is_surface->is_nodal() == 1,
478  "Surface-list must be nodal");
479  COM_assertion_msg( w_is_surface->size_of_components() == 1,
480  "Surface-list must have a single component");
481  int w_is_surface_id = w_is_surface->id();
482 
483  // This function is implemented as follows:
484  // 0 Declare and resize data structures.
485  //
486  // Loop through panes
487  // 1 Get the pane boundary nodes and faces using Rocmap::Pane_boundary
488  // 2 Identify adjacent panes, and shared nodes. Also, create an id mappings
489  // from a node's id to its index in the shared node array and vice versa.
490  // 3 Identify "possibly shared faces", those faces whose nodes are all
491  // shared with the same adjacent pane. Make a list of these faces.
492  // 4 Communicate the size of the local face list to send to / recieve from
493  // adjacent panes.
494  // 5 Create buffers for the incoming face list and communicate faces lists.
495  // 6 For every face received, remove any matching faces in the list of
496  // boundary faces.
497  // 7 Mark all nodes still contained in boundary faces as physical boundary
498  // nodes.
499 
500 
501  // 0 Declare and resize data structures.
502 
503  // vector corresponds to adjacent panes (reused amongst local panes)
504  std::vector<bool> is_border; // is a node a border node?
505  std::vector<bool> is_shared; // is a node a shared node?
506  std::vector<bool> is_isolated; // is a node isolated?
507  std::vector<MAP::Facet_ID> border_facet_list;
508 
509  // Space in which false pconns are built. (reused amongs local panes)
510  // outside vectors correspond to adjacent panes
511  // inside vectors correspond to connectivity information
512  //std::vector<std::vector<int> > false_pconn;
513 
514  // Per-local-pane data structures
515  // outside vectors correspond to the local panes
516  // inside vectors correspond to adjacent panes
517  std::vector<std::set<MAP::Facet_ID> > border_facets; // List of all border faces.
518  std::vector<std::vector<Corners2Face_Map> > maybe_shared; // Possibly shared facets
519  std::vector<std::vector<Id_Map > > lid2ind; // map from local id to pconn index
520  std::vector<std::vector<Id_Map > > ind2lid; // map from pconn index to local id
521  std::vector<std::vector<std::set<int> > > adj_pane_set; // nodes shared with adjacent panes
522  std::vector<std::vector<int> > adj_pane_id; // ids of adjacent panes
523  std::vector<std::vector<int> > adj_pane_recv; // amount of data coming from adjacent panes.
524 
525  // The amount of data to be sent by each pane
526  std::vector<int> send_sizes;
527 
528  std::set<MAP::Facet_ID>::iterator bf_it, bf_it2;
529  Id_Map::iterator idm_it,idm_it2; // iterator for lid2ind or ind2lid
530  Corners2Face_Map::iterator ms_it,ms_it2;
531  std::set<int >::iterator aps_it, aps_it2; //iterator for adj_pane_map
532 
533  // get the pconn offset
534  int pconn_offset = MAP::Pane_connectivity::pconn_offset();
535 
536  // Resize per-local-pane data structures
537  std::vector<COM::Pane*> allpanes;
538  COM::Window * wrk_window = w_is_surface->window();
539  wrk_window->panes(allpanes);
540  int total_npanes = (int)allpanes.size();
541  border_facets.resize(total_npanes);
542  maybe_shared.resize(total_npanes);
543  lid2ind.resize(total_npanes);
544  ind2lid.resize(total_npanes);
545  adj_pane_set.resize(total_npanes);
546  adj_pane_id.resize(total_npanes);
547  adj_pane_recv.resize(total_npanes);
548  send_sizes.resize(total_npanes);
549 
550  // Register an attribute for our fake pconn.
551  COM::Attribute * false_pconn = wrk_window->new_attribute("false_pconn", 'p', COM_INT, 1, "");
552 
553  // Register an attribute for sending and receiving sizes
554  // also used for sending buffer
555  COM::Attribute *com_buff = wrk_window->new_attribute("com_buff", 'p', COM_INT, 1,"");
556  int w_com_buff_id = com_buff->id();
557 
558  // Loop through panes
559  for(int i=0; i<total_npanes; ++i){
560  int size_of_real_nodes = allpanes[i]->size_of_real_nodes();
561  is_border.clear();
562  is_shared.clear();
563  is_isolated.clear();
564  is_border.resize(size_of_real_nodes,0);
565  is_shared.resize(size_of_real_nodes,0);
566  is_isolated.resize(size_of_real_nodes,0);
567  send_sizes[i] = 0;
568 
569  // 1 Get the pane boundary nodes and faces using Rocmap::Pane_boundary
570  // Determine the border nodes.
571  MAP::Pane_boundary pb(allpanes[i]);
572  pb.determine_border_nodes(is_border, is_isolated, &border_facet_list);
573 
574  // put the list of border facets into a set for faster searching
575  for(int j =0, nj=border_facet_list.size(); j<nj; ++j)
576  border_facets[i].insert(border_facet_list[j]);
577 
578  // 2 Identify adjacent panes, and shared nodes. Also, create an id mappings
579  // from a node's id to its index in the shared node array and vice versa.
580 
581  // Obtain the pane connectivity of the local pane
582  const COM::Attribute *pconn = allpanes[i]->attribute(COM::COM_PCONN);
583  const int *vs = (const int*)pconn->pointer() + pconn_offset;
584  int vs_size = pconn->size_of_real_items() - pconn_offset;
585 
586  // Determine the number of communicating panes for shared nodes.
587  int count=0;
588  for (int j=0, nj=vs_size; j<nj; j+=vs[j+1]+2) {
589  if (wrk_window->owner_rank( vs[j]) >=0) ++count;
590  }
591 
592  // Resize per-adjacent-pane data structures
593  //false_pconn.resize(count);
594  maybe_shared[i].resize(count);
595  lid2ind[i].resize(count);
596  ind2lid[i].resize(count);
597  adj_pane_set[i].resize(count);
598  adj_pane_id[i].resize(count);
599  adj_pane_recv[i].resize(count);
600 
601  int index = 0;
602  // Loop through communicating panes for shared nodes.
603  for ( int j=0; j<count; ++j, index+=vs[index+1]+2) {
604  // We skip the panes that are not in the current window
605  while ( wrk_window->owner_rank(vs[index])<0) {
606  index+=vs[index+1]+2;
607  COM_assertion_msg( index<=vs_size, "Invalid communication map");
608  }
609  adj_pane_id[i][j] = vs[index];
610  // Add this pane to current shared node's list, mark node as shared and
611  // keep track of the mapping between array index and local node id
612  for(int k=0; k<vs[index+1]; ++k){
613  is_shared[vs[index+2+k]-1]=1;
614  adj_pane_set[i][j].insert(vs[index+2+k]);
615  lid2ind[i][j].insert(std::make_pair(vs[index+2+k],k));
616  ind2lid[i][j].insert(std::make_pair(k,vs[index+2+k]));
617  }
618  }
619 #if 0
620 
621  std::cout << "Pane " << allpanes[i]->id() << " lid2ind = \n";
622  for(int j=0; j < count; ++j){
623  std::cout << " to Pane " << adj_pane_id[i][j] << " =\n";
624  for(int k =0; k < ind2lid[i][j].size();++k){
625  std::cout << "(" << k << "," << ind2lid[i][j][k] << ") ";
626  }
627  std::cout << "\n";
628  }
629  std::cout << "Pane " << i << "\n"
630  << " shared nodes = \n";
631 
632  for(int j=0; j<is_shared.size(); ++j){
633  if(is_shared[j])
634  std::cout << j+1 << " ";
635  }
636  std::cout << "\n\n nodes shared with othe panes";
637 
638  aps_it = adj_pane_set[i][0].begin();
639  for(; aps_it != adj_pane_set[i][0].end(); ++aps_it){
640  std::cout << *aps_it << " ";
641  }
642 
643 #endif
644 
645  // 3 Identify "possibly shared faces", those faces whose nodes are all
646  // shared with the same adjacent pane. Make a list of these faces.
647 
648  bf_it2 = border_facets[i].end();
649  bf_it = border_facets[i].begin();
650  //for(int j=0, nj=border_facets[i].size(); j<nj; ++j){
651  for(; bf_it != bf_it2; ++bf_it){
652  Element_node_enumerator ene(allpanes[i], (*bf_it).eid());
653  Facet_node_enumerator fne (&ene, (*bf_it).lid());
654  //if all the nodes are shared
655  if( is_shared[fne[0]-1] &&
656  is_shared[fne[1]-1] &&
657  is_shared[fne[2]-1] &&
658  fne.size_of_edges()>3?is_shared[fne[3]-1]:1
659  ){
660  // then see if they are all shared by the same panes
661  Four_tuple ns( fne[0], fne[1], fne[2], fne.size_of_edges()>3?fne[3]:-1);
662  for(int k=0; k<count; ++k){
663  aps_it2 = adj_pane_set[i][k].end();
664  if(aps_it2 != adj_pane_set[i][k].find(fne[0]) &&
665  aps_it2 != adj_pane_set[i][k].find(fne[1]) &&
666  aps_it2 != adj_pane_set[i][k].find(fne[2]) &&
667  (fne.size_of_edges()>3?(adj_pane_set[i][k].find(fne[3]) != aps_it2):1)){
668  // and if they are
669  // then this facet is possibly shared with the adjacent node
670  Four_tuple ns( fne[0], fne[1], fne[2], fne.size_of_edges()>3?fne[3]:-1);
671  std::sort(&ns[0],&ns[4]);
672  maybe_shared[i][k].insert(std::make_pair(ns,(*bf_it)));
673  }
674  }
675  }
676  }
677 
678 #if 0
679  // print out the list of possibly shared nodes:
680  std::cout << "Pane " << allpanes[i]->id() << " possibly shared panes\n";
681  for(int j = 0; j<count; ++j){
682  std::cout << " faces possibly shared with Pane " << adj_pane_id[i][j] << "\n";
683  ms_it2 = maybe_shared[i][j].end();
684  for(ms_it = maybe_shared[i][j].begin(); ms_it != ms_it2; ++ms_it){
685  std::cout << "(" << (ms_it->first)[0] << " "
686  << (ms_it->first)[1] << " "
687  << (ms_it->first)[2] << " "
688  << (ms_it->first)[3] << ") ";
689  }
690  std::cout << "\n";
691  }
692 #endif
693 
694  wrk_window->set_size("com_buff", allpanes[i]->id(), count, 0);
695  int* my_buff;
696  wrk_window->resize_array("com_buff", (const int)allpanes[i]->id(),
697  reinterpret_cast<void**>(&my_buff));
698 
699  // find the size of the pconn to create
700  // 3*(pconn_offset) // number of communicating blocks
701  // + 3 // shared node block
702  // + 6*count // (pane id,node count,array-id for each adj. pane)*2blocks
703 
704  int my_size = 3*pconn_offset + 3 + 6*count;
705  int* my_pconn;
706  wrk_window->set_size("false_pconn", allpanes[i]->id(), my_size,
707  my_size-(3+pconn_offset));
708  wrk_window->resize_array("false_pconn", (const int)allpanes[i]->id(),
709  reinterpret_cast<void**>(&my_pconn));
710  // Add shared node data
711  if(pconn_offset){my_pconn[0]=1;++my_pconn;}
712  my_pconn[0]=1; my_pconn[1]=1; my_pconn[2]=1;
713  my_pconn += 3;
714 
715  // filling in send buffer and real nodes to send info.
716  if(pconn_offset){my_pconn[0]=count;++my_pconn;}
717  for(int j=0; j<count; ++j){
718  // print communicating pane id
719  my_pconn[0] = adj_pane_id[i][j];
720  // print number of ints to communicate
721  my_pconn[1] = 1;
722  // print index-id of information
723  my_pconn[2] = j+1;
724  my_pconn+=3;
725  // store size of information to send
726  my_buff[j] = 4*maybe_shared[i][j].size();
727  send_sizes[i] += my_buff[j];
728  }
729 
730  // add ghost nodes to receive info.
731  if(pconn_offset){my_pconn[0]=count;++my_pconn;}
732  for(int j=0; j<count; ++j){
733  my_pconn[0] = adj_pane_id[i][j];
734  my_pconn[1] = 1;
735  my_pconn[2] = j+1;
736  my_pconn+=3;
737  }
738 
739 #if 0
740  for ( int j=0; j<count; ++j, index+=vs[index+1]+2) {
741  // We skip the panes that are not in the current window
742  while ( wrk_window->owner_rank(vs[index])<0)
743  index+=vs[index+1]+2;
744  // List the communicating pane, 1 item to send, and the index of that item in a
745  // local panel array
746  my_pconn[3*j] = vs[index];
747  my_pconn[3*j+1] = 1;
748  my_pconn[3*j+2] = j+1;
749 
750  my_pconn[3*(count+j)+pconn_offset] = vs[index];
751  my_pconn[3*(count+j)+1+pconn_offset] = 1;
752  my_pconn[3*(count+j)+2+pconn_offset] = j+1;
753 
754  my_pconn[3*(2*count+j)+2*pconn_offset] = vs[index];
755  my_pconn[3*(2*count+j)+1+2*pconn_offset] = 1;
756  my_pconn[3*(2*count+j)+2+2*pconn_offset] = j+1;
757 
758 
759  // store the size of the buffer to send across
760  my_buff[j] = 4*maybe_shared[i][j].size();
761  send_sizes[i] += my_buff[j];
762  }
763 #endif
764 #if 0
765  std::cout << "pconn_offset = " << pconn_offset << "\n";
766  std::cout << "total size = " << my_size << "\n";
767  std::cout << "ghost sized = " << my_size - pconn_offset << "\n\n";
768 #endif
769  }
770  wrk_window->init_done();
771 
772 #if 0
773  //print out pconn, for debugging.
774  for(int i=0; i<total_npanes; ++i){
775  std::cout << "FALSE pconn for pane " << allpanes[i]->id() << std::endl;
776  COM::Attribute *my_pconn = allpanes[i]->attribute(w_false_pconn_id);
777  int* ptr = (int*)my_pconn->pointer();
778  for(int k=0,nk=my_pconn->size_of_items();k<nk;++k){
779  std::cout << ptr[k] << " ";
780  }
781  std::cout << "\n\n";
782 
783  // print out size of buffer being sent across
784  std::cout << "size of face list\n";
785  COM::Attribute *my_bsize = allpanes[i]->attribute(w_com_buff_id);
786  ptr = (int*)my_bsize->pointer();
787  for(int j =0; j<my_bsize->size_of_items(); ++j)
788  std::cout << ptr[j] << " ";
789  std::cout << "\n\n";
790  }
791 #endif
792 
793  // 4 Communicate the size of the local face list to send to / recieve from
794  // adjacent panes.Pane_connectivity::
795  Rocmap::update_ghosts(com_buff,
796  false_pconn);
797 
798  //print out pconn, for debugging.
799 #if 0
800  for(int i=0; i<total_npanes; ++i){
801  COM::Attribute *my_pconn = allpanes[i]->attribute(w_false_pconn_id);
802  int* ptr = (int*)my_pconn->pointer();
803  for(int k=0,nk=my_pconn->size_of_items();k<nk;++k){
804  std::cout << ptr[k] << " ";
805  }
806  std::cout << "\n\n";
807  // print out possibly shared faces
808  std::cout << "possibly shared faces\n";
809  for(ms_it = maybe_shared[i][0].begin(), ms_it2 = maybe_shared[i][0].end();
810  ms_it != ms_it2; ++ms_it){
811  std::cout << "("
812  << (ms_it->first)[0] << " "
813  << (ms_it->first)[1] << " "
814  << (ms_it->first)[2] << " "
815  << (ms_it->first)[3] << ") ";
816  }
817  std::cout << "\n\n";
818  // print out size of buffer being sent across
819  std::cout << "size of communicated face list\n";
820  COM::Attribute *my_bsize = allpanes[i]->attribute(w_com_buff_id);
821  ptr = (int*)my_bsize->pointer();
822  for(int j =0; j <adj_pane_id[i].size(); ++j)
823  std::cout << ptr[j] << " ";
824  std::cout << "\n\n";
825  }
826 #endif
827 
828  // 5 Create buffers for the incoming face list and communicate faces lists.
829  // loop through panes
830  for(int i=0; i<total_npanes; ++i){
831 
832  // get pane level attributes and pointers
833  COM::Attribute *p_com_buff = allpanes[i]->attribute(w_com_buff_id);
834  int *com_buff_ptr = (int*)p_com_buff->pointer();
835 
836  // find the number of adjacent panes
837  int count = adj_pane_id[i].size();
838 
839  // find the size of data to be received and sent.
840  int recv_size = 0;
841  // add up the sizes of all the buffers being sent
842  for(int j=0; j< count; ++j){
843  recv_size += com_buff_ptr[j];
844  adj_pane_recv[i][j] = com_buff_ptr[j];
845  }
846  int send_size = send_sizes[i];
847 
848  // find the size of the pconn to create
849  // 3*(pconn_offset) // number of communicating blocks
850  // + 3 // shared node block
851  // + 4*count // (pane id and node count for each adj. pane)*2blocks
852  // + recv_size+send_size // number of nodes in facet lists
853  int pconn_size = 3*(pconn_offset)+3+4*count+recv_size+send_size;
854 
855 #if 0
856 
857  std::cout << " SIZES\nrecv_size = " << recv_size << " send_size = " << send_size
858  << " pconn size = " << pconn_size << "\n"
859  << " 3*pconn_offset = " << 3*pconn_offset
860  << " 4*count = " << 4*count << "\n\n";
861 
862 #endif
863 
864  wrk_window->set_size("com_buff", allpanes[i]->id(),std::max(send_size,recv_size),0);
865  wrk_window->resize_array("com_buff", (const int)allpanes[i]->id(),
866  reinterpret_cast<void**>(&com_buff_ptr));
867  int* pconn_ptr;
868  wrk_window->set_size("false_pconn", allpanes[i]->id(), pconn_size,
869  pconn_size - (3+pconn_offset));
870  wrk_window->resize_array("false_pconn", (const int)allpanes[i]->id(),
871  reinterpret_cast<void**>(&pconn_ptr));
872 
873  // add shared node data
874  if(pconn_offset){pconn_ptr[0]=1;++pconn_ptr;}
875  pconn_ptr[0]=1; pconn_ptr[1]=1; pconn_ptr[2]=1;
876  pconn_ptr += 3;
877 
878  // now fill in the send buffer and real nodes to send info. in the pconn
879  if(pconn_offset){pconn_ptr[0]=count;++pconn_ptr;}
880  int com_ind = 0; // index of next place in com_buff
881  for(int j =0; j<count; ++j){
882  pconn_ptr[0]=adj_pane_id[i][j];
883  pconn_ptr[1]=4*maybe_shared[i][j].size();
884  pconn_ptr+=2;
885  ms_it2 = maybe_shared[i][j].end();
886  for(ms_it = maybe_shared[i][j].begin(); ms_it != ms_it2;
887  ++ms_it, com_ind+=4, pconn_ptr+=4){
888  // Convert nodal id's to pconn based index id's and place in the comm buffer
889  const Four_tuple* ft = &(ms_it->first);
890  if ((*ft)[0]==-1)
891  com_buff_ptr[com_ind] = -1;
892  else
893  idm_it = lid2ind[i][j].find((*ft)[0]);
894  idm_it = lid2ind[i][j].find((*ft)[1]);
895  com_buff_ptr[com_ind+1] = idm_it->second;
896  idm_it = lid2ind[i][j].find((*ft)[2]);
897  com_buff_ptr[com_ind+2] = idm_it->second;
898  idm_it = lid2ind[i][j].find((*ft)[3]);
899  com_buff_ptr[com_ind+3] = idm_it->second;
900  std::sort(&com_buff_ptr[com_ind],&com_buff_ptr[com_ind+4]);
901  // Also fill in the pconn
902  pconn_ptr[0] = com_ind+1;
903  pconn_ptr[1] = com_ind+2;
904  pconn_ptr[2] = com_ind+3;
905  pconn_ptr[3] = com_ind+4;
906  }
907  }
908 
909  // now fill in the ghost nodes to receive info. in the pconn
910  if(pconn_offset){pconn_ptr[0]=count;++pconn_ptr;}
911  com_ind = 1;
912  for(int j=0; j<count; ++j){
913  pconn_ptr[0]=adj_pane_id[i][j];
914  pconn_ptr[1]=adj_pane_recv[i][j];
915  for(int k=0; k<adj_pane_recv[i][j]; ++k){
916  pconn_ptr[k+2] = k+com_ind;
917  }
918  com_ind += adj_pane_recv[i][j];
919  pconn_ptr += 2+adj_pane_recv[i][j];
920  }
921  }
922 
923 #if 0
924  //print out pconn, for debugging.
925  for(int i=0; i<total_npanes; ++i){
926  std::cout << "Facet list FALSE pconn for pane " << allpanes[i]->id() << std::endl;
927  COM::Attribute *my_pconn = allpanes[i]->attribute(w_false_pconn_id);
928  int* ptr = (int*)my_pconn->pointer();
929  for(int k=0,nk=my_pconn->size_of_items();k<nk;++k){
930  std::cout << ptr[k] << " ";
931  }
932  std::cout << "\n\n";
933 
934  std::cout << "Facet list buffer for pane " << allpanes[i]->id() << std::endl;
935  COM::Attribute *my_buff = allpanes[i]->attribute(w_com_buff_id);
936  ptr = (int*)my_buff->pointer();
937  for(int k=0,nk=my_buff->size_of_items();k<nk;++k){
938  std::cout << ptr[k] << " ";
939  }
940  std::cout << "\n\n";
941  }
942 #endif
943 
944  // update
945  Rocmap::update_ghosts(com_buff,
946  false_pconn);
947 
948 #if 0
949  //print out pconn, for debugging.
950  for(int i=0; i<total_npanes; ++i){
951  std::cout << "Updated Facet list buffer for pane " << allpanes[i]->id() << std::endl;
952  COM::Attribute *my_buff = allpanes[i]->attribute(w_com_buff_id);
953  int* ptr = (int*)my_buff->pointer();
954  for(int k=0,nk=my_buff->size_of_items();k<nk;++k){
955  std::cout << ptr[k] << " ";
956  }
957  std::cout << "\n\n";
958  }
959 #endif
960  // 6 For every face received, remove any matching faces in the list of
961  // boundary faces.
962  // loop through all panes
963  for(int i =0; i<total_npanes; ++i){
964  COM::Attribute *my_buff = allpanes[i]->attribute(w_com_buff_id);
965  int* buff_ptr = (int*)my_buff->pointer();
966 
967  int count = adj_pane_recv[i].size();
968  // loop through adjacent panes
969  //std::cout << "Pane " << allpanes[i]->id() << "\n";
970  for(int j=0;j<count; buff_ptr += adj_pane_recv[i][j], ++j){
971 
972  //std::cout << "Converting node array\n";
973  // convert all node array indices to local id
974  //std::cout << adj_pane_recv[i][j] << " items being converted\n";
975  for(int k=0, nk =adj_pane_recv[i][j]; k<nk; ++k){
976  if(buff_ptr[k]!=-1){
977  buff_ptr[k] = ind2lid[i][j][buff_ptr[k]];
978  }
979  }
980  // std::cout << "Checking for matching facets with pane" << adj_pane_id[i][j] << "\n";
981  // check for matching facets
982  ms_it2 = maybe_shared[i][j].end();
983  bf_it2 = border_facets[i].end();
984  for(int k=0, nk=adj_pane_recv[i][j]; k<nk; k+=4){
985  Four_tuple ns(buff_ptr[k],buff_ptr[k+1],buff_ptr[k+2],buff_ptr[k+3]);
986  std::sort(&ns[0],&ns[4]);
987  //std::cout << " (" << ns[0] << " " << ns[1] << " " << ns[2] << " " << ns[3] << ") ";
988  ms_it = maybe_shared[i][j].find(ns);
989  if(ms_it != ms_it2){
990  //std::cout << "found ";
991  Element_node_enumerator ene(allpanes[i], (ms_it->second).eid());
992  Facet_node_enumerator fne (&ene, (ms_it->second).lid());
993  //std::cout << "(" << fne[0] << " " << fne[1]
994  // << " " << fne[2];
995  // if(fne.size_of_edges()>3)
996  // std::cout << " " << fne[3];
997  //std::cout << ")\n";
998  MAP::Facet_ID fid = ms_it->second;
999  bf_it = border_facets[i].find(fid);
1000  if(bf_it != bf_it2)
1001  border_facets[i].erase(fid);
1002  }
1003  else
1004  ;
1005  //std::cout << "not found\n";
1006  }
1007  }
1008  }
1009 
1010  // std::cout << "On to step 7 \n";
1011 
1012  // 7 Mark all nodes still contained in boundary faces as physical boundary
1013  // nodes.
1014  for(int i =0; i < total_npanes; ++i){
1015  // std::cout << "Pane " << i << " detected surface faces\n";
1016  bf_it2 = border_facets[i].end();
1017  for(bf_it = border_facets[i].begin(); bf_it!= bf_it2; ++bf_it){
1018  Element_node_enumerator ene(allpanes[i], (*bf_it).eid());
1019  Facet_node_enumerator fne (&ene, (*bf_it).lid());
1020 
1021  //std::cout << "(" << fne[0] << " " << fne[1]
1022  // << " " << fne[2];
1023  // if(fne.size_of_edges()>3)
1024  // std::cout << " " << fne[3];
1025  //std::cout << ")";
1026  }
1027  //std::cout << "\n\n";
1028  }
1029 
1030  for(int i = 0; i < total_npanes; ++i){
1031  COM::Attribute *p_is_surface = allpanes[i]->attribute(w_is_surface_id);
1032  int* surf_ptr = (int*)p_is_surface->pointer();
1033  // initialize surface to 0s
1034  for(int j=0, nj= p_is_surface->size_of_items();j<nj; ++j){
1035  surf_ptr[j] = 0;
1036  }
1037  bf_it2 = border_facets[i].end();
1038  //std::cout << "Pane " << allpanes[i]->id() << " marking surface nodes\n";
1039  for(bf_it = border_facets[i].begin(); bf_it!= bf_it2; ++bf_it){
1040  Element_node_enumerator ene(allpanes[i], (*bf_it).eid());
1041  Facet_node_enumerator fne (&ene, (*bf_it).lid());
1042  surf_ptr[fne[0]-1] = 1;
1043  surf_ptr[fne[1]-1] = 1;
1044  surf_ptr[fne[2]-1] = 1;
1045  //std::cout << fne[0] << " " << fne[1] << " " << fne[2] << "\n";
1046  if(fne.size_of_edges()>3)
1047  surf_ptr[fne[3]-1] = 1;
1048  }
1049  // std::cout << "\n\n";
1050  }
1051 
1052 #if 0
1053  for(int i = 0; i < total_npanes; ++i){
1054  COM::Attribute *p_pconn = allpanes[i]->attribute(COM::COM_PCONN);
1055  // std::cout << "PANE " << allpanes[i]->id() << "'s real pconn size = "
1056  // << p_pconn->size_of_real_items() << " and ghost size = "
1057  // << p_pconn->size_of_items()-p_pconn->size_of_real_items() << "\n\n";
1058 
1059  //int* ptr = (int*)p_pconn->pointer();
1060  //for(int j=0, nj=p_pconn->size_of_items(); j<nj; ++j){
1061  // std::cout << ptr[j] << " ";
1062  //}
1063  // std::cout << "\n\n";
1064  }
1065 #endif
1066 
1067  // update
1069  Rocmap::update_ghosts(w_is_surface);
1070 
1071  // delete buffer and false pconn attributes
1072  wrk_window->delete_attribute(com_buff->name());
1073  wrk_window->delete_attribute(false_pconn->name());
1074 
1075 }
A structure used to represent element faces.
Definition: Pane_boundary.C:60
j indices k indices k
Definition: Indexing.h:6
#define COM_assertion_msg(EX, msg)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
const int total_npanes
Definition: ex1.C:94
static void reduce_maxabs_on_shared_nodes(COM::Attribute *att, COM::Attribute *pconn=NULL)
Perform a maxabs-reduction on the shared nodes for the given attribute.
Definition: Rocmap.C:77
int COM_compatible_types(COM_Type type1, COM_Type type2)
Definition: roccom_c++.h:563
blockLoc i
Definition: read.cpp:79
void int int * nk
Definition: read.cpp:74
static void update_ghosts(COM::Attribute *att, const COM::Attribute *pconn=NULL)
Update ghost nodal or elemental values for the given attribute.
Definition: Rocmap.C:87
j indices j
Definition: Indexing.h:6
void int * nj
Definition: read.cpp:74

Here is the call graph for this function:

void determine_physical_border ( )

Determine which nodes and elements are on the physical border.

void determine_physical_border ( )

Determine which nodes and elements are on the physical border.

Definition at line 677 of file Rocmop.C.

References COM_assertion_msg, i, and j.

677  {
678  if(_verb)
679  std::cout << "Entering Rocmop::determine_physical_border()" << std::endl;
680 
681  const std::string surf_attr("is_surface");
682  COM::Attribute* w_is_surface = _wrk_window->attribute(surf_attr);
683  COM_assertion_msg( w_is_surface, "Unexpected NULL pointer");
684  int is_surface_id = w_is_surface->id();
685 
686  std::vector<const COM::Pane*> allpanes;
687  _wrk_window->panes(allpanes);
688  int local_npanes = (int)allpanes.size();
689 
690  _is_pane_bnd_node.resize(local_npanes);
691 
692  for(int i=0; i < local_npanes; ++i){
693  _is_pane_bnd_node[i].resize(allpanes[i]->size_of_real_nodes());
694 
695  // get pane level pointer to physical border property.
696  const COM::Attribute *p_is_surface = allpanes[i]->attribute(is_surface_id);
697  int *is_surface_ptr = (int*)p_is_surface->pointer();
698 
699  // loop through real nodes
700  for(int j=0; j< allpanes[i]->size_of_real_nodes(); ++j){
701  if (is_surface_ptr[j])
702  _is_pane_bnd_node[i][j] = true;
703  }
704  }
705 
707 
708  if(_verb > 1)
709  std::cout << "Exiting Rocmop::determine_physical_border()" << std::endl;
710 }
std::vector< std::vector< bool > > _is_pane_bnd_node
Is the node on the pane boundary?
Definition: Rocmop.h:435
std::vector< std::vector< bool > > _is_pane_bnd_elem
Does the element contain nodes on the pane boundary?
Definition: Rocmop.h:436
#define COM_assertion_msg(EX, msg)
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
int _verb
Verbose level.
Definition: Rocmop.h:453
j indices j
Definition: Indexing.h:6
void mark_elems_from_nodes(std::vector< std::vector< bool > > &marked_nodes, std::vector< std::vector< bool > > &marked_elems)
Mark the nodes which contain marked elems.
Definition: Rocmop.C:712
void determine_physical_border ( COM::Attribute *  w_is_surface)

Determine which nodes are on the physical border.

void determine_physical_border ( )

Determine which nodes and elements are on the physical border.

void determine_shared_border ( )

Determine which nodes and elements are shared.

void determine_shared_border ( )

Determine which nodes and elements are shared.

Definition at line 631 of file Rocmop.C.

References COM_assertion_msg, COM_PCONN, i, j, k, nj, and Pane_connectivity::pconn_offset().

631  {
632  if(_verb)
633  std::cout << "Entering Rocmop::determine_shared_nodes" << std::endl;
634 
635  std::vector<const COM::Pane*> allpanes;
636  _wrk_window->panes(allpanes);
637  int local_npanes = (int)allpanes.size();
638 
639  _is_shared_node.resize(local_npanes);
640 
641  //First, get the list of shared nodes.
642  for(int i=0; i < (int)(local_npanes); ++i){
643  // Obtain the pane connectivity of the local pane.
644  const COM::Attribute *pconn = allpanes[i]->attribute(COM::COM_PCONN);
645  // Use the pconn offset
646  const int *vs = (const int*)pconn->pointer()+Pane_connectivity::pconn_offset();
647  int vs_size=pconn->size_of_real_items()-Pane_connectivity::pconn_offset();
648  _is_shared_node[i].resize(allpanes[i]->size_of_real_nodes(),0);
649 
650  // Determine the number of communicating panes for shared nodes.
651  int count=0;
652  for (int j=0, nj=vs_size; j<nj; j+=vs[j+1]+2) {
653  if (_wrk_window->owner_rank( vs[j]) >=0) ++count;
654  }
655 
656  int index = 0;
657  // Loop through communicating panes for shared nodes.
658  for ( int j=0; j<count; ++j, index+=vs[index+1]+2) {
659  // We skip the panes that are not in the current window
660  while ( _wrk_window->owner_rank(vs[index])<0) {
661  index+=vs[index+1]+2;
662  COM_assertion_msg( index<=vs_size, "Invalid communication map");
663  }
664  // Add shared nodes to the list
665  for(int k=0; k<vs[index+1]; ++k){
666  _is_shared_node[i][vs[index+2+k]-1] = 1;
667  }
668  }
669  }
670 
672 
673  if(_verb > 1)
674  std::cout << "Exiting Rocmop::determine_shared_nodes" << std::endl;
675 }
j indices k indices k
Definition: Indexing.h:6
#define COM_assertion_msg(EX, msg)
static int pconn_offset()
Retrieve an offset to avoid the number of communicating panes when reading a pconn attribute...
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
int _verb
Verbose level.
Definition: Rocmop.h:453
j indices j
Definition: Indexing.h:6
void int * nj
Definition: read.cpp:74
void mark_elems_from_nodes(std::vector< std::vector< bool > > &marked_nodes, std::vector< std::vector< bool > > &marked_elems)
Mark the nodes which contain marked elems.
Definition: Rocmop.C:712
std::vector< std::vector< bool > > _is_shared_elem
Does the element contain shared nodes?
Definition: Rocmop.h:432
std::vector< std::vector< bool > > _is_shared_node
Is the node shared?
Definition: Rocmop.h:431

Here is the call graph for this function:

void determine_shared_border ( )

Determine which nodes and elements are shared.

int eigen_analyze_vertex ( Vector_3< double >  A_io[3],
Vector_3< double > &  b_io,
Vector_3< double > *  nrm_nz,
double  angle_defect 
)
protected

Definition at line 1081 of file smooth_medial.C.

References _dir_thres, _eig_thres, _reorthog, _saliency_crn, NTS::abs(), cimg_library::atan(), compute_eigenvectors(), k, max(), Vector_3< Type >::normalize(), pi, sqrt(), and x.

Referenced by compute_medial_quadric().

1082  {
1083 
1084  // A_io will be replaced by its eigenvectors.
1085  Vector_3<double> *es = A_io;
1086 
1087  // Create a backup of b_io, as b_io will be replaced by eigenvalues.
1088  const Vector_3<double> b = b_io;
1089  Vector_3<double> &lambdas = b_io;
1090 
1091  // Compute the eigenvalues and eigenvectors of the matrix.
1092  // Note that lambdas will be in decreasing order!
1093  compute_eigenvectors( es, lambdas);
1094 
1095  int nrank;
1096  double eps = lambdas[0]*1.e-8;
1097  double gs[] = { b*es[0]/lambdas[0],
1098  b*es[1]/std::max(eps,lambdas[1]),
1099  b*es[2]/std::max(eps,lambdas[2]) };
1100  double gs_abs[] = {std::abs(gs[0]), std::abs(gs[1]), std::abs(gs[2])};
1101 
1102  // Classify offset intersection based on acos(-b.norm()/rv) and lambdas
1103  if ( lambdas[2] >= _saliency_crn *
1104  std::max(lambdas[0]-lambdas[1], lambdas[1]-lambdas[2]) || ad >= .5*pi)
1105  nrank = 3;
1106  else if ( gs_abs[1] >= gs_abs[0] || lambdas[0]*_dir_thres<lambdas[1]) {
1107  if ( lambdas[1] < lambdas[0]*_eig_thres) {
1108  lambdas[1] = lambdas[0]*_eig_thres;
1109  std::cerr << "Rocprop Warning: Mesh contains near cusp."
1110  << "lambdas[1]=" << lambdas[1] << " and lambdas[0]="
1111  << lambdas[0] << std::endl;
1112  }
1113  nrank = 2; // ridge vertex
1114 #if PRINT_FEATURE
1115  if ( gs_abs[1] < gs_abs[0]) {
1116  double theta = (360/pi)*std::atan(std::sqrt(lambdas[1]/lambdas[0]));
1117  if ( theta<fangle_min_eigen) fangle_min_eigen=theta;
1118  if ( theta>fangle_max_eigen) fangle_max_eigen=theta;
1119  }
1120 #endif
1121  }
1122  else
1123  nrank = 1; // smooth vertex
1124 
1125  if ( !_reorthog || nrank==1)
1126  *nrm_nz=( es[0]*b>0)?-es[0]:es[0];
1127  else {
1128  // Solve for x within primary space
1129  Vector_3<double> x(0,0,0);
1130  for ( int k=0; k<nrank; ++k) x -= gs[k]*es[k];
1131  *nrm_nz = x.normalize();
1132  }
1133  return nrank;
1134 }
j indices k indices k
Definition: Indexing.h:6
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
bool _reorthog
Reorthogonalize?
Definition: Rocmop.h:418
double _eig_thres
Eigenvalue thresholds.
Definition: Rocmop.h:420
double sqrt(double d)
Definition: double.h:73
static void compute_eigenvectors(Vector_3< double > A[3], Vector_3< double > &lambdas)
static const double pi
Definition: smooth_medial.C:43
void int int REAL * x
Definition: read.cpp:74
CImg< _cimg_Tfloat > atan(const CImg< T > &instance)
Definition: CImg.h:6061
double _saliency_crn
Definition: Rocmop.h:422
double _dir_thres
Another threshold.
Definition: Rocmop.h:421
NT abs(const NT &x)
Definition: number_utils.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

int eigen_analyze_vertex ( Vector_3< double >  A_io[3],
Vector_3< double > &  b_io,
Vector_3< double > *  nrm_nz,
double  angle_defect 
)
protected
int eigen_analyze_vertex ( Vector_3< double >  A_io[3],
Vector_3< double > &  b_io,
Vector_3< double > *  nrm_nz,
double  angle_defect 
)
protected
void evaluate_face_normals ( )
protected

Evaluate face normals (copied from FaceOffset_3.[hC].

Definition at line 903 of file smooth_medial.C.

References _verb, _wrk_window, COM_assertion_msg, COM_NC, Vector_3< Type >::cross_product(), i, j, Element_node_enumerator::next(), nj, Vector_3< Type >::normalize(), Element_node_vectors_k_const< Value >::set(), Element_node_enumerator::size_of_edges(), and Element_node_enumerator::size_of_nodes().

Referenced by smooth_surf_medial().

903  {
904 
905  if(_verb > 1)
906  std::cout << "Entering Rocmop::evaluate_face_normals" << std::endl;
907 
908  COM_assertion_msg(_wrk_window, "Unexpected NULL pointer encountered.");
909 
910  if(_verb > 3)
911  std::cout << "Getting attribute ids" << std::endl;
912 
913  const std::string att1("facenormals");
914  const std::string att2("facecenters");
915  int facenormals_id = _wrk_window->attribute(att1)->id();
916  int facecenters_id = _wrk_window->attribute(att2)->id();
917 
918  // Loop through the panes and its real faces
919  std::vector< COM::Pane*> allpanes;
920  _wrk_window->panes(allpanes);
921 
922  std::vector< COM::Pane*>::iterator it = allpanes.begin();
923  for ( int i=0, local_npanes = allpanes.size(); i<local_npanes; ++i, ++it) {
924  COM::Pane *pane = *it;
925 
926  // Obtain nodal coordinates of current pane, assuming contiguous layout
927  COM_assertion_msg( pane->attribute( COM_NC)->stride()==3 ||
928  pane->size_of_real_nodes()==0,
929  "Coordinates must be stored in contiguous layout.");
930 
931  const Vector_3<double> *pnts = reinterpret_cast< Vector_3<double>* >
932  (pane->attribute(COM_NC)->pointer());
933  Vector_3<double> *nrms = reinterpret_cast< Vector_3<double>* >
934  ( pane->attribute(facenormals_id)->pointer());
935  Vector_3<double> *cnts = reinterpret_cast< Vector_3<double>* >
936  ( pane->attribute(facecenters_id)->pointer());
937 
938  COM_assertion_msg(pnts, "NULL pointer to nodal coords.");
939  COM_assertion_msg(nrms, "NULL pointer to face normals.");
940  COM_assertion_msg(cnts, "NULL pointer to face centers.");
941 
942  // Loop through real elements of the current pane
943  Element_node_enumerator ene( pane, 1);
944  for ( int j=0, nj=pane->size_of_real_elements(); j<nj; ++j, ene.next()) {
945 
946  // Obtain current face normal
947  Element_node_vectors_k_const<Vector_3<double> > ps; ps.set( pnts, ene, 1);
948  SURF::Generic_element_2 e(ene.size_of_edges(), ene.size_of_nodes());
949 
950  Vector_2<double> nc(0.5,0.5);
951  Vector_3<double> J[2];
952 
953  e.Jacobian( ps, nc, J);
954 
955  nrms[j] = Vector_3<double>::cross_product( J[0], J[1]);
956 
957  nrms[j].normalize();
958 
959  e.interpolate_to_center( ps, &cnts[j]);
960 
961  }
962  }
963 
964  if(_verb > 1)
965  std::cout << "Exiting Rocmop::evaluate_face_normals" << std::endl;
966 }
An adaptor for enumerating node IDs of an element.
#define COM_assertion_msg(EX, msg)
Vector_3 & normalize()
Definition: mapbasic.h:114
This is a helper class for accessing nodal data.
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
static Vector_3 cross_product(const Vector_3 &v, const Vector_3 &w)
Definition: mapbasic.h:104
int _verb
Verbose level.
Definition: Rocmop.h:453
j indices j
Definition: Indexing.h:6
void set(const Value *p, Element_node_enumerator &ene, int strd)
initialize the accessor with a pointer and a specific stride.
void int * nj
Definition: read.cpp:74

Here is the call graph for this function:

Here is the caller graph for this function:

void evaluate_face_normals ( )
protected

Evaluate face normals (copied from FaceOffset_3.[hC].

void evaluate_face_normals ( )
protected

Evaluate face normals (copied from FaceOffset_3.[hC].

void get_constraint_directions ( int  type,
const Vector_3< double > &  dir,
int &  ndirs,
Vector_3< double >  dirs[2] 
)
staticprotected

Get orthonormals of the constraints.

If nnrms is 0, then not constrained. If nnrms is 3, then the point is fixed. Otherwise, the point is constrained either in a plane or a line.

Definition at line 1245 of file smooth_medial.C.

References NTS::abs(), COM_assertion_msg, s, sqrt(), and Vector_3< Type >::squared_norm().

1246  {
1247  if ( type == 1 || type == -1)
1248  COM_assertion_msg( &dir && std::abs(dir.squared_norm()-1)<=1.e-6,
1249  "Constrained direction must be normalized");
1250 
1251  switch ( type) {
1252  case 0:
1253  ndirs = 0;
1254  break;
1255  case 2:
1256  ndirs = 3;
1257  break;
1258  case 1:
1259  ndirs = 1; dirs[0] = dir;
1260  break;
1261  case -1: {
1262  ndirs = 2;
1263 
1264  double sqnrm;
1265  if ( std::abs( dir[2])>0.7) {
1266  sqnrm = dir[1]*dir[1]+dir[2]*dir[2];
1267  dirs[0] = Vector_3<double>( 0, -dir[2], dir[1]);
1268  dirs[1] = Vector_3<double>( sqnrm, -dir[0]*dir[1], -dir[0]*dir[2]);
1269  }
1270  else {
1271  sqnrm = dir[0]*dir[0]+dir[1]*dir[1];
1272  dirs[0] = Vector_3<double>( dir[1], -dir[0], 0);
1273  dirs[1] = Vector_3<double>( -dir[0]*dir[2], -dir[1]*dir[2], sqnrm);
1274  }
1275 
1276  double s = 1./std::sqrt( sqnrm);
1277  dirs[0] *= s; dirs[1] *= s;
1278  break;
1279  }
1280  case 'x':
1281  ndirs = 1;
1282  dirs[0] = Vector_3<double>(1,0,0);
1283  break;
1284  case -'x':
1285  ndirs = 2;
1286  dirs[0] = Vector_3<double>(0,1,0);
1287  dirs[1] = Vector_3<double>(0,0,1);
1288  break;
1289  case 'y':
1290  ndirs = 1;
1291  dirs[0] = Vector_3<double>(0,1,0);
1292  break;
1293  case -'y':
1294  ndirs = 2;
1295  dirs[0] = Vector_3<double>(1,0,0);
1296  dirs[1] = Vector_3<double>(0,0,1);
1297  break;
1298  case 'z':
1299  ndirs = 1;
1300  dirs[0] = Vector_3<double>(0,0,1);
1301  break;
1302  case -'z':
1303  ndirs = 2;
1304  dirs[0] = Vector_3<double>(1,0,0);
1305  dirs[1] = Vector_3<double>(0,1,0);
1306  break;
1307  default: COM_assertion_msg( false, "Unknown type of constraint");
1308  }
1309 }
#define COM_assertion_msg(EX, msg)
double s
Definition: blastest.C:80
double sqrt(double d)
Definition: double.h:73
Type squared_norm() const
Definition: mapbasic.h:110
NT abs(const NT &x)
Definition: number_utils.h:130

Here is the call graph for this function:

static void get_constraint_directions ( int  type,
const Vector_3< double > &  dir,
int &  ndirs,
Vector_3< double >  dirs[2] 
)
staticprotected

Get orthonormals of the constraints.

If nnrms is 0, then not constrained. If nnrms is 3, then the point is fixed. Otherwise, the point is constrained either in a plane or a line.

static void get_constraint_directions ( int  type,
const Vector_3< double > &  dir,
int &  ndirs,
Vector_3< double >  dirs[2] 
)
staticprotected

Get orthonormals of the constraints.

If nnrms is 0, then not constrained. If nnrms is 3, then the point is fixed. Otherwise, the point is constrained either in a plane or a line.

void get_redist_safe_factor ( COM::Attribute *  c_attr,
COM::Attribute *  w_attr,
int  rank 
)
protected

Definition at line 825 of file smooth_medial.C.

References _wrk_window, COM_NC, Rocblas::copy_scalar(), Vector_3< Type >::cross_product(), i, j, k, max(), Element_node_enumerator::next(), nj, Vector_3< Type >::normalize(), Window_manifold_2::OP_MAX, Element_node_enumerator::size_of_edges(), and solve().

Referenced by redistribute_vertices_ridge(), and redistribute_vertices_smooth().

826  {
827  double zero=0;
828  Rocblas::copy_scalar( &zero, w_attr);
829 
830  const std::string att1("tangranks"), att2("weights2"),
831  att3("barycrds"), att4("PNelemids");
832  int tangranks_id = _wrk_window->attribute(att1)->id(),
833  weights2_id = _wrk_window->attribute(att2)->id(),
834  barycrds_id = _wrk_window->attribute(att3)->id(),
835  PNelemid_id = _wrk_window->attribute(att4)->id();
836 
837  std::vector< COM::Pane*> allpanes;
838  _wrk_window->panes(allpanes);
839  std::vector< COM::Pane*>::iterator it = allpanes.begin();
840  for (int i=0, local_npanes = allpanes.size(); i<local_npanes; ++i, ++it) {
841  COM::Pane *pane = *it;
842 
843  const Point_3<double> *pnts = reinterpret_cast<Point_3<double>*>
844  (pane->attribute(COM_NC)->pointer());
845  Vector_3<double> *cs = reinterpret_cast<Vector_3<double>*>
846  ( pane->attribute(c_attr->id())->pointer());
847  double *ws = reinterpret_cast<double*>
848  ( pane->attribute(w_attr->id())->pointer());
849  int *tranks = reinterpret_cast<int*>
850  ( pane->attribute(tangranks_id)->pointer());
851  double *ws2 = reinterpret_cast<double*>
852  ( pane->attribute(weights2_id)->pointer());
853  double *bcs = reinterpret_cast<double*>
854  ( pane->attribute(barycrds_id)->pointer());
855  int *PNids = reinterpret_cast<int*>
856  ( pane->attribute(PNelemid_id)->pointer());
857 
858  // Loop through real elements of the current pane
859  Element_node_enumerator ene( pane, 1);
860 
861  for ( int j=0, nj=pane->size_of_real_elements(); j<nj; ++j, ene.next()) {
862  int ne = ene.size_of_edges();
863  int uindex=ene[ne-1]-1, vindex=ene[0]-1;
864  Vector_3<double> nrm_nz;
865 
866  // Loop through all vertices of current face.
867  for ( int k=0; k<ne; ++k) {
868  int windex = ene[(k+1==ne)?0:k+1]-1;
869 
870  // Only redistribute correct classification of vertices
871  if ( tranks[vindex]==rank) {
872  Vector_3<double> tngs[2] = {pnts[uindex]-pnts[vindex],
873  pnts[windex]-pnts[vindex]};
874 
875  // Compute normal of face offset
876  if ( k==0 || ne>3) {
877  nrm_nz = Vector_3<double>::cross_product( tngs[1], tngs[0]);
878  nrm_nz.normalize();
879  }
880 
881  // Solve for vector x, to determine maximum time step
882  Vector_3<double> S[3] = { tngs[1], tngs[0], nrm_nz};
883  Vector_3<double> xs; solve( S, cs[windex], xs);
884 
885  double temp = ws[windex];
886  ws[windex] = std::max( (6-ne)*std::max( xs[0], xs[1]), ws[windex]);
887  if(temp != ws[windex]){
888  ws2[windex] = ws[windex];
889  bcs[windex*2]= xs[0];
890  bcs[windex*2+1] = xs[1];
891  PNids[windex] = j+1;
892  }
893  }
894 
895  uindex=vindex; vindex=windex;
896  }
897  }
898  }
899 
900  _wm->reduce_on_shared_nodes( w_attr, Window_manifold_2::OP_MAX);
901 }
An adaptor for enumerating node IDs of an element.
j indices k indices k
Definition: Indexing.h:6
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
Vector_3 & normalize()
Definition: mapbasic.h:114
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
static Vector_3 cross_product(const Vector_3 &v, const Vector_3 &w)
Definition: mapbasic.h:104
static void copy_scalar(const void *x, Attribute *y)
Operation wrapper for copy (x is a scalar pointer).
Definition: op2args.C:583
static void solve(const FT &a1, const FT &a2, const FT &b1, const FT &b2, const FT &c1, const FT &c2, FT &x, FT &y)
Definition: Rocmop.h:378
j indices j
Definition: Indexing.h:6
void int * nj
Definition: read.cpp:74
static int rank
Definition: advectest.C:66
static MPI_Op OP_MAX
Definition: Manifold_2.h:353

Here is the call graph for this function:

Here is the caller graph for this function:

void get_redist_safe_factor ( COM::Attribute *  c_attr,
COM::Attribute *  w_attr,
int  rank 
)
protected
void get_redist_safe_factor ( COM::Attribute *  c_attr,
COM::Attribute *  w_attr,
int  rank 
)
protected
void get_usr_disp ( const COM::Attribute *  pmesh,
COM::Attribute *  disp,
double *  timestep 
)
protected

Get displacement in _usr_window based on nc in _buf_window.

Use nodal coordinates in _buf_window as target and nodal coordinates in _usr_window as initial position. Determine displacement in _usr_window.

Definition at line 1001 of file Rocmop_2.C.

References COM_assertion_msg, COM_NC, Rocblas::div_scalar(), i, j, ni, nj, Rocblas::sub(), and Rocmap::update_ghosts().

1004 {
1005  /*
1006  * Disp array contains all nodal displacements.
1007  * For the real part, all displacements must not exceed
1008  * a given constraint. For the ghost part, they can since
1009  * they need to make up for incorrect initial positions
1010  * given by Rocflu (Rocflu never updates ghost nodes).
1011  *
1012  * The following steps are done.
1013  *
1014  * 1. Store displacements of REAL nodes in disp
1015  *
1016  * 2. Check if any displacements exceed the constraint
1017  * 2.1 If so, scale down all REAL displacements
1018  *
1019  * 3. Put updated NC in disp
1020  *
1021  * 4. Update ghost NC using Rocmap::update_ghosts(disp)
1022  *
1023  * 5. Disp now can be correctly calculated using
1024  * Rocblas::sub(disp, orig_nc, disp)
1025  *
1026  *
1027  * Pornput Suriyamongkol
1028  * 02/20/2007
1029  */
1030 
1031  std::vector<const Pane*> allusrpanes;
1032  std::vector<const Pane*> allbufpanes;
1033  _usr_window->panes(allusrpanes);
1034  _buf_window->panes(allbufpanes);
1035  COM_assertion_msg(allbufpanes.size() == allusrpanes.size(),
1036  "Different number of panes on buffer and user windows.");
1037 
1038  // 1. Store REAL displacment in disp
1039 
1040  int disp_id = disp->id();
1041  for(int i = 0, ni = allusrpanes.size(); i < ni; ++i){
1042 
1043  const COM::Attribute *old_nc = allusrpanes[i]->attribute(COM::COM_NC);
1044  const COM::Attribute *new_nc = allbufpanes[i]->attribute(COM::COM_NC);
1045  COM::Attribute *p_disp = const_cast<COM::Attribute*>
1046  (allusrpanes[i]->attribute(disp_id));
1047 
1048  COM_assertion_msg((p_disp->size_of_real_items() == new_nc->size_of_real_items()) &&
1049  (p_disp->size_of_real_items() == old_nc->size_of_real_items()),
1050  "Number of real items differs between buffer and user windows");
1051 
1052  double* old_nc_ptr = (double*)old_nc->pointer();
1053  double* new_nc_ptr = (double*)new_nc->pointer();
1054  double* p_disp_ptr = (double*)p_disp->pointer();
1055 
1056  int old_nc_stride = old_nc->stride();
1057  int new_nc_stride = new_nc->stride();
1058  int p_disp_stride = p_disp->stride();
1059 
1060  // Set distances to the next component for each data structure
1061  int old_nc_next_comp;
1062  int new_nc_next_comp;
1063  int p_disp_next_comp;
1064 
1065  if (old_nc_stride == 1)
1066  old_nc_next_comp = old_nc->size_of_items();
1067  else
1068  old_nc_next_comp = 1;
1069 
1070  if (new_nc_stride == 1)
1071  new_nc_next_comp = new_nc->size_of_items();
1072  else
1073  new_nc_next_comp = 1;
1074 
1075  if (p_disp_stride == 1)
1076  p_disp_next_comp = p_disp->size_of_items();
1077  else
1078  p_disp_next_comp = 1;
1079 
1080  // Put displacements for real nodes in p_disp
1081  for(int j = 0, nj = new_nc->size_of_real_items(); j < nj; ++j){
1082 
1083  *p_disp_ptr = *new_nc_ptr - *old_nc_ptr;
1084  *(p_disp_ptr+1*p_disp_next_comp) = *(new_nc_ptr+1*new_nc_next_comp) - *(old_nc_ptr+1*old_nc_next_comp);
1085  *(p_disp_ptr+2*p_disp_next_comp) = *(new_nc_ptr+2*new_nc_next_comp) - *(old_nc_ptr+2*old_nc_next_comp);
1086 
1087  // go to next item
1088  old_nc_ptr += old_nc_stride;
1089  new_nc_ptr += new_nc_stride;
1090  p_disp_ptr += p_disp_stride;
1091  }
1092  }
1093 
1094  // 2. Constrain displacements
1095 
1097 
1098  // 3. Update real NC in disp
1099 
1100  for(int i = 0, ni = allusrpanes.size(); i < ni; ++i){
1101 
1102  const COM::Attribute *old_nc = allusrpanes[i]->attribute(COM::COM_NC);
1103  COM::Attribute *p_disp = const_cast<COM::Attribute*>
1104  (allusrpanes[i]->attribute(disp_id));
1105 
1106  double* old_nc_ptr = (double*)old_nc->pointer();
1107  double* p_disp_ptr = (double*)p_disp->pointer();
1108 
1109  int old_nc_stride = old_nc->stride();
1110  int p_disp_stride = p_disp->stride();
1111 
1112  // Set distances to the next component for each data structure
1113 
1114  int old_nc_next_comp;
1115  int p_disp_next_comp;
1116 
1117  if (old_nc_stride == 1)
1118  old_nc_next_comp = old_nc->size_of_items();
1119  else
1120  old_nc_next_comp = 1;
1121 
1122  if (p_disp_stride == 1)
1123  p_disp_next_comp = p_disp->size_of_items();
1124  else
1125  p_disp_next_comp = 1;
1126 
1127  // Update real part of NC in disp
1128  for(int j = 0, nj = p_disp->size_of_real_items(); j < nj; ++j){
1129 
1130  *p_disp_ptr = *old_nc_ptr + *p_disp_ptr;
1131  *(p_disp_ptr+1*p_disp_next_comp) = *(old_nc_ptr+1*old_nc_next_comp) + *(p_disp_ptr+1*p_disp_next_comp);
1132  *(p_disp_ptr+2*p_disp_next_comp) = *(old_nc_ptr+2*old_nc_next_comp) + *(p_disp_ptr+2*p_disp_next_comp);
1133 
1134  // go to next item
1135  old_nc_ptr += old_nc_stride;
1136  p_disp_ptr += p_disp_stride;
1137  }
1138  }
1139 
1140  // 4. Update ghost part of disp
1141 
1142  Rocmap::update_ghosts(disp);
1143 
1144  // 5. Get displacment
1145 
1146  const COM::Attribute *orig_nc = pmesh->window()->attribute(COM::COM_NC);
1147  Rocblas::sub(disp, orig_nc, disp);
1148 
1149  if(timestep)
1150  Rocblas::div_scalar (disp,(const void*)timestep, disp);
1151 }
static void div_scalar(const Attribute *x, const void *y, Attribute *z, int swap=0)
Operation wrapper for division with y as a scalar pointer.
Definition: op3args.C:363
static void sub(const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for subtraction.
Definition: op3args.C:237
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
#define COM_assertion_msg(EX, msg)
void constrain_displacements(COM::Attribute *w_disp)
Contrain displacements to _maxdisp.
Definition: Rocmop_1.C:1424
blockLoc i
Definition: read.cpp:79
static void update_ghosts(COM::Attribute *att, const COM::Attribute *pconn=NULL)
Update ghost nodal or elemental values for the given attribute.
Definition: Rocmap.C:87
j indices j
Definition: Indexing.h:6
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464

Here is the call graph for this function:

void identify_ridge_edges ( )
protected

Identify ridge edges.

Definition at line 969 of file smooth_medial.C.

References _edges, _wrk_window, COM_DOUBLE, i, j, Element_node_enumerator::next(), nj, Vector_3< Type >::normalize(), Window_manifold_2::OP_MAX, Window_manifold_2::OP_MIN, and REAL_PANE.

970 {
971  // Allocate buffer space for maximum and minedgev
972  COM::Attribute *maxedgev =
973  _wrk_window->new_attribute( "maxedgev", 'n', COM_DOUBLE, 1, "");
974  _wrk_window->resize_array( maxedgev, 0);
975 
976  COM::Attribute *minedgev =
977  _wrk_window->new_attribute( "minedgev", 'n', COM_DOUBLE, 1, "");
978  _wrk_window->resize_array( minedgev, 0);
979  _wrk_window->init_done();
980 
981  // Loop through the panes and its real faces
982  std::vector< COM::Pane*> allpanes;
983  _wrk_window->panes(allpanes);
984  std::vector< COM::Pane*>::iterator it = allpanes.begin();
985  Window_manifold_2::PM_iterator pm_it=_wm->pm_begin();
986 
987  const std::string att1("eigvecs"), att2("tangranks");
988 
989  int eigvecs_id = _wrk_window->attribute(att1)->id();
990  int tangranks_id = _wrk_window->attribute(att2)->id();
991 
992  std::vector<std::map<Edge_ID, double> > edge_maps( allpanes.size());
993  for ( int i=0, local_npanes = allpanes.size();
994  i<local_npanes; ++i, ++it, ++pm_it) {
995  COM::Pane *pane = *it;
996  std::map< Edge_ID, double> &edges_pn = edge_maps[i];
997 
998  // Obtain pointers to A_attr, bm_attr, and r_attr
999  Vector_3<double> *es = reinterpret_cast<Vector_3<double>*>
1000  ( pane->attribute(eigvecs_id)->pointer());
1001  int *tranks = reinterpret_cast<int*>
1002  ( pane->attribute(tangranks_id)->pointer());
1003  double *minvs = reinterpret_cast<double*>
1004  ( pane->attribute(minedgev->id())->pointer());
1005  double *maxvs = reinterpret_cast<double*>
1006  ( pane->attribute(maxedgev->id())->pointer());
1007 
1008  // Loop through real elements of the current pane
1009  Element_node_enumerator ene( pane, 1);
1010  for ( int j=0, nj=pane->size_of_real_elements(); j<nj; ++j, ene.next()) {
1011  Halfedge h( &*pm_it, Edge_ID(j+1,0), SURF::REAL_PANE), h0=h;
1012 
1013  int vindex = ene[ h.id().lid()]-1;
1014  do {
1015  int windex = ene[ h.next().id().lid()]-1;
1016 
1017  // If vertex is on a ridge
1018  if ( tranks[ vindex]==1) {
1019  int m = 1 + (tranks[windex]<2);
1020  Vector_3<double> tng = h.tangent(); tng.normalize();
1021  double feg = m * (es[3*vindex+2]* tng);
1022 
1023  edges_pn[ h.id()] = feg;
1024  if ( feg > maxvs[vindex]) maxvs[vindex] = feg;
1025  if ( feg < minvs[vindex]) minvs[vindex] = feg;
1026  }
1027 
1028  // Process border edge
1029  if ( h.is_border() && tranks[windex]==1) {
1030  int m = 1 + (tranks[vindex]<2);
1031  Vector_3<double> tng = -h.tangent(); tng.normalize();
1032  double feg = m * (es[3*windex+2]* tng);
1033 
1034  edges_pn[ h.opposite().id()] = feg;
1035  if ( feg > maxvs[windex]) maxvs[windex] = feg;
1036  if ( feg < minvs[windex]) minvs[windex] = feg;
1037  }
1038 
1039  // Update vindex
1040  vindex = windex;
1041  } while ( (h=h.next()) != h0);
1042  }
1043  }
1044 
1045  // Reduce on shared nodes for minedgev and maxedgev
1046  _wm->reduce_on_shared_nodes( minedgev, Window_manifold_2::OP_MIN);
1047  _wm->reduce_on_shared_nodes( maxedgev, Window_manifold_2::OP_MAX);
1048 
1049  it = allpanes.begin();
1050  // Insert ridge edges onto _edges
1051  _edges.clear(); _edges.resize( allpanes.size());
1052  for ( int i=0, local_npanes = allpanes.size(); i<local_npanes; ++i, ++it) {
1053  COM::Pane *pane = *it;
1054  std::map< Edge_ID, double> &emap_pn = edge_maps[i];
1055  std::set< Edge_ID> &eset_pn = _edges[i];
1056 
1057  const double *minvs = reinterpret_cast<double*>
1058  ( pane->attribute(minedgev->id())->pointer());
1059  const double *maxvs = reinterpret_cast<double*>
1060  ( pane->attribute(maxedgev->id())->pointer());
1061 
1062  // Loop throug ebuf and put ridges edges onto edges_pn
1063  for ( std::map< Edge_ID, double>::const_iterator eit=emap_pn.begin(),
1064  eend=emap_pn.end(); eit!=eend; ++eit) {
1065  Element_node_enumerator ene( pane, eit->first.eid());
1066  int vindex = ene[eit->first.lid()]-1;
1067 
1068  // Push edge onto edge
1069  if ( eit->second == minvs[vindex] || eit->second == maxvs[vindex])
1070  eset_pn.insert( eit->first);
1071  }
1072  }
1073 
1074  // Deallocate minedgev and maxedgev
1075  _wrk_window->delete_attribute( minedgev->name());
1076  _wrk_window->delete_attribute( maxedgev->name());
1077  _wrk_window->init_done();
1078 }
An adaptor for enumerating node IDs of an element.
MAP::Facet_ID Edge_ID
Definition: Manifold_2.h:49
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
Vector_3 & normalize()
Definition: mapbasic.h:114
std::vector< Pane_manifold_2 >::iterator PM_iterator
Definition: Manifold_2.h:187
static MPI_Op OP_MIN
Definition: Manifold_2.h:353
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
j indices j
Definition: Indexing.h:6
void int * nj
Definition: read.cpp:74
static MPI_Op OP_MAX
Definition: Manifold_2.h:353
std::vector< std::set< Edge_ID > > _edges
ridge edges
Definition: Rocmop.h:426

Here is the call graph for this function:

void identify_ridge_edges ( )
protected

Identify ridge edges.

void identify_ridge_edges ( )
protected

Identify ridge edges.

void invert_elements ( int  conn_type)
protected

Repair inverted tets or hexes.

Definition at line 1713 of file Rocmop_2.C.

References i, MesqPane::invert(), and ni.

1713  {
1714 #ifdef ROCPROF
1715  Profile_begin("Rocmop::invert_elements");
1716 #endif
1717  print_legible(1,"Entering Rocmop::invert_elements");
1718  std::vector<Pane*> allpanes;
1719  _buf_window->panes(allpanes);
1720  for(int i=0, ni = allpanes.size(); i<ni; ++i){
1721  MesqPane* mp = new MesqPane(allpanes[i]);
1722  mp->invert();
1723  //mp->invert(conn_type);
1724  if(mp)
1725  delete mp;
1726  mp = NULL;
1727  }
1728  print_legible(1,"Exiting Rocmop::invert_elements");
1729 #ifdef ROCPROF
1730  Profile_end("Rocmop::invert_tets");
1731 #endif
1732 }
void invert()
Invert Tetrahedrons.
Definition: MesqPane.C:45
A class enabling Mesquite calls on Rocmop panes.
Definition: MesqPane.h:95
blockLoc i
Definition: read.cpp:79
void print_legible(int verb, const char *msg)
Single process print message if given verbosity level is exceeded.
Definition: Rocmop_1.C:1408
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464

Here is the call graph for this function:

void invert_tets ( )
protected

Repair inverted tets.

void invert_tets ( )
protected

Repair inverted tets.

Definition at line 748 of file Rocmop.C.

References i, MesqPane::invert(), and ni.

748  {
749  std::vector<Pane*> allpanes;
750  _wrk_window->panes(allpanes);
751  for(int i=0, ni = allpanes.size(); i<ni; ++i){
752  MesqPane* mp = new MesqPane(allpanes[i]);
753  mp->invert();
754  if(mp)
755  delete mp;
756  mp = NULL;
757  }
758 }
void invert()
Invert Tetrahedrons.
Definition: MesqPane.C:45
A class enabling Mesquite calls on Rocmop panes.
Definition: MesqPane.h:95
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77

Here is the call graph for this function:

void load ( const std::string &  mname)
static

Loads Rocmop onto Roccom with a given module name.

Definition at line 88 of file Rocmop.C.

References COM_METADATA, COM_new_attribute(), COM_new_window(), COM_RAWDATA, COM_set_member_function(), COM_set_object(), COM_STRING, COM_VOID, COM_window_init_done(), set_value(), smooth(), and smooth_in_place().

Referenced by COM_F_FUNC2(), and Rocmop_load_module().

88  {
89 
90  Rocmop *mop = new Rocmop();
91 
92  COM_new_window( mname.c_str());
93 
94  std::string glb=mname+".global";
95 
96  COM_new_attribute( glb.c_str(), 'w', COM_VOID, 1, "");
97  COM_set_object( glb.c_str(), 0, mop);
98 
99  COM_Type types[3];
100  types[0] = COM_RAWDATA; types[1] = COM_METADATA;
101  types[2] = COM_METADATA;
102 
103  COM_set_member_function( (mname+".smooth").c_str(),
104  (Member_func_ptr)(&Rocmop::smooth),
105  glb.c_str(), "biB", types);
106 
107  COM_set_member_function( (mname+".smooth_in_place").c_str(),
108  (Member_func_ptr)(&Rocmop::smooth_in_place),
109  glb.c_str(), "bb", types);
110 
111  types[1] = COM_STRING; types[2] = COM_VOID;
112  COM_set_member_function( (mname+".set_value").c_str(),
113  (Member_func_ptr)(&Rocmop::set_value),
114  glb.c_str(), "bii", types);
115 
116  COM_window_init_done( mname.c_str());
117 
118 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void smooth_in_place(COM::Attribute *pmesh)
Smooth a mesh in place..
Definition: Rocmop.C:204
A Roccom mesh optimization module.
Definition: Rocmop.h:41
void COM_set_object(const char *wa_str, int pane_id, Type *addr)
Definition: roccom_c++.h:144
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
void smooth(const COM::Attribute *pmesh, COM::Attribute *disp)
Smooth the mesh in a Rocmop managed buffer.
Definition: Rocmop.C:132
void COM_new_attribute(const char *wa_str, const char loc, const int type, int ncomp, const char *unit)
Registering an attribute type.
Definition: roccom_c++.h:118
void COM_set_member_function(const char *wf_str, Member_func_ptr func, const char *wa_str, const char *intents, const COM_Type *types)
Definition: roccom_c++.h:330
Rocmop()
Default Constructor.
Definition: Rocmop.h:55
void set_value(const char *opt, const void *val)
Set a Rocomp option.
Definition: Rocmop.C:529

Here is the call graph for this function:

Here is the caller graph for this function:

static void load ( const std::string &  mname)
static

Loads Rocmop onto Roccom with a given module name.

static void load ( const std::string &  mname)
static

Loads Rocmop onto Roccom with a given module name.

virtual SURF::Window_manifold_2* manifold ( )
inlineprotectedvirtual

Obtain a reference to the manifold.

Definition at line 201 of file Rocmop_1.h.

202  { return _wm;}
virtual SURF::Window_manifold_2* manifold ( )
inlineprotectedvirtual

Obtain a reference to the manifold.

Definition at line 202 of file Rocmop.h.

203  { return _wm;}
virtual SURF::Window_manifold_2* manifold ( )
inlineprotectedvirtual

Obtain a reference to the manifold.

Definition at line 223 of file Rocmop_2.h.

224  { return _wm;}
void mark_elems_from_nodes ( std::vector< std::vector< bool > > &  marked_nodes,
std::vector< std::vector< bool > > &  marked_elems 
)

Mark the nodes which contain marked elems.

void mark_elems_from_nodes ( std::vector< std::vector< bool > > &  marked_nodes,
std::vector< std::vector< bool > > &  marked_elems 
)

Mark the nodes which contain marked elems.

Definition at line 712 of file Rocmop.C.

References i, j, k, and nk.

713  {
714  if(_verb)
715  std::cout << "Entering Rocmop::mark_elems_from_nodes" << std::endl;
716 
717  std::vector<const COM::Pane*> allpanes;
718  _wrk_window->panes(allpanes);
719  int local_npanes = (int)allpanes.size();
720 
721  marked_elems.clear();
722  marked_elems.resize(local_npanes);
723 
724  //Loop through panes
725  for(int i=0; i < (int)(local_npanes); ++i){
726 
727  marked_elems[i].clear();
728  marked_elems[i].resize(allpanes[i]->size_of_real_elements(),false);
729 
730  // Loop through real elements.
731  // Mark for quality check if they contain shared nodes.
732  int s_real_elems = allpanes[i]->size_of_real_elements();
733  std::vector<int> nodes;
734  for(int j=1; j<= s_real_elems; ++j){
735  Element_node_enumerator ene(allpanes[i],j);
736  ene.get_nodes(nodes);
737  for(int k=0, nk=nodes.size(); k<nk; ++k){
738  if (marked_nodes[i][nodes[k]-1])
739  marked_elems[i][j-1] = true;
740  }
741  }
742  }
743 
744  if(_verb > 1)
745  std::cout << "Exiting Rocmop::mark_elems_from_nodes" << std::endl;
746 }
j indices k indices k
Definition: Indexing.h:6
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
int _verb
Verbose level.
Definition: Rocmop.h:453
void int int * nk
Definition: read.cpp:74
j indices j
Definition: Indexing.h:6
void mark_elems_from_nodes ( std::vector< std::vector< bool > > &  marked_nodes,
std::vector< std::vector< bool > > &  marked_elems 
)

Mark the nodes which contain marked elems.

void obtain_extremal_dihedrals ( const COM::Attribute *  att,
double *  min,
double *  max 
)
protected

Obtain the min and max dihedral angles.

Definition at line 1991 of file Rocmop_2.C.

References COMMPI_Initialized(), Angle_Metric_3::compute(), i, Geo_Metric_Base_3::initialize(), k, MPI_MAX, MPI_MIN, ni, nk, and rank.

1991  {
1992 
1993  const COM::Window *win = att->window();
1994 
1995  bool cominit = COMMPI_Initialized();
1996 
1997  int rank =0;
1998  if(cominit){
1999  int ierr = MPI_Comm_rank( win->get_communicator(),
2000  &rank); assert( ierr == 0);
2001  }
2002 
2003  std::vector<const Pane*> allpanes;
2004  win->panes(allpanes);
2005 
2006  max_angle[0] = 0.0;
2007  min_angle[0] = 180.0;
2008  double angles[] = {0.0, 0.0};
2009 
2010  for(int i=0,ni = allpanes.size(); i<ni; ++i){
2011  for(int k =0,nk=allpanes[i]->size_of_real_elements(); k<nk; ++k){
2012  Element_node_enumerator ene(allpanes[i],k+1);
2013  Angle_Metric_3 am;
2014  am.initialize(ene);
2015  am.compute(angles);
2016 
2017  if(angles[1]>max_angle[0])
2018  max_angle[0] = angles[1];
2019  if(angles[0]<min_angle[0])
2020  min_angle[0] = angles[0];
2021  }
2022  }
2023 
2024  if(cominit){
2025  double temp = max_angle[0];
2026  MPI_Allreduce(&max_angle[0], &temp, 1, MPI_DOUBLE, MPI_MAX,
2027  win->get_communicator());
2028  max_angle[0] = temp;
2029 
2030  temp = min_angle[0];
2031  MPI_Allreduce(&min_angle[0], &temp, 1, MPI_DOUBLE, MPI_MIN,
2032  win->get_communicator());
2033  min_angle[0] = temp;
2034  }
2035 }
virtual void compute(double atts[]) const
Calculate the metric value on this element.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
j indices k indices k
Definition: Indexing.h:6
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MIN
blockLoc i
Definition: read.cpp:79
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
void int int * nk
Definition: read.cpp:74
3D Max and Min Angle Metric Class
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
static int rank
Definition: advectest.C:66
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

void perform_iterative_smoothing ( )
protected

Perform iterative smoothing.

Run an iterative smoothing method if needed until either the maximum number of iterations is reached or the required quality is achieved.

void perform_iterative_smoothing ( )
protected

Perform iterative smoothing.

Run an iterative smoothing method if needed until either the maximum number of iterations is reached or the required quality is achieved.

Definition at line 798 of file Rocmop_1.C.

References COM_assertion_msg.

798  {
799  // All internal iterative behavior has been removed.
800 #ifdef ROCPROF
801  Profile_begin("Rocmop::perform_itersmooth");
802 #endif
803 
804  print_legible(1," Entering Rocmop::perform_iterative_smoothing");
805 
806  COM_assertion_msg(_buf_window, "Unexpected NULL pointer encountered.");
807 
808  std::vector<const Pane*> allpanes;
809  _buf_window->panes(allpanes);
810 
811 #ifdef MESQUITE
812 
815 
816  else if(_method==SMOOTH_VOL_MESQ_NG)
818 
819 #else
820 
822  COM_assertion_msg(0,"Rocmop not compiled with MESQUITE");
823 
824 #endif
825 
826  else if(_method==SMOOTH_SURF_MEDIAL)
828 
829  else COM_assertion_msg(0, "No valid iterative smoothing method selected");
830 
831  print_legible(1," Exiting Rocmop::perform_iterative_smoothing");
832 #ifdef ROCPROF
833  Profile_end("Rocmop::perform_itersmooth");
834 #endif
835 }
#define COM_assertion_msg(EX, msg)
void smooth_vol_mesq_wg()
Smooth a volume via Mesquite using ghost information.
int _method
Choice of smoothing method.
Definition: Rocmop.h:447
void smooth_vol_mesq_ng()
Smooths a volume using Mesquite with only shared node information.
Definition: Rocmop_1.h:276
void print_legible(int verb, const char *msg)
Single process print message if given verbosity level is exceeded.
Definition: Rocmop_1.C:1408
void smooth_surf_medial()
Smooths a surface using the medial quadric.
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464
void perform_iterative_smoothing ( double  pre_quality)
protected

Perform iterative smoothing.

Run an iterative smoothing method if needed until either the maximum number of iterations is reached or the required quality is achieved.

Parameters
pre_qualitysee perform_smoothing()

Definition at line 290 of file Rocmop.C.

References COM_assertion_msg, i, and MPI_MIN.

290  {
291  if(_verb)
292  std::cout << " Entering Rocmop::perform_iterative_smoothing" << std::endl;
293 
294  COM_assertion_msg(_wrk_window, "Unexpected NULL pointer encountered.");
295 
296  // bool_iter is true until the max number of iterations (_niter)
297  // is reached or the minimum quality (_tol) is reached.
298  int to_iter = true;
299  std::vector<const Pane*> allpanes;
300  _wrk_window->panes(allpanes);
301  double cur_qual = pre_quality;
302 
303  for(int i = 0;
304  ( (i < _niter) && (to_iter) );
305  ++i, agree_int(to_iter, MPI_MIN)){
306 
307  if(_verb > 2)
308  std::cout << " Smoothing iteration " << i << std::endl;
309 
310 #ifdef MESQUITE
312  //std::string msg("\nQuality prior to smoothing = ");
313  //print_quality(msg);
314  smooth_vol_mesq_wg(cur_qual);
315  }
316  // else if(_method == SMOOTH_LAPLACE)
317  // smooth_laplace();
318  else if(_method == SMOOTH_VOL_MESQ_NG){
319  //std::string msg("Quality prior to smoothing = ");
320  //print_quality(msg);
321  smooth_vol_mesq_ng(cur_qual);
322  }
323 #else
325  COM_assertion_msg(0,"Rocmop not compiled with MESQUITE");
326 #endif
327  else if(_method==SMOOTH_SURF_MEDIAL)
329  else COM_assertion_msg(0, "No valid iterative smoothing method selected");
330 
331  // If a non zero quality tolerance is set, then determine if quality
332  // is low enough to warrant smoothing.
333  if( _tol != 0.0 ){
334  cur_qual = check_all_elem_quality(allpanes);
335  if(cur_qual >= _tol)
336  to_iter = false;
337  }
338  }
339 
340  if(_verb > 1)
341  std::cout << " Exiting Rocmop::perform_iterative_smoothing" << std::endl;
342 }
double check_all_elem_quality(std::vector< const COM::Pane * > &allpanes, bool with_ghost=false)
Get the largest dihedral angle of all real elements.
Definition: Rocmop.C:785
#define COM_assertion_msg(EX, msg)
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MIN
void smooth_vol_mesq_wg()
Smooth a volume via Mesquite using ghost information.
int _method
Choice of smoothing method.
Definition: Rocmop.h:447
void smooth_vol_mesq_ng()
Smooths a volume using Mesquite with only shared node information.
Definition: Rocmop_1.h:276
int _niter
Maximum number of iterations for smoothing.
Definition: Rocmop.h:469
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
int _verb
Verbose level.
Definition: Rocmop.h:453
void smooth_surf_medial()
Smooths a surface using the medial quadric.
void agree_int(int &val, MPI_Op op)
Agree on an integer value across all panes.
Definition: Rocmop.h:226
float _tol
Smoother iterating tolerance.
Definition: Rocmop.h:464
void perform_noniterative_smoothing ( )
protected

Perform noniterative smoothing.

void perform_noniterative_smoothing ( )
protected

Perform noniterative smoothing.

void perform_noniterative_smoothing ( )
protected

Perform noniterative smoothing.

Definition at line 344 of file Rocmop.C.

References COM_assertion_msg.

344  {
345  if(_verb)
346  std::cout << " Entering Rocmop::perform_noniterative_smoothing" << std::endl;
347 
348  if(_niter != 1){
349  std::cerr << "Although the maximum number of iterations > 1 is selected,\n"
350  << "the smoothing method is noniterative, and will run once.\n";
351  }
352 
353  if (0)
354  ;// Currently, no noniterative methods exist.
355  else COM_assertion_msg(0, "No valid noniterative smoothing method selected");
356 
357  if(_verb > 1)
358  std::cout << " Exiting Rocmop::perform_noniterative_smoothing" << std::endl;
359 }
#define COM_assertion_msg(EX, msg)
int _niter
Maximum number of iterations for smoothing.
Definition: Rocmop.h:469
int _verb
Verbose level.
Definition: Rocmop.h:453
void perform_smoothing ( )
protected

Perform smoothing on _buf_window.

Calls smoother_specific_init(), and then selects between perform_iterative_smoothing() and perform_noniterative_smoothing() as required by the currently selected smoothing method.

void perform_smoothing ( double  pre_quality)
protected

Perform smoothing on _wrk_window.

Calls smoother_specific_init(), and then selects between perform_iterative_smoothing() and perform_noniterative_smoothing() as required by the currently selected smoothing method.

Parameters
pre_qualitypre-smoothed mesh quality or the worst quality possible if not in lazy or monotone mode.

Definition at line 269 of file Rocmop.C.

References COM_assertion_msg.

269  {
270  if(_verb)
271  std::cout << " Entering Rocmop::perform_smoothing" << std::endl;
272 
273  COM_assertion_msg(_wrk_window, "Unexpected NULL pointer encountered.");
274 
275  // Perform initialization specific to the smoother.
277 
278  // Select iterative or noniterative option depending on the smoother.
279  if (0) // No noniterative smoothers currently
281  else if( _method < SMOOTH_NONE)
282  perform_iterative_smoothing(pre_quality);
283  else
284  COM_assertion_msg(0, "No valid smoothing method selected");
285 
286  if(_verb)
287  std::cout << " Exiting Rocmop::perform_smoothing" << std::endl;
288 }
#define COM_assertion_msg(EX, msg)
int _method
Choice of smoothing method.
Definition: Rocmop.h:447
void perform_noniterative_smoothing()
Perform noniterative smoothing.
Definition: Rocmop.C:344
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
int _verb
Verbose level.
Definition: Rocmop.h:453
void smoother_specific_init()
Perform smoother specific initialization.
Definition: Rocmop.C:364
void perform_iterative_smoothing()
Perform iterative smoothing.
Definition: Rocmop_1.C:798
void perform_smoothing ( )
protected

Perform smoothing on _buf_window.

Calls smoother_specific_init(), and then selects between perform_iterative_smoothing() and perform_noniterative_smoothing() as required by the currently selected smoothing method.

Definition at line 776 of file Rocmop_1.C.

References COM_assertion_msg.

776  {
777 #ifdef ROCPROF
778  Profile_begin("Rocmop::perform_smoothing");
779 #endif
780  print_legible(1," Entering Rocmop::perform_smoothing");
781 
782  COM_assertion_msg(_buf_window, "Unexpected NULL pointer encountered.");
783 
784  // Select iterative or noniterative option depending on the smoother.
785  if (0) // No noniterative smoothers currently
787  else if( _method < SMOOTH_NONE)
789  else
790  COM_assertion_msg(0, "No valid smoothing method selected");
791 
792  print_legible(1," Exiting Rocmop::perform_smoothing");
793 #ifdef ROCPROF
794  Profile_end("Rocmop::perform_smoothing");
795 #endif
796 }
#define COM_assertion_msg(EX, msg)
int _method
Choice of smoothing method.
Definition: Rocmop.h:447
void perform_noniterative_smoothing()
Perform noniterative smoothing.
Definition: Rocmop.C:344
void print_legible(int verb, const char *msg)
Single process print message if given verbosity level is exceeded.
Definition: Rocmop_1.C:1408
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464
void perform_iterative_smoothing()
Perform iterative smoothing.
Definition: Rocmop_1.C:798
void perturb_stationary ( )
protected

Randomly perturn stationary nodes on pane boundary, not on phys. surface.

Definition at line 1689 of file Rocmop_1.C.

References COM_assertion_msg, COM_NC, COMMPI_Initialized(), Angle_Metric_3::compute(), i, Geo_Metric_Base_3::initialize(), j, k, Mesquite::length(), MPI_MAX, ni, nj, nk, and cimg_library::cimg::rand().

1689  {
1690 #ifdef ROCPROF
1691  Profile_begin("Rocmop::perturb_stat");
1692 #endif
1693  // first calculate current quality of all nodes.
1694  std::vector<const Pane*> allpanes;
1695  std::vector<const Pane*> allpanes_usr;
1696  _buf_window->panes(allpanes);
1697  _usr_window->panes(allpanes_usr);
1698 
1699  COM::Attribute *w_fgpn_bnd =
1700  _buf_window->attribute("is_fgpn_bnd");
1701  COM::Attribute *w_qual_b_perturb =
1702  _buf_window->attribute("qual_b_perturb");
1703  COM::Attribute *w_qual_a_perturb =
1704  _buf_window->attribute("qual_a_perturb");
1705 
1706  double angles[] = {0.0, 0.0};
1707 
1708  // Get worst quality on local panes
1709  for(int i=0,ni=allpanes.size(); i<ni; ++i){
1710 
1711  COM::Attribute *p_fgpn_bnd =
1712  const_cast<COM::Attribute*>(allpanes[i]->attribute(w_fgpn_bnd->id()));
1713  COM::Attribute *p_qual_b_perturb =
1714  const_cast<COM::Attribute*>(allpanes[i]->attribute(w_qual_b_perturb->id()));
1715 
1716  int* fgpn_bnd_ptr = reinterpret_cast<int*>(p_fgpn_bnd->pointer());
1717  double* qual_b_perturb_ptr =
1718  reinterpret_cast<double*>(p_qual_b_perturb->pointer());
1719 
1720  std::vector<int> elist;
1721  // only worry about real nodes, ghost nodes should be fixed
1722  for(int j=0, nj= allpanes[i]->size_of_real_nodes(); j<nj; ++j){
1723  if(fgpn_bnd_ptr[j]){
1724  _dcs[i]->incident_elements(j+1,elist);
1725  qual_b_perturb_ptr[j] = 0.0;
1726  for(uint k=0, nk=elist.size(); k<nk; ++k){
1727  Element_node_enumerator ene(allpanes[i],k+1);
1728  Angle_Metric_3 am;
1729  am.initialize(ene);
1730  am.compute(angles);
1731  if(angles[1]>qual_b_perturb_ptr[j])
1732  qual_b_perturb_ptr[j] = angles[1];
1733  }
1734  }
1735  }
1736  }
1737 
1738  // Get the worst quality across all panes
1739  if(COMMPI_Initialized()){
1740  MAP::Pane_communicator pc(_buf_window, _buf_window->get_communicator());
1741  pc.init(w_qual_b_perturb);
1742  pc.begin_update_shared_nodes();
1743  pc.reduce_on_shared_nodes(MPI_MAX);
1744  pc.end_update_shared_nodes();
1745  }
1746 
1747  // Now generate random perturbations
1748  for(int i=0,ni=allpanes.size(); i<ni; ++i){
1749 
1750  COM::Attribute *p_fgpn_bnd =
1751  const_cast<COM::Attribute*>(allpanes[i]->attribute(w_fgpn_bnd->id()));
1752  COM::Attribute *p_nc =
1753  const_cast<COM::Attribute*>(allpanes[i]->attribute(COM::COM_NC));
1754 
1755  int* fgpn_bnd_ptr =
1756  reinterpret_cast<int*>(p_fgpn_bnd->pointer());
1757  Vector_3<double>* nc_ptr =
1758  reinterpret_cast<Vector_3<double>*>(p_nc->pointer());
1759 
1760  std::vector<int> elist;
1761  // only worry about real nodes, ghost nodes should be fixed
1762  for(int j=0, nj= (int)allpanes[i]->size_of_real_nodes(); j<nj; ++j){
1763 
1764  if(fgpn_bnd_ptr[j]){
1765  _dcs[i]->incident_elements(j+1,elist);
1766 
1767  if(_verb > 1)
1768  std::cout << "Rocmop: Perturbing node " << j+1 << std::endl;
1769 
1770  //select a random element
1771  int rand_el = (std::rand()%elist.size());
1772  Element_node_enumerator ene(allpanes[i],elist[rand_el]);
1773  std::vector<int> enodes;
1774  ene.get_nodes(enodes);
1775 
1776  // get length of a randomly selected incident edge of the element
1777  int rand_ed = (std::rand()%3)+1;
1778  int nindex = 0;
1779  for(int nk= (int)enodes.size(); nindex<nk; ++nindex){
1780  if(enodes[nindex]==j+1)
1781  break;
1782  }
1783 
1784  COM_assertion_msg((nindex>=0 && nindex<= (int)enodes.size()),
1785  "Node not found in supposedly adjacent element\n");
1786  double length = (nc_ptr[j]-nc_ptr[enodes[(nindex+rand_ed)%4]-1]).norm();
1787 
1788  Vector_3<double> perturb(length,length,length);
1789  for(int k=0; k<3; ++k){
1790  perturb[0] *= (std::rand()%2 == 0) ?
1791  (double)((std::rand()%1000)+1)/1000.0 :
1792  -1.0*((double)((std::rand()%1000)+1)/1000.0);
1793  }
1794  nc_ptr[j] += perturb;
1795  }
1796  }
1797  }
1798 
1799  // Get perturbed worst quality on local panes
1800  for(int i=0,ni=(int)allpanes.size(); i<ni; ++i){
1801 
1802  COM::Attribute *p_fgpn_bnd =
1803  const_cast<COM::Attribute*>(allpanes[i]->attribute(w_fgpn_bnd->id()));
1804  COM::Attribute *p_qual_a_perturb =
1805  const_cast<COM::Attribute*>(allpanes[i]->attribute(w_qual_a_perturb->id()));
1806 
1807  int* fgpn_bnd_ptr =
1808  reinterpret_cast<int*>(p_fgpn_bnd->pointer());
1809  double* qual_a_perturb_ptr =
1810  reinterpret_cast<double*>(p_qual_a_perturb->pointer());
1811 
1812  std::vector<int> elist;
1813  // only worry about real nodes, ghost nodes should be fixed
1814  for(int j=0, nj= (int)allpanes[i]->size_of_real_nodes(); j<nj; ++j){
1815  if(fgpn_bnd_ptr[j]){
1816  _dcs[i]->incident_elements(j+1,elist);
1817  qual_a_perturb_ptr[j] = 0.0;
1818  for(int k=0, nk=(int)elist.size(); k<nk; ++k){
1819  Element_node_enumerator ene(allpanes[i],k+1);
1820  Angle_Metric_3 am;
1821  am.initialize(ene);
1822  am.compute(angles);
1823  if(angles[1]>qual_a_perturb_ptr[j])
1824  qual_a_perturb_ptr[j] = angles[1];
1825  }
1826  }
1827  }
1828  }
1829 
1830  // Get the perturbed worst quality across all panes
1831  if(COMMPI_Initialized()){
1832  MAP::Pane_communicator pc(_buf_window, _buf_window->get_communicator());
1833  pc.init(w_qual_a_perturb);
1834  pc.begin_update_shared_nodes();
1835  pc.reduce_on_shared_nodes(MPI_MAX);
1836  pc.end_update_shared_nodes();
1837  }
1838 
1839  // Reset positions of any nodes whose worst adj. element quality
1840  // has gotten worse.
1841  for(int i=0,ni=allpanes.size(); i<ni; ++i){
1842 
1843  COM::Attribute *p_fgpn_bnd =
1844  const_cast<COM::Attribute*>(allpanes[i]->attribute(w_fgpn_bnd->id()));
1845  COM::Attribute *p_nc =
1846  const_cast<COM::Attribute*>(allpanes[i]->attribute(COM::COM_NC));
1847  COM::Attribute *p_nc_usr =
1848  const_cast<COM::Attribute*>(allpanes_usr[i]->attribute(COM::COM_NC));
1849 
1850  COM::Attribute *p_qual_b_perturb =
1851  const_cast<COM::Attribute*>(allpanes[i]->attribute(w_qual_b_perturb->id()));
1852  COM::Attribute *p_qual_a_perturb =
1853  const_cast<COM::Attribute*>(allpanes[i]->attribute(w_qual_a_perturb->id()));
1854 
1855  int* fgpn_bnd_ptr =
1856  reinterpret_cast<int*>(p_fgpn_bnd->pointer());
1857  Vector_3<double>* nc_ptr =
1858  reinterpret_cast<Vector_3<double>*>(p_nc->pointer());
1859  Vector_3<double>* nc_ptr_usr =
1860  reinterpret_cast<Vector_3<double>*>(p_nc_usr->pointer());
1861  double* qual_b_perturb_ptr =
1862  reinterpret_cast<double*>(p_qual_b_perturb->pointer());
1863  double* qual_a_perturb_ptr =
1864  reinterpret_cast<double*>(p_qual_a_perturb->pointer());
1865 
1866  // only worry about real nodes, ghost nodes should be fixed
1867 for(int j=0, nj= (int)allpanes[i]->size_of_real_nodes(); j<nj; ++j){
1868  if(fgpn_bnd_ptr[j] &&
1869  (qual_a_perturb_ptr[j] > qual_b_perturb_ptr[j]))
1870  nc_ptr[j] = nc_ptr_usr[j];
1871  }
1872  }
1873 #ifdef ROCPROF
1874  Profile_end("Rocmop::perturb_stat");
1875 #endif
1876 }
virtual void compute(double atts[]) const
Calculate the metric value on this element.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
j indices k indices k
Definition: Indexing.h:6
#define COM_assertion_msg(EX, msg)
double length(Vector3D *const v, int n)
blockLoc i
Definition: read.cpp:79
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
int _verb
Verbose level.
Definition: Rocmop.h:453
void int int * nk
Definition: read.cpp:74
j indices j
Definition: Indexing.h:6
3D Max and Min Angle Metric Class
double rand()
Return a random variable between [0,1] with respect to an uniform distribution.
Definition: CImg.h:4833
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
int COMMPI_Initialized()
Definition: commpi.h:168
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464
std::vector< MAP::Pane_dual_connectivity * > _dcs
Definition: Rocmop_1.h:466

Here is the call graph for this function:

void perturb_stationary ( )
protected

Randomly perturn stationary nodes on pane boundary, not on phys. surface.

void print_extremal_dihedrals ( COM::Window *  window)
protected

Print the min and max dihedral angles along with their locations.

Definition at line 1463 of file Rocmop_1.C.

References COMMPI_Initialized(), Angle_Metric_3::compute(), i, Geo_Metric_Base_3::initialize(), k, ni, nk, and rank.

1463  {
1464 #ifdef ROCPROF
1465  Profile_begin("Rocmop::ext_dihedrals");
1466 #endif
1467 
1468  // Find the rank of this processor, making sure to only make
1469  // MPI calls on parallel runs
1470  int myrank =0;
1471  if(COMMPI_Initialized()){ // true if in parallel
1472  int ierr = MPI_Comm_rank( window->get_communicator(),
1473  &myrank);
1474  assert( ierr == 0);
1475  }
1476 
1477  // Calculate extremal angles on local panes, and
1478  // record their locations by pane id and element id
1479 
1480  double max_angle = 0.0;
1481  double min_angle = 180.0;
1482  int max_pane = -1; // id of pane w/ the largest dihedral angle
1483  int min_pane = -1; // id of pane w/ the smallest dihedral angle
1484  int max_elem = -1; // id of element w/ the largest dihedral angle
1485  int min_elem = -1; // id of element w/ the smallest dihedral angle
1486  double angles[] = {0.0, 0.0};
1487 
1488  std::vector<Pane*> allpanes;
1489  window->panes(allpanes);
1490 
1491  for(int i=0,ni = allpanes.size(); i<ni; ++i){
1492  for(int k =0,nk=allpanes[i]->size_of_real_elements(); k<nk; ++k){
1493  Element_node_enumerator ene(allpanes[i],k+1);
1494  Angle_Metric_3 am;
1495  am.initialize(ene);
1496  am.compute(angles);
1497  if(angles[1]>max_angle){
1498  max_angle = angles[1];
1499  max_pane = allpanes[i]->id();
1500  max_elem = k+1;
1501  }
1502  if(angles[0]<min_angle){
1503  min_angle = angles[0];
1504  min_pane = allpanes[i]->id();
1505  min_elem = k+1;
1506  }
1507  }
1508  }
1509 
1510  // Find minimum angle across all panes.
1511 
1512  // create MPI_DOUBLE_INT data types for send/recv buffs
1513  struct {
1514  double value;
1515  int rank;
1516  } send, recv;
1517  send.value = min_angle;
1518  send.rank = myrank;
1519 
1520  if(COMMPI_Initialized()){
1521  MPI_Allreduce(&send,&recv,1,MPI_DOUBLE_INT,MPI_MINLOC,
1522  window->get_communicator());
1523  }
1524  if(recv.rank == myrank && _verb > 1){
1525  std::cout << "Rocmop:" << std::endl << "Rocmop: "
1526  << std::setw(10) << min_angle << " on element "
1527  << min_elem << " of pane " << min_pane
1528  << "." << std::endl;
1529  }
1530 
1531  // Sync. output.
1532  if(COMMPI_Initialized()){
1533  MPI_Barrier(window->get_communicator());
1534  }
1535 
1536  // Find maximum angle across all panes.
1537 
1538  send.value = max_angle;
1539 
1540  if(COMMPI_Initialized()){
1541  MPI_Allreduce(&send,&recv,1,MPI_DOUBLE_INT,MPI_MAXLOC,
1542  window->get_communicator());
1543  }
1544  if(recv.rank == myrank && _verb > 1){
1545  std::cout << "Rocmop:" << std::endl << "Rocmop: "
1546  << std::setw(10) << max_angle << " on element "
1547  << max_elem << " of pane " << max_pane << std::endl;
1548  }
1549  // Sync. output.
1550  if(COMMPI_Initialized()){
1551  MPI_Barrier(window->get_communicator());
1552  }
1553 #ifdef ROCPROF
1554  Profile_end("Rocmop::ext_dihedrals");
1555 #endif
1556 
1557 }
virtual void compute(double atts[]) const
Calculate the metric value on this element.
j indices k indices k
Definition: Indexing.h:6
blockLoc i
Definition: read.cpp:79
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
int _verb
Verbose level.
Definition: Rocmop.h:453
void int int * nk
Definition: read.cpp:74
3D Max and Min Angle Metric Class
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
static int rank
Definition: advectest.C:66
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

void print_extremal_dihedrals ( COM::Window *  window)
protected

Print the min and max dihedral angles along with their locations.

void print_legible ( int  verb,
const char *  msg 
)
protected

Single process print message if given verbosity level is exceeded.

Definition at line 1408 of file Rocmop_1.C.

References COMMPI_Initialized(), and rank.

1408  {
1409  if(_verb > verb){
1410 
1411  int rank =0;
1412 
1413  if(COMMPI_Initialized()){
1414  int ierr = MPI_Comm_rank( _buf_window->get_communicator(),
1415  &rank);
1416  assert( ierr == 0);
1417  }
1418 
1419  if (rank==0)
1420  std::cout << "Rocmop: " << msg << std::endl;
1421  }
1422 }
int _verb
Verbose level.
Definition: Rocmop.h:453
static int rank
Definition: advectest.C:66
int COMMPI_Initialized()
Definition: commpi.h:168
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464

Here is the call graph for this function:

void print_legible ( int  verb,
const char *  msg 
)
protected

Single process print message if given verbosity level is exceeded.

void print_mquality ( std::string &  s,
std::vector< std::vector< bool > > &  to_check 
)
protected

Print the quality range of marked elements, for debugging.

Definition at line 883 of file Rocmop.C.

References COM_assertion_msg, COMMPI_Initialized(), Angle_Metric_3::compute(), i, Geo_Metric_Base_3::initialize(), k, MPI_MAX, MPI_MIN, ni, nk, and rank.

884  {
885 
886  std::vector<std::vector<bool> > elem_to_check;
887  mark_elems_from_nodes(to_check, elem_to_check);
888 
889  std::vector<Pane*> allpanes;
890  _wrk_window->panes(allpanes);
891 
892  double max_angle = 0.0;
893  double min_angle = 180.0;
894  double angles[] = {0.0, 0.0};
895  int id = -1;
896  for(int i=0,ni = allpanes.size(); i<ni; ++i){
897  for(int k =0,nk = elem_to_check[i].size(); k<nk; ++k){
898  if(elem_to_check[i][k]){
899  Element_node_enumerator ene(allpanes[i],k+1);
900  Angle_Metric_3 am;
901  am.initialize(ene);
902  am.compute(angles);
903  if(angles[1]>max_angle)
904  max_angle = angles[1];
905  if(angles[0]<min_angle){
906  id = k;
907  min_angle = angles[0];
908  }
909  }
910  }
911  }
912  int rank =0;
913  double temp = min_angle;
914  if(COMMPI_Initialized()){
915  agree_double(max_angle,MPI_MAX);
916  agree_double(min_angle,MPI_MIN);
917  int ierr = MPI_Comm_rank( _wrk_window->get_communicator()
918  , &rank);
919  assert( ierr == 0);
920  }
921 
922  if (rank==0){
923  string outstr("angles.txt");
924  ofstream file (outstr.c_str(), std::ios::app);
925  COM_assertion_msg( file, "File failed to open\n");
926 
927  file << std::left << std::setw(30) << s << std::setw(0)
928  << "(" << min_angle << " , " << max_angle << ")";
929 
930  file.close();
931  }
932 
933  if(COMMPI_Initialized())
934  int ierr = MPI_Barrier(_wrk_window->get_communicator());
935 
936  if(min_angle == temp){
937 
938  string outstr("angles.txt");
939  ofstream file (outstr.c_str(), std::ios::app);
940  COM_assertion_msg( file, "File failed to open\n");
941 
942  file << " worst = (" << rank << " , " << id << ")\n";
943  file.close();
944  }
945 
946  if(COMMPI_Initialized())
947  int ierr = MPI_Barrier(_wrk_window->get_communicator());
948 }
virtual void compute(double atts[]) const
Calculate the metric value on this element.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
j indices k indices k
Definition: Indexing.h:6
#define COM_assertion_msg(EX, msg)
double s
Definition: blastest.C:80
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MIN
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
void agree_double(double &val, MPI_Op op)
Agree on a double value across all panes.
Definition: Rocmop.h:240
void int int * nk
Definition: read.cpp:74
3D Max and Min Angle Metric Class
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
static int rank
Definition: advectest.C:66
void mark_elems_from_nodes(std::vector< std::vector< bool > > &marked_nodes, std::vector< std::vector< bool > > &marked_elems)
Mark the nodes which contain marked elems.
Definition: Rocmop.C:712
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

void print_mquality ( std::string &  s,
std::vector< std::vector< bool > > &  to_check 
)
protected

Print the quality range of marked elements, for debugging.

void print_mquality ( std::string &  s,
std::vector< std::vector< bool > > &  to_check 
)
protected

Print the quality range of marked elements, for debugging.

void print_quality ( std::string &  s)
protected

Print the quality range of all elements, for debugging.

Definition at line 846 of file Rocmop.C.

References COM_assertion_msg, COMMPI_Initialized(), Angle_Metric_3::compute(), i, Geo_Metric_Base_3::initialize(), k, MPI_MAX, MPI_MIN, ni, nk, and rank.

846  {
847 
848  string outstr("angles.txt");
849  ofstream file (outstr.c_str(), std::ios::app);
850  COM_assertion_msg( file, "File failed to open\n");
851 
852  std::vector<Pane*> allpanes;
853  _wrk_window->panes(allpanes);
854 
855  double max_angle = 0.0;
856  double min_angle = 180.0;
857  double angles[] = {0.0, 0.0};
858  for(int i=0,ni = allpanes.size(); i<ni; ++i){
859  for(int k =0,nk=allpanes[i]->size_of_real_elements(); k<nk; ++k){
860  Element_node_enumerator ene(allpanes[i],k+1);
861  Angle_Metric_3 am;
862  am.initialize(ene);
863  am.compute(angles);
864  if(angles[1]>max_angle)
865  max_angle = angles[1];
866  if(angles[0]<min_angle)
867  min_angle = angles[0];
868  }
869  }
870  int rank =0;
871  if(COMMPI_Initialized()){
872  agree_double(max_angle,MPI_MAX);
873  agree_double(min_angle,MPI_MIN);
874  int ierr = MPI_Comm_rank( _wrk_window->get_communicator(),
875  &rank); assert( ierr == 0);
876  }
877  if (rank==0){
878  file << std::left << std::setw(30) << s << std::setw(0)
879  << "(" << min_angle << " , " << max_angle << ")\n";
880  }
881 }
virtual void compute(double atts[]) const
Calculate the metric value on this element.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
j indices k indices k
Definition: Indexing.h:6
#define COM_assertion_msg(EX, msg)
double s
Definition: blastest.C:80
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MIN
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
void agree_double(double &val, MPI_Op op)
Agree on a double value across all panes.
Definition: Rocmop.h:240
void int int * nk
Definition: read.cpp:74
3D Max and Min Angle Metric Class
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
static int rank
Definition: advectest.C:66
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

void print_quality ( std::string &  s,
const std::string &  s2 
)
protected

Print the quality range of all elements, for debugging.

Definition at line 1559 of file Rocmop_1.C.

References COM_assertion_msg, COMMPI_Initialized(), Angle_Metric_3::compute(), i, Geo_Metric_Base_3::initialize(), k, MPI_MAX, MPI_MIN, ni, nk, and rank.

1559  {
1560 
1561  string outstr("angles.txt");
1562 
1563 
1564  ofstream file;
1565  ofstream file2;
1566 
1567  bool cominit = COMMPI_Initialized();
1568 
1569  int rank =0;
1570  if(cominit){
1571  int ierr = MPI_Comm_rank( _buf_window->get_communicator(),
1572  &rank); assert( ierr == 0);
1573  }
1574 
1575  std::vector<Pane*> allpanes;
1576  _buf_window->panes(allpanes);
1577 
1578  double max_angle = 0.0;
1579  double min_angle = 180.0;
1580  double angles[] = {0.0, 0.0};
1581 
1582  file2.open(s2.c_str());
1583  for(int i=0,ni = allpanes.size(); i<ni; ++i){
1584  for(int k =0,nk=allpanes[i]->size_of_real_elements(); k<nk; ++k){
1585  Element_node_enumerator ene(allpanes[i],k+1);
1586  Angle_Metric_3 am;
1587  am.initialize(ene);
1588  am.compute(angles);
1589  file2 << angles[0] << " " << angles[1] << std::endl;
1590  if(angles[1]>max_angle)
1591  max_angle = angles[1];
1592  if(angles[0]<min_angle)
1593  min_angle = angles[0];
1594  }
1595  }
1596  file2.close();
1597 
1598  agree_double(max_angle,MPI_MAX);
1599  agree_double(min_angle,MPI_MIN);
1600 
1601  if (rank==0){
1602  file.open(outstr.c_str(), std::ios::app);
1603  COM_assertion_msg( file, "File failed to open\n");
1604  file << std::left << std::setw(30) << s << std::setw(0)
1605  << "(" << min_angle << " , " << max_angle << ")\n";
1606  file.close();
1607  }
1608 }
virtual void compute(double atts[]) const
Calculate the metric value on this element.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
j indices k indices k
Definition: Indexing.h:6
#define COM_assertion_msg(EX, msg)
double s
Definition: blastest.C:80
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MIN
blockLoc i
Definition: read.cpp:79
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
void agree_double(double &val, MPI_Op op)
Agree on a double value across all panes.
Definition: Rocmop.h:240
void int int * nk
Definition: read.cpp:74
3D Max and Min Angle Metric Class
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
static int rank
Definition: advectest.C:66
int COMMPI_Initialized()
Definition: commpi.h:168
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464

Here is the call graph for this function:

void print_quality ( std::string &  s,
const std::string &  s2 
)
protected

Print the quality range of all elements, for debugging.

void read_config_file ( const std::string &  cfname)

Definition at line 122 of file Rocmop_1.C.

References COMMPI_Initialized(), get_next_line(), MPI_COMM_WORLD, and rank.

123 {
124  std::ifstream Inf;
125  Inf.open(cfname.c_str());
126 
127  // We can't use the usual print_legible function here because the
128  // buffer winodw may not be created yet.
129  int rank =0;
130  if(COMMPI_Initialized()){
131  int ierr = MPI_Comm_rank(MPI_COMM_WORLD,&rank);
132  assert( ierr == 0);
133  }
134 
135  // If the file doesn't exist, fire off a warning and continue
136  if(!Inf){
137  if(rank == 0)
138  std::cerr << "Rocmop: Warning: Could not open configfile, "
139  << cfname << "." << std::endl;
140  return;
141  }
142 
143  std::string line;
144  std::istringstream Istr;
145 
146  // Read and set the verbosity
147  int verbosity;
148  get_next_line(Inf,line,'#');
149  // At this point, "line" should have data in it. By using the
150  // istringstream object this way, we eliminate all whitespace
151  // and extract only the valid part of the line. If the file
152  // has already closed, line will be empty, and verbosity will
153  // usually take on some nonsense value.
154  Istr.str(line);
155  Istr >> verbosity;
156  // If the line had only the one chunk of data in it, Istr will
157  // have a bit set that needs to be cleared with a call to "clear()"
158  // before populating it with another string.
159  Istr.clear();
160  if(verbosity < 0 || verbosity > 10){
161  std::cerr << "Rocmop: Warning: Invalid verbosity from configfile. "
162  << "Giving up on " << cfname << "." << std::endl;
163  Inf.close();
164  return;
165  }
166  _verb = verbosity;
167  // Speak up if verbosity is turned on!
168  if (rank==0 && _verb){
169  std::cout << "Rocmop: Found configfile, " << cfname << "." << std::endl
170  << "Rocmop: Setting verbosity to " << _verb << "." << std::endl;
171  }
172 
173  // Load the next line from configfile and set smoothing method
174  get_next_line(Inf,line,'#');
175  Istr.str(line);
176  Istr >> _method;
177  Istr.clear();
178  if(_method < 0 || _method > SMOOTH_NONE){
179  std::cerr << "Rocmop: Warning: Invalid smoothing method from configfile. "
180  << "Giving up on " << cfname << "." << std::endl;
181  Inf.close();
182  return;
183  }
184  // I love these ternary operators
185  if (rank==0 && _verb){
186  std::cout << "Rocmop: Setting method to "
187  << (_method == SMOOTH_VOL_MESQ_WG ? "SMOOTH_VOL_MESQ_WG" :
188  (_method == SMOOTH_VOL_MESQ_NG ? "SMOOTH_VOL_MESQ_NG" :
189  (_method == SMOOTH_SURF_MEDIAL ? "SMOOTH_SURF_MEDIAL" :
190  "SMOOTH_NONE"))) << "." << std::endl;
191  }
192 
193  // Load the next line and set laziness
194  int lazy;
195  get_next_line(Inf,line,'#');
196  Istr.str(line);
197  Istr >> lazy;
198  Istr.clear();
199  if(lazy > 0)
200  _lazy = 1;
201  if (rank==0 && _verb){
202  std::cout << "Rocmop: Setting lazy to " << _lazy << "." << std::endl;
203  }
204 
205  // Load the next line and set tolerance for lazy threshold
206  float tol;
207  get_next_line(Inf,line,'#');
208 #if ! NO_STRINGSTREAM
209  Istr.str(line);
210  Istr >> tol;
211  Istr.clear();
212 #else
213  sscanf(line.c_str(), "%f", &tol);
214 #endif
215  if(tol < 0. || tol > 180.){
216  std::cerr << "Rocmop: Warning: Invalid dihedral angle tolerance"
217  << " from configfile. "
218  << "Giving up on " << cfname << "." << std::endl;
219  Inf.close();
220  return;
221  }
222  _tol = tol;
223  if (rank==0 && _verb){
224  std::cout << "Rocmop: Setting tolerance to " << _tol << "." << std::endl;
225  }
226 
227  // Load the next line and set node displacement constraint for Mesquite smoothing
228  float max_disp;
229  get_next_line(Inf,line,'#');
230 #if ! NO_STRINGSTREAM
231  Istr.str(line);
232  Istr >> max_disp;
233  Istr.clear();
234 #else
235  sscanf(line.c_str(), "%f", &max_disp);
236 #endif
237  if(max_disp < 0. || max_disp > 10.0){
238  std::cerr << "Rocmop: Warning: Invalid displacement constraint from configfile. "
239  << "Giving up on " << cfname << "." << std::endl;
240  Inf.close();
241  return;
242  }
243  _maxdisp = max_disp;
244  if (rank==0 && _verb){
245  std::cout << "Rocmop: Setting displacement constraint to "
246  << _maxdisp << "." << std::endl;
247  }
248 
249  // Load the next line and set N, which forces Rocmop to smooth every Nth step
250  get_next_line(Inf,line,'#');
251  Istr.str(line);
252  Istr >> _smoothfreq;
253  Istr.clear();
254  if(_smoothfreq <= 0 || _method == SMOOTH_NONE)
255  _smoothfreq = 0;
256  if (rank==0 && _verb){
257  if(_method == SMOOTH_NONE){
258  std::cout << "Rocmop: No method selected, setting N to 0"
259  << ", disabling smoothing." << std::endl;
260  }
261  else{
262  std::cout << "Rocmop: Setting N to " << _smoothfreq
263  << (_smoothfreq==0 ? ", disabling smoothing." : ".")
264  << std::endl;
265  }
266  }
267 
268  // Displacement threshold. When the max displacement among all processors
269  // exceeds this value, smooth.
270  get_next_line(Inf,line,'#');
271 #if ! NO_STRINGSTREAM
272  Istr.str(line);
273  Istr >> _disp_thresh;
274  Istr.clear();
275 #else
276  sscanf(line.c_str(), "%f", &_disp_thresh);
277 #endif
278  if(_disp_thresh < 0.0)
279  _disp_thresh = 0.0;
280  else if ((_smoothfreq > 1) && (_disp_thresh > 0.0) ){
281  _smoothfreq = 1;
282  if(rank==0 && _verb)
283  std::cout << "Rocmop: WARNING: N reset to 1 to enable displacement thresholding."
284  << std::endl;
285  }
286  if (rank==0 && _verb){
287  std::cout << "Rocmop: Setting displacement threshold to "
288  << _disp_thresh << "." << std::endl;
289  }
290 
291  // Close up the file, we're done.
292  Inf.close();
293 
294  N = _smoothfreq-1; // initial value used in smooth() function
295 }
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_COMM_WORLD
int _smoothfreq
Definition: Rocmop_1.h:514
float _maxdisp
Maximum displacement allowed.
Definition: Rocmop_1.h:512
std::ifstream & get_next_line(std::ifstream &Inf, std::string &line, const char noop)
Definition: Rocmop_1.C:106
int _method
Choice of smoothing method.
Definition: Rocmop.h:447
float _disp_thresh
originally a static in check_displacements
Definition: Rocmop_1.h:520
int _verb
Verbose level.
Definition: Rocmop.h:453
int _lazy
Check quality before smoothing?
Definition: Rocmop.h:462
static int rank
Definition: advectest.C:66
int N
Smooth every _smoothfreq&#39;th call.
Definition: Rocmop_1.h:516
int COMMPI_Initialized()
Definition: commpi.h:168
float _tol
Smoother iterating tolerance.
Definition: Rocmop.h:464

Here is the call graph for this function:

void read_config_file ( const std::string &  )
void redistribute_vertices_ridge ( )
protected

Redistribute ridge vertices within their tangent spaces.

Definition at line 547 of file smooth_medial.C.

References _edges, _wrk_window, COM_NC, Rocblas::copy_scalar(), get_redist_safe_factor(), i, min(), Window_manifold_2::OP_SUM, Element_node_enumerator::size_of_edges(), and swap().

Referenced by smooth_surf_medial().

547  {
548  // Use the following buffer spaces: _eigvalues for vector c (only first one)
549 
550  const std::string att1("disps"), att2("lambda"), att3("weights"),
551  att4("cntnvecs"), att5("cntnranks");
552  int disps_id = _wrk_window->attribute(att1)->id();
553  // c_attr are the edge centers
554  // w_attr is the nodal safe factor
555  COM::Attribute *c_attr = _wrk_window->attribute(att2);
556  COM::Attribute *w_attr = _wrk_window->attribute(att3);
557  int cntnvecs_id = _wrk_window->attribute(att4)->id();
558  int cntnranks_id = _wrk_window->attribute(att5)->id();
559 
560  double zero = 0.;
561  Rocblas::copy_scalar( &zero, c_attr);
562 
563  // Loop through the panes and its real faces
564  std::vector< COM::Pane*> allpanes;
565  _wrk_window->panes(allpanes);
566  std::vector< COM::Pane*>::iterator it = allpanes.begin();
567  Window_manifold_2::PM_iterator pm_it=_wm->pm_begin();
568  for ( int i=0, local_npanes = allpanes.size();
569  i<local_npanes; ++i, ++it, ++pm_it) {
570  COM::Pane *pane = *it;
571 
572  Vector_3<double> *es = reinterpret_cast<Vector_3<double>*>
573  ( pane->attribute(cntnvecs_id)->pointer());
574  const Point_3<double> *pnts = reinterpret_cast<Point_3<double>*>
575  (pane->attribute(COM_NC)->pointer());
576  Vector_3<double> *cs = reinterpret_cast<Vector_3<double>*>
577  ( pane->attribute(c_attr->id())->pointer());
578  int *cranks = reinterpret_cast<int*>
579  ( pane->attribute(cntnranks_id)->pointer());
580 
581  std::set< Edge_ID> &eset_pn = _edges[i];
582  for ( std::set< Edge_ID>::const_iterator eit=eset_pn.begin(),
583  eend=eset_pn.end(); eit!=eend; ++eit) {
584  Edge_ID eid = *eit;
585  bool is_border = eid.is_border();
586  if ( is_border) eid = pm_it->get_opposite_real_edge( eid);
587 
588  // Loop through real elements of the current pane
589  Element_node_enumerator ene( pane, eid.eid());
590  int ne = ene.size_of_edges();
591 
592  int vindex=ene[eid.lid()]-1, windex=ene[(eid.lid()+1)%ne]-1;
593  if ( is_border) std::swap( vindex, windex);
594 
595  if ( cranks[vindex]>0) {
596  Vector_3<double> diff_wv = pnts[windex]-pnts[vindex];
597  // OLD:: Vector_3<double> diff_wv = pnts[windex]-pnts[vindex] + ds[windex] - ds[vindex];
598 
599  // get average of edge centers
600  cs[vindex][0] += 0.5*(es[2*vindex]*diff_wv);
601  }
602  }
603  }
604 
605  _wm->reduce_on_shared_nodes( c_attr, Window_manifold_2::OP_SUM);
606 
607  // Loop through all vertices to computer center
608  it = allpanes.begin(); pm_it=_wm->pm_begin();
609  for ( int i=0, local_npanes = allpanes.size();
610  i<local_npanes; ++i, ++it, ++pm_it) {
611  COM::Pane *pane = *it;
612 
613  Vector_3<double> *es = reinterpret_cast<Vector_3<double>*>
614  ( pane->attribute(cntnvecs_id)->pointer());
615  Vector_3<double> *cs = reinterpret_cast<Vector_3<double>*>
616  ( pane->attribute( c_attr->id())->pointer());
617  int *cranks = reinterpret_cast<int*>
618  ( pane->attribute(cntnranks_id)->pointer());
619 
620  // Loop through all real nodes of the pane
621  std::set< Edge_ID> &eset_pn = _edges[i];
622  for ( std::set< Edge_ID>::const_iterator eit=eset_pn.begin(),
623  eend=eset_pn.end(); eit!=eend; ++eit) {
624  Edge_ID eid = *eit;
625  bool is_border = eid.is_border();
626  if ( is_border) eid = pm_it->get_opposite_real_edge( eid);
627 
628  // Loop through real elements of the current pane
629  Element_node_enumerator ene( pane, eid.eid());
630  int ne = ene.size_of_edges();
631 
632  int vindex=ene[eid.lid()]-1, windex=ene[(eid.lid()+1)%ne]-1;
633  if ( is_border) std::swap( vindex, windex);
634 
635  if ( cranks[vindex]>0)
636  cs[vindex] = 0.5*cs[vindex][0]*es[2*vindex];
637  }
638  }
639 
640  // Loop through the panes and its real faces to compute safe factors.
641  get_redist_safe_factor( c_attr, w_attr, 1);
642 
643  // Loop through all vertices to update displacement vector
644  it = allpanes.begin(); pm_it=_wm->pm_begin();
645  for ( int i=0, local_npanes = allpanes.size();
646  i<local_npanes; ++i, ++it, ++pm_it) {
647  COM::Pane *pane = *it;
648 
649  Vector_3<double> *cs = reinterpret_cast<Vector_3<double>*>
650  ( pane->attribute( c_attr->id())->pointer());
651  Vector_3<double> *ds = reinterpret_cast<Vector_3<double>*>
652  ( pane->attribute( disps_id)->pointer());
653  double *ws = reinterpret_cast<double*>
654  ( pane->attribute(w_attr->id())->pointer());
655 
656  // Loop through all real nodes of the pane
657  std::set< Edge_ID> &eset_pn = _edges[i];
658  for ( std::set< Edge_ID>::const_iterator eit=eset_pn.begin(),
659  eend=eset_pn.end(); eit!=eend; ++eit) {
660  Edge_ID eid = *eit;
661  bool is_border = eid.is_border();
662  if ( is_border) eid = pm_it->get_opposite_real_edge( eid);
663 
664  // Loop through real elements of the current pane
665  Element_node_enumerator ene( pane, eid.eid());
666  int ne = ene.size_of_edges();
667 
668  int vindex=ene[eid.lid()]-1, windex=ene[(eid.lid()+1)%ne]-1;
669  if ( is_border) std::swap( vindex, windex);
670 
671  double w=0.5;
672  if ( ws[vindex]>0) w = std::min( w, 1./ws[vindex]);
673  // displacement = w * average of two edge segments
674  ds[vindex] += w*cs[vindex];
675  // do PN triangle stuff here
676  }
677  }
678 }
void swap(int &a, int &b)
Definition: buildface.cpp:88
static MPI_Op OP_SUM
Definition: Manifold_2.h:353
An adaptor for enumerating node IDs of an element.
MAP::Facet_ID Edge_ID
Definition: Manifold_2.h:49
std::vector< Pane_manifold_2 >::iterator PM_iterator
Definition: Manifold_2.h:187
int size_of_edges() const
Number of edges per element.
blockLoc i
Definition: read.cpp:79
void get_redist_safe_factor(COM::Attribute *c_attr, COM::Attribute *w_attr, int rank)
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
static void copy_scalar(const void *x, Attribute *y)
Operation wrapper for copy (x is a scalar pointer).
Definition: op2args.C:583
std::vector< std::set< Edge_ID > > _edges
ridge edges
Definition: Rocmop.h:426

Here is the call graph for this function:

Here is the caller graph for this function:

void redistribute_vertices_ridge ( )
protected

Redistribute ridge vertices within their tangent spaces.

void redistribute_vertices_ridge ( )
protected

Redistribute ridge vertices within their tangent spaces.

void redistribute_vertices_smooth ( )
protected

Redistribute smooth vertices within their tangent spaces.

Definition at line 682 of file smooth_medial.C.

References _wrk_window, cimg_library::acos(), COM_NC, Rocblas::copy_scalar(), get_redist_safe_factor(), half_pi, i, j, k, max(), min(), Element_node_enumerator::next(), nj, Window_manifold_2::OP_SUM, pi, s, Element_node_vectors_k_const< Value >::set(), Element_node_enumerator::size_of_edges(), and sqrt().

Referenced by smooth_surf_medial().

682  {
683 
684  // Use the following buffer spaces: _eigvalues for vector c
685  // (only lsast two components); _weights to store weight
686  const std::string att1("disps"), att2("lambda"), att3("weights"),
687  att4("cntnvecs"), att5("cntnranks"), att6("tangranks");
688  int disps_id = _wrk_window->attribute(att1)->id();
689  COM::Attribute *c_attr = _wrk_window->attribute(att2);
690  COM::Attribute *w_attr = _wrk_window->attribute(att3);
691  int cntnvecs_id = _wrk_window->attribute(att4)->id();
692  int cntnranks_id = _wrk_window->attribute(att5)->id();
693  int tangranks_id = _wrk_window->attribute("tangranks")->id();
694 
695  double zero = 0.;
696  Rocblas::copy_scalar( &zero, c_attr);
697  Rocblas::copy_scalar( &zero, w_attr);
698 
699  std::vector< COM::Pane*> allpanes;
700  _wrk_window->panes(allpanes);
701  // Loop through the panes and its real faces
702  std::vector< COM::Pane*>::iterator it = allpanes.begin();
703  for (int i=0, local_npanes = allpanes.size(); i<local_npanes; ++i, ++it) {
704  COM::Pane *pane = *it;
705 
706  Vector_3<double> *es = reinterpret_cast<Vector_3<double>*>
707  ( pane->attribute(cntnvecs_id)->pointer());
708  const Point_3<double> *pnts = reinterpret_cast<Point_3<double>*>
709  (pane->attribute(COM_NC)->pointer());
710  Vector_3<double> *cs = reinterpret_cast<Vector_3<double>*>
711  ( pane->attribute(c_attr->id())->pointer());
712  double *ws = reinterpret_cast<double*>
713  ( pane->attribute(w_attr->id())->pointer());
714  Vector_3<double> *ds = reinterpret_cast<Vector_3<double>*>
715  ( pane->attribute(disps_id)->pointer());
716  int *tranks = reinterpret_cast<int*>
717  ( pane->attribute(tangranks_id)->pointer());
718  int *cranks = reinterpret_cast<int*>
719  ( pane->attribute(cntnranks_id)->pointer());
720 
721  // Loop through real elements of the current pane
722  Element_node_enumerator ene( pane, 1);
723  Element_node_vectors_k_const<Point_3<double> > ps; ps.set( pnts, ene, 1);
724 
725  for ( int j=0, nj=pane->size_of_real_elements(); j<nj; ++j, ene.next()) {
726  int ne = ene.size_of_edges();
727  int uindex=ene[ne-1]-1, vindex=ene[0]-1;
728 
729  // Loop through all vertices of current face.
730  for ( int k=0; k<ne; ++k) {
731  int windex = ene[(k+1==ne)?0:k+1]-1;
732 
733  // Only redistribute smooth vertices
734  if ( tranks[vindex]==2) {
735  std::cout << "cranks[vindex]-1 = " << cranks[vindex]-1 << std::endl;
736  Vector_3<double> tngs[2] = {pnts[uindex]-pnts[vindex],
737  pnts[windex]-pnts[vindex]};
738  Vector_3<double> disp_v = ds[vindex];
739  Vector_3<double> diff_uv = ds[uindex]-disp_v+tngs[0];
740  Vector_3<double> diff_wv = ds[windex]-disp_v+tngs[1];
741 
742  // Compute angle at vertex
743  double theta = std::acos
744  ( diff_uv*diff_wv/std::sqrt((diff_wv*diff_wv)*(diff_uv*diff_uv)));
745  std::cout << "theta = " << theta << std::endl;
746 
747  if ( theta>half_pi) theta = std::max(0.,pi-theta);
748  std::cout << "theta 2 = " << theta << std::endl;
749 
750  for ( int k=cranks[vindex]-1; k>=0; --k) {
751  cs[vindex][k] += theta*(es[2*vindex+k]*(diff_uv+diff_wv));
752  // std::cout << "cs[" << vindex << "][" << k << "] += "
753  // << theta << "*(" << es[2*vindex+k] << " * ("
754  // << diff_uv << " + " << diff_wv << "))\n";
755  }
756  ws[vindex] += theta;
757  // std::cout << "ws[" << vindex << "] = " << ws[vindex] << std::endl;
758  }
759 
760  uindex=vindex; vindex=windex;
761  }
762  }
763  }
764  _wm->reduce_on_shared_nodes( c_attr, Window_manifold_2::OP_SUM);
765  _wm->reduce_on_shared_nodes( w_attr, Window_manifold_2::OP_SUM);
766 
767  // Loop through all vertices to compute center of stars.
768  it = allpanes.begin();
769  for (int i=0, local_npanes = allpanes.size(); i<local_npanes; ++i, ++it) {
770  COM::Pane *pane = *it;
771 
772  Vector_3<double> *cs = reinterpret_cast<Vector_3<double>*>
773  ( pane->attribute( c_attr->id())->pointer());
774  double *ws = reinterpret_cast<double*>
775  ( pane->attribute( w_attr->id())->pointer());
776  int *tranks = reinterpret_cast<int*>
777  ( pane->attribute(tangranks_id)->pointer());
778  Vector_3<double> *es = reinterpret_cast<Vector_3<double>*>
779  ( pane->attribute(cntnvecs_id)->pointer());
780  int *cranks = reinterpret_cast<int*>
781  ( pane->attribute(cntnranks_id)->pointer());
782 
783  // Loop through all real nodes of the pane
784  for ( int j=0, nj=pane->size_of_real_nodes(); j<nj; ++j) {
785  if ( tranks[j]==2) {
786  Vector_3<double> s(0,0,0);
787  for ( int k=cranks[j]-1; k>=0; --k) {
788  s += (cs[j][k]*es[2*j+k])/ws[j];
789  }
790  cs[j] = s;
791  }
792  }
793  }
794 
795  // Loop through the panes and its real faces to compute safe factors.
796  get_redist_safe_factor( c_attr, w_attr, 2);
797 
798  // Loop through all vertices to update displacement vector
799  it = allpanes.begin();
800  for (int i=0, local_npanes = allpanes.size(); i<local_npanes; ++i, ++it) {
801  COM::Pane *pane = *it;
802 
803  Vector_3<double> *cs = reinterpret_cast<Vector_3<double>*>
804  ( pane->attribute( c_attr->id())->pointer());
805  double *ws = reinterpret_cast<double*>
806  ( pane->attribute( w_attr->id())->pointer());
807  Vector_3<double> *ds = reinterpret_cast<Vector_3<double>*>
808  ( pane->attribute( disps_id)->pointer());
809  int *tranks = reinterpret_cast<int*>
810  ( pane->attribute( tangranks_id)->pointer());
811 
812  // Loop through all real nodes of the pane
813  for ( int j=0, nj=pane->size_of_real_nodes(); j<nj; ++j) {
814  if ( tranks[j]==2) {
815  double w=0.5;
816  if ( ws[j]>0) w = std::min( w, 1./ws[j]);
817  ds[j] += w*cs[j];
818  std::cout << "ds[" << j << "] += " << w << " * " << cs[j] << std::endl;
819  }
820  }
821  }
822 }
static MPI_Op OP_SUM
Definition: Manifold_2.h:353
An adaptor for enumerating node IDs of an element.
static const double half_pi
Definition: smooth_medial.C:42
j indices k indices k
Definition: Indexing.h:6
double s
Definition: blastest.C:80
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
double sqrt(double d)
Definition: double.h:73
static const double pi
Definition: smooth_medial.C:43
This is a helper class for accessing nodal data.
blockLoc i
Definition: read.cpp:79
void get_redist_safe_factor(COM::Attribute *c_attr, COM::Attribute *w_attr, int rank)
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
static void copy_scalar(const void *x, Attribute *y)
Operation wrapper for copy (x is a scalar pointer).
Definition: op2args.C:583
j indices j
Definition: Indexing.h:6
void set(const Value *p, Element_node_enumerator &ene, int strd)
initialize the accessor with a pointer and a specific stride.
CImg< _cimg_Tfloat > acos(const CImg< T > &instance)
Definition: CImg.h:6051
void int * nj
Definition: read.cpp:74

Here is the call graph for this function:

Here is the caller graph for this function:

void redistribute_vertices_smooth ( )
protected

Redistribute smooth vertices within their tangent spaces.

void redistribute_vertices_smooth ( )
protected

Redistribute smooth vertices within their tangent spaces.

static void reduce_sum_on_shared_nodes ( COM::Attribute *  att)
staticprotected

Perform a sum-reduction on the shared nodes for the given attribute.

void reduce_sum_on_shared_nodes ( COM::Attribute *  att)
staticprotected

Perform a sum-reduction on the shared nodes for the given attribute.

Definition at line 595 of file Rocmop.C.

References MPI_SUM.

595  {
596  Pane_communicator pc(att->window(), att->window()->get_communicator());
597  pc.init(att);
598  pc.begin_update_shared_nodes();
599  pc.reduce_on_shared_nodes(MPI_SUM);
600  pc.end_update_shared_nodes();
601 }
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_SUM
static void reduce_sum_on_shared_nodes ( COM::Attribute *  att)
staticprotected

Perform a sum-reduction on the shared nodes for the given attribute.

void set_value ( const char *  opt,
const void *  val 
)

Set a Rocomp option.

Parameters
optthe option to be set.
valthe new value for the option.

Option List:

  • name (data type, default value)
  • method (int, SMOOTH_NONE) smoothing method to use
    • SMOOTH_VOL_MESQ_WG (Volume smoothing via mesquite with ghost)
    • SMOOTH_VOL_MESQ_NG (Volume smoothing via mesquite no ghosts)
    • SMOOTH_SURF_MEDIAL (Surface smoothing via medial quadric)
    • SMOOTH_NONE (None, default).
  • verbose (int, 0) verbose level, an integer greater than -1
  • lazy (int, 0) check quality before smoothing? 0 or 1
  • tol (float, 0.0) looping quality tolerance [0,180]
  • niter (int, 1) max # iterations for smoothing
  • ctol (float, .99) convergence subcycle tolerance [0,1]
  • ncycle (int, 1) max # subcycles for convergence
  • inverted (int, 0) tets are inverted? 0 or 1
  • monotone (int, 0) apply a non-decreasing invariant?
void set_value ( const char *  opt,
const void *  val 
)

Set a Rocomp option.

Parameters
optthe option to be set.
valthe new value for the option.

Option List:

  • name (data type, default value)
  • method (int, SMOOTH_NONE) smoothing method to use
    • SMOOTH_VOL_MESQ_WG (Volume smoothing via mesquite with ghost)
    • SMOOTH_VOL_MESQ_NG (Volume smoothing via mesquite no ghosts)
    • SMOOTH_SURF_MEDIAL (Surface smoothing via medial quadric)
    • SMOOTH_NONE (None, default).
  • verbose (int, 0) verbose level, an integer greater than -1
  • lazy (int, 0) check quality before smoothing? 0 or 1
  • tol (float, 0.0) looping quality tolerance [0,180]
  • niter (int, 1) max # iterations for smoothing
  • ctol (float, .99) convergence subcycle tolerance [0,1]
  • ncycle (int, 1) max # subcycles for convergence
  • inverted (int, 0) tets are inverted? 0 or 1
  • monotone (int, 0) apply a non-decreasing invariant?

Definition at line 529 of file Rocmop.C.

References COM_assertion_msg, and cimg_library::cimg::option().

Referenced by load().

530 {
531  if(_verb)
532  std::cout << "Entering Rocmop::set_value" << std::endl;
533 
534  COM_assertion_msg( validate_object()==0, "Invalid object");
535 
536  COM_assertion_msg( opt && value,
537  "Rocmop::set_value does not except NULL parameters");
538  std::string option;
539  if(opt) option = opt;
540  if ( option == "method") {
541  COM_assertion_msg( *((int*)value) <= SMOOTH_NONE && *((int*)value)>=0
542  ,"Illegal value for 'method' option");
543  _method = *((int*)value);
544  }
545  else if ( option == "verbose"){
546  _verb = *((int*)value); }
547  else if ( option == "lazy"){
548  _lazy = *((int*)value); }
549  else if ( option == "tol"){
550  COM_assertion_msg( *((float*)value) <= 180. && *((float*)value)>=0.
551  ,"Illegal value for 'method' option");
552  _tol = *((float*)value); }
553  else if ( option == "niter"){
554  _niter = *((int*)value); }
555  else if ( option == "ctol"){
556  COM_assertion_msg( *((float*)value) <= 1. && *((float*)value)>=0.
557  ,"Illegal value for 'method' option");
558  _ctol = *((float*)value); }
559  else if ( option == "ncycle"){
560  _ncycle = *((int*)value); }
561  else if ( option == "inverted"){
562  _invert = *((int*)value);
563  }
564  else COM_assertion_msg( false, "Unknown option");
565 
566  if(_verb > 1)
567  std::cout << "Exiting Rocmop::set_value" << std::endl;
568 }
int validate_object() const
Check that the object is valid.
Definition: Rocmop.h:206
const char * option(const char *const name, const int argc, const char *const *const argv, const char *defaut, const char *const usage=0)
Definition: CImg.h:5604
int _ncycle
Max number of subcycles for convergence.
Definition: Rocmop.h:479
#define COM_assertion_msg(EX, msg)
int _method
Choice of smoothing method.
Definition: Rocmop.h:447
int _niter
Maximum number of iterations for smoothing.
Definition: Rocmop.h:469
int _invert
If true (default false), then invert the mesh.
Definition: Rocmop.h:489
int _verb
Verbose level.
Definition: Rocmop.h:453
float _ctol
Subcycling tolerance.
Definition: Rocmop.h:471
int _lazy
Check quality before smoothing?
Definition: Rocmop.h:462
float _tol
Smoother iterating tolerance.
Definition: Rocmop.h:464

Here is the call graph for this function:

Here is the caller graph for this function:

void set_value ( const char *  opt,
const void *  val 
)

Set a Rocomp option.

Parameters
optthe option to be set.
valthe new value for the option.

Option List:

  • name (data type, default value)
  • method (int, SMOOTH_NONE) smoothing method to use
    • SMOOTH_VOL_MESQ_WG (Volume smoothing via mesquite with ghost)
    • SMOOTH_VOL_MESQ_NG (Volume smoothing via mesquite no ghosts)
    • SMOOTH_SURF_MEDIAL (Surface smoothing via medial quadric)
    • SMOOTH_NONE (None, default).
  • verbose (int, 0) verbose level, an integer greater than -1
  • lazy (int, 0) check quality before smoothing? 0 or 1
  • tol (float, 0.0) looping quality tolerance [0,180]
  • niter (int, 1) max # iterations for smoothing
  • ctol (float, .99) convergence subcycle tolerance [0,1]
  • ncycle (int, 1) max # subcycles for convergence
  • inverted (int, 0) tets are inverted? 0 or 1
  • monotone (int, 0) apply a non-decreasing invariant?
void smooth ( const COM::Attribute *  pmesh,
COM::Attribute *  disp 
)

Smooth the mesh in a Rocmop managed buffer.

Creates a copy of the mesh, which is then optimized in place via perform_smoothing().

Parameters
pmeshThe pmesh to be smoothed.
dispThe attribute where displacements to new positions should be stored.

Definition at line 132 of file Rocmop.C.

References COM_assertion_msg, COM_MESH, COM_NC, COM_PMESH, MPI_MAX, and Rocblas::sub().

Referenced by load().

133  {
134  COM_assertion_msg( validate_object()==0, "Invalid object");
135  if(_verb)
136  cout << "Entering Rocmop::smooth\n";
137 
138  int pmesh_id = pmesh->id();
139  COM_assertion_msg( pmesh &&
140  (pmesh_id==COM::COM_PMESH || pmesh_id==COM::COM_MESH),
141  "Input to Rocmop::smooth must be a pmesh.");
142  _is_pmesh = (pmesh_id == COM_PMESH) ? true : false;
143 
144  if(_wrk_window) delete _wrk_window;
145  _usr_window = pmesh->window();
146 
147  // Create a buffer window by inheriting(clone) from the user's mesh.
148  if (_verb >3)
149  std::cout << " Creating(clone) buffer window." << std::endl;
150  std::string buf_name(_usr_window->name()+"-Rocmopbuf");
151  _wrk_window = new COM::Window(buf_name,
152  _usr_window->get_communicator());
153  _wrk_window->inherit( const_cast<COM::Attribute*>(pmesh), "",
154  COM::Pane::INHERIT_CLONE, true, NULL, 0);
155  _wrk_window->init_done();
156 
157  std::vector<const Pane*> allpanes;
158  _wrk_window->panes(allpanes);
159 
160  double pre_worst = 180.0, post_worst = 0.0;
161 
162  // Check initial quality if we are in lazy or monotone mode
163  if(_monotone || _lazy){
164  pre_worst = check_all_elem_quality(allpanes);
165  // get the worst pre smoothing quality across all panes
166  agree_double(pre_worst, MPI_MAX);
167  }
168 
169  bool to_smooth = (!_lazy || (pre_worst > 180.*_tol));
170 
171  int degraded = 0;
172  if (to_smooth){
173  perform_smoothing(pre_worst);
174 
175  // Check final mesh quality if a tolerance is set, or we're in monotonic mode
176  if(_monotone || (_tol!=0.0)){
177  post_worst = check_all_elem_quality(allpanes);
178  agree_double(post_worst, MPI_MAX);
179  }
180 
181  // If in monotone mode, see if quality degraded on any pane
182  if(_monotone && (pre_worst > post_worst)){
183  cerr << "Warning, smoothing would have degraded mesh quality \n"
184  << "so the mesh has not been modified.\n";
185  degraded = 1;
186  }
187 
188  // Warn the user if could not reach a specified minimum mesh quality.
189  if(_tol && (post_worst < _tol)){
190  cerr << "Warning, post-smoothing mesh quality is below specified minimum "
191  << "quality \n";
192  }
193  }
194 
195  const COM::Attribute *old_nc = pmesh->window()->attribute( COM::COM_NC);
196  const COM::Attribute *new_nc = (degraded || !to_smooth) ?
197  old_nc :_wrk_window->attribute( COM::COM_NC);
198  Rocblas::sub (new_nc, old_nc, disp);
199 
200  if (_verb > 1)
201  std::cout << "Exiting rocmop::smooth" << std::endl;
202 }
static void sub(const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for subtraction.
Definition: op3args.C:237
int validate_object() const
Check that the object is valid.
Definition: Rocmop.h:206
double check_all_elem_quality(std::vector< const COM::Pane * > &allpanes, bool with_ghost=false)
Get the largest dihedral angle of all real elements.
Definition: Rocmop.C:785
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
#define COM_assertion_msg(EX, msg)
void perform_smoothing()
Perform smoothing on _buf_window.
Definition: Rocmop_1.C:776
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
int _monotone
Impose non-decreasing quality?
Definition: Rocmop.h:481
int _verb
Verbose level.
Definition: Rocmop.h:453
bool _is_pmesh
pmesh or mesh ?
Definition: Rocmop.h:441
void agree_double(double &val, MPI_Op op)
Agree on a double value across all panes.
Definition: Rocmop.h:240
int _lazy
Check quality before smoothing?
Definition: Rocmop.h:462
float _tol
Smoother iterating tolerance.
Definition: Rocmop.h:464

Here is the call graph for this function:

Here is the caller graph for this function:

void smooth ( const COM::Attribute *  pmesh,
COM::Attribute *  disp 
)

Smooth the mesh in a Rocmop managed buffer.

Creates a copy of the mesh, which is then optimized in place via perform_smoothing().

Parameters
pmeshThe pmesh to be smoothed.
dispThe attribute where displacements to new positions should be stored.
void smooth ( const COM::Attribute *  pmesh,
COM::Attribute *  disp,
double *  timestep = NULL 
)

Smooth the mesh in a Rocmop managed buffer.

Creates a copy of the mesh, which is then optimized in place via perform_smoothing().

Parameters
pmeshThe pmesh to be smoothed.
dispThe attribute where displacements to new positions should be stored.
timestepIf a timestep is supplied, then disp will contain velocity vectors instead of displacement vectors

Definition at line 700 of file Rocmop_2.C.

References COM_assertion_msg, COM_MESH, COM_PMESH, and MPI_MAX.

702  {
703 
704  // The static var N will statically store the current value of
705  // N. When N == 0, we will smooth and set N back to (_smoothfreq - 1).
706  // What this amounts to is that we smooth only every _smoothfreqth call
707  // to Rocmop. _smoothfreq is specified as "N" in the config file.
708  static int N = (_smoothfreq-1);
709 
710  if(N == 0){ // Go ahead and actually smooth if this is true
711  N = (_smoothfreq-1); // Reset N
712 
713  // We want to start profiling from here as it's smoothing we
714  // want to time, not the NOOP calls.
715 #ifdef ROCPROF
716  Profile_begin("Rocmop::smooth");
717 #endif
718 
719  COM_assertion_msg( validate_object()==0, "Invalid object");
720 
721  // Verify that we are working with a mesh or pmesh
722  int pmesh_id = pmesh->id();
723  COM_assertion_msg( pmesh &&
724  (pmesh_id==COM::COM_PMESH || pmesh_id==COM::COM_MESH),
725  "Input to Rocmop::smooth must be a mesh or pmesh attribute.");
726  _is_pmesh = (pmesh_id == COM_PMESH) ? true : false;
727 
728  // If buffer window exists and was cloned from the current user
729  // window, then just update the coordinates.
730 
731  if(_buf_window && (_usr_window == pmesh->window()))
732  {
733  // update nodel coordinates (real part) from _usr_window
735  }
736 
737  // Else, inherit(clone) a buffer window from the user's mesh.
738  else
739  {
740  // Eliminate any old buffers
741  if(_buf_window)
742  delete _buf_window;
743 
744  _usr_window = pmesh->window();
745 
746  // First, check if pconn of _usr_window is complete
747  int pconnErr = 0;
748  pconnErr = check_input_pconn();
749  agree_int(pconnErr, MPI_MAX);
750  if (pconnErr == 1)
751  COM_assertion_msg(pconnErr == 0, "*** Rocmop:ERROR: PCONN incomplete ***");
752 
753  // Create a buffer window by cloning from the user window
754  std::string buf_name(_usr_window->name()+"-Rocmopbuf");
755  _buf_window = new COM::Window(buf_name,
756  _usr_window->get_communicator());
757  _buf_window->inherit( const_cast<COM::Attribute*>(_usr_window->attribute(COM::COM_MESH)), "",
758  COM::Pane::INHERIT_CLONE, false, NULL, 0);
759  _buf_window->init_done();
760 
761  // Add the pconn
762  if(_buf_window->size_of_panes_global() > 1){
763  Pane_ghost_connectivity pgc(_buf_window);
764  pgc.build_pconn();
765  }
766 
767  // Perform initialization specific to the smoother.
769  }
770 
771  // Max possible worst element quality is 180.0, so this
772  // default should result in mesh smoothing if _lazy==0
773  double mesh_qual = 190.0;
774 
775  // Check initial quality if we are in lazy mode
776  if(_lazy){
777 
778  // Fill a vector with pointers to the local panes
779  std::vector<const Pane*> allpanes;
780  _buf_window->panes(allpanes);
781  mesh_qual = check_all_elem_quality(allpanes);
782  }
783 
784  // Mechanism to trigger smoothing on tallied displacements
785  bool exceeded = true;
786  if(_disp_thresh > 0.0)
787  exceeded = check_displacements(disp);
788 
789  if(exceeded || ((mesh_qual > _tol) && _lazy)){
790  print_legible(0,"Smoothing...");
792  print_legible(0,"Smoothing complete.");
793 
794  // At this point NC in _buf_window has been smoothed.
795  // Get displacement.
796  get_usr_disp(pmesh, disp, timestep);
797  }
798  else
799  {
800  _usr_window = pmesh->window();
801  zero_displacements(disp);
802  }
803 
804 #ifdef ROCPROF
805  Profile_end("Rocmop::smooth");
806 #endif
807  } // if (N says it's smoothing time
808  else{
809  if(_smoothfreq > 0)
810  N--;
811  _usr_window = pmesh->window();
812  zero_displacements(disp);
813  }
814 }
int validate_object() const
Check that the object is valid.
Definition: Rocmop.h:206
int _smoothfreq
Definition: Rocmop_1.h:514
double check_all_elem_quality(std::vector< const COM::Pane * > &allpanes, bool with_ghost=false)
Get the largest dihedral angle of all real elements.
Definition: Rocmop.C:785
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
#define COM_assertion_msg(EX, msg)
void get_usr_disp(const COM::Attribute *pmesh, COM::Attribute *disp, double *timestep)
Get displacement in _usr_window based on nc in _buf_window.
Definition: Rocmop_2.C:1001
void zero_displacements(COM::Attribute *disp)
Definition: Rocmop_1.C:426
void update_buf_real_nc()
Update real nodal coordinates of _buf_window from _usr_window.
Definition: Rocmop_2.C:824
void perform_smoothing()
Perform smoothing on _buf_window.
Definition: Rocmop_1.C:776
int check_input_pconn()
Check pconn block 3 of the input mesh.
Definition: Rocmop_2.C:886
void print_legible(int verb, const char *msg)
Single process print message if given verbosity level is exceeded.
Definition: Rocmop_1.C:1408
float _disp_thresh
originally a static in check_displacements
Definition: Rocmop_1.h:520
bool _is_pmesh
pmesh or mesh ?
Definition: Rocmop.h:441
void smoother_specific_init()
Perform smoother specific initialization.
Definition: Rocmop.C:364
int _lazy
Check quality before smoothing?
Definition: Rocmop.h:462
void agree_int(int &val, MPI_Op op)
Agree on an integer value across all panes.
Definition: Rocmop.h:226
int N
Smooth every _smoothfreq&#39;th call.
Definition: Rocmop_1.h:516
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464
float _tol
Smoother iterating tolerance.
Definition: Rocmop.h:464
bool check_displacements(COM::Attribute *disp)
Definition: Rocmop_1.C:357
void smooth_boeing ( COM::Attribute *  att,
int *  niter 
)
protected

Definition at line 1471 of file Rocmop_2.C.

1471  {
1472  /*
1473  std::vector<Pane*> allpanes;
1474  att->window()->panes(allpanes);
1475 
1476  COM_assertion_msg(allpanes.size() == 1,
1477  "This function only supports winows with a single pane\n");
1478 
1479  MesqPane mp(allpanes[0],false);
1480 
1481  if(_wrapper == WRAPPER_SHAPE){
1482 
1483  Mesquite::MsqError err;
1484  ShapeImprovementWrapper mesh_quality_algorithm(err);
1485  MSQ_ERRRTN(err);
1486  for(int i=0; i< *niter; ++i){
1487  mesh_quality_algorithm.run_instructions(&mp,err);
1488  MSQ_ERRRTN(err);
1489  }
1490  }
1491  else if(_wrapper == WRAPPER_BOEING){
1492  Mesquite::MsqError err;
1493  CGWrapper mesh_quality_algorithm(err);
1494  MSQ_ERRRTN(err);
1495  for(int i=0; i< *niter; ++i){
1496  mesh_quality_algorithm.run_instructions(&mp,err);
1497  MSQ_ERRRTN(err);
1498  }
1499  }
1500  */
1501 }
void smooth_in_place ( COM::Attribute *  pmesh)

Smooth a mesh in place..

The mesh is optimized in place via perform_smoothing().

Parameters
pmeshThe pmesh to be smoothed.

Definition at line 204 of file Rocmop.C.

References COM_assertion_msg, COM_MESH, COM_PMESH, and MPI_MIN.

Referenced by load().

204  {
205  COM_assertion_msg( validate_object()==0, "Invalid object");
206  if (_verb)
207  std::cout << "Entering rocmop::smooth_in_place" << std::endl;
208 
209  int pmesh_id = pmesh->id();
210 
211  COM_assertion_msg( pmesh &&
212  (pmesh_id==COM::COM_PMESH || pmesh_id==COM::COM_MESH) ,
213  "Input to Rocmop::smooth_in_place must be a mesh or pmesh");
214 
215  if(_wrk_window)
216  delete _wrk_window;
217  _usr_window = pmesh->window();
218 
219  // FIXME
220  // Create a buffer window by inheriting(use) from the user's mesh.
221  // can't use the _usr_window directly because of problems with
222  // Element_node_enumerator
223  _wrk_window = new COM::Window(_usr_window->name()+"-Rocmopbuf",
224  _usr_window->get_communicator());
225  _wrk_window->inherit( const_cast<COM::Attribute*>(pmesh), "",
226  false, true, NULL, 0);
227  _wrk_window->init_done();
228 
229  std::vector<const Pane*> allpanes;
230  _wrk_window->panes(allpanes);
231 
232  double pre_worst = 180.0, post_worst = 0.0;
233 
234  // Check initial quality if we are in lazy or monotone mode
235  if(_monotone || _lazy) {
236  pre_worst = check_all_elem_quality(allpanes);
237  // get the worst pre smoothing quality on all panes
238  agree_double(pre_worst, MPI_MIN);
239  }
240 
241  bool to_smooth = (!_lazy || (pre_worst > 180.*_tol));
242 
243  if (to_smooth){
244  perform_smoothing(pre_worst);
245 
246  // Check final mesh quality if a tolerance is set, or we're in monotonic mode
247  if(_monotone || (_tol!=0.0)){
248  post_worst = check_all_elem_quality(allpanes);
249  agree_double(post_worst, MPI_MIN);
250  }
251 
252  // If in monotone mode, see if quality degraded on any pane
253  if(_monotone && (pre_worst > post_worst))
254  cerr << "Warning, mesh quality degraded during smoothing in place." << endl;
255 
256  // If a quality tolerance is set, and we didn't meet it, then warn
257  if(_tol && (post_worst < _tol)){
258  cerr << "Warning, post-smoothing mesh quality is below specified minimum "
259  << "quality \n";
260  }
261  }
262 
263  if (_wrk_window){ delete _wrk_window;_wrk_window = NULL;}
264 
265  if (_verb > 1)
266  std::cout << "Exiting rocmop::smooth_in_place" << std::endl;
267 }
int validate_object() const
Check that the object is valid.
Definition: Rocmop.h:206
double check_all_elem_quality(std::vector< const COM::Pane * > &allpanes, bool with_ghost=false)
Get the largest dihedral angle of all real elements.
Definition: Rocmop.C:785
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
#define COM_assertion_msg(EX, msg)
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MIN
void perform_smoothing()
Perform smoothing on _buf_window.
Definition: Rocmop_1.C:776
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
int _monotone
Impose non-decreasing quality?
Definition: Rocmop.h:481
int _verb
Verbose level.
Definition: Rocmop.h:453
void agree_double(double &val, MPI_Op op)
Agree on a double value across all panes.
Definition: Rocmop.h:240
int _lazy
Check quality before smoothing?
Definition: Rocmop.h:462
float _tol
Smoother iterating tolerance.
Definition: Rocmop.h:464

Here is the caller graph for this function:

void smooth_in_place ( COM::Attribute *  pmesh)

Smooth a mesh in place..

The mesh is optimized in place via perform_smoothing().

Parameters
pmeshThe pmesh to be smoothed.
void smooth_mesquite ( std::vector< COM::Pane * > &  allpanes,
int  ghost_level = 0 
)
protected

Smooth the panes of the working window using MESQUITE.

This method creates MesqPane attributes for each of the local panes, which are then smoothed serially.

Parameters
ghost_levelwhether to use ghost cells and nodes.

Definition at line 570 of file Rocmop.C.

References MeshSet::add_mesh(), j, MSQ_CHKERR, ShapeImprovementWrapper::run_instructions(), MesqPane::set_verb(), and total_npanes.

571  {
572 
573  Mesquite::MsqError err;
574  MesqPane *mp;
575  ShapeImprovementWrapper mesh_quality_algorithm;
576 
577  int total_npanes = (int)allpanes.size();
578  bool wg = (ghost_level == 0) ? false : true;
579  for(int j=0; j < total_npanes; ++j){
580  MeshSet* mesh_set1 = new MeshSet;
581  mp = new MesqPane(allpanes[j], wg);
582  if(_verb > 4)
583  mp->set_verb(_verb - 4);
584  mesh_set1->add_mesh(mp, err);
585  MSQ_CHKERR(err);
586  mesh_quality_algorithm.run_instructions(*mesh_set1, err);
587  MSQ_CHKERR(err);
588  delete mesh_set1;
589  if(mp)
590  delete mp;
591  mp = NULL;
592  }
593 }
void set_verb(int verb)
Set the MesqPane verbose level (int, &gt;= 0)
Definition: MesqPane.h:144
Used to hold the error state and return it to the application.
virtual void run_instructions(MeshSet &ms, MsqError &err)
run_instructions runs the wrapper on the given MeshSet.
const int total_npanes
Definition: ex1.C:94
#define MSQ_CHKERR(err)
Mesquite&#39;s Error Checking macro.
A class enabling Mesquite calls on Rocmop panes.
Definition: MesqPane.h:95
Wrapper which performs a Feasible Newton solve using an objective function template with inverse mea...
int _verb
Verbose level.
Definition: Rocmop.h:453
j indices j
Definition: Indexing.h:6
void add_mesh(Mesquite::Mesh *mesh, MsqError &err)
adds a mesh to the MeshSet.
The MeshSet class stores one or more Mesquite::Mesh pointers and manages access to the mesh informati...

Here is the call graph for this function:

void smooth_mesquite ( std::vector< COM::Pane * > &  allpanes,
int  ghost_level = 0 
)
protected

Smooth the panes of the buffer window using MESQUITE.

This method creates MesqPane attributes for each of the local panes, which are then smoothed serially.

Parameters
ghost_levelwhether to use ghost cells and nodes.
void smooth_mesquite ( std::vector< COM::Pane * > &  allpanes,
int  ghost_level = 0 
)
protected

Smooth the panes of the buffer window using MESQUITE.

This method creates MesqPane attributes for each of the local panes, which are then smoothed serially.

Parameters
ghost_levelwhether to use ghost cells and nodes.
void smooth_surf_medial ( )
protected

Smooths a surface using the medial quadric.

Definition at line 230 of file smooth_medial.C.

References _rediter, _usr_window, _verb, _wrk_window, COM_assertion_msg, COM_NC, compute_medial_quadric(), Rocblas::copy(), evaluate_face_normals(), i, redistribute_vertices_ridge(), and redistribute_vertices_smooth().

230  {
231  if(_verb > 1)
232  std::cout << "Entering Rocmop::smooth_medial" << std::endl;
233 
234  COM_assertion_msg(_wrk_window, "Unexpected NULL pointer encountered.");
235 
236  // Calculate the face normals
238 
239  // Compute the medial quadric
241 
242 #if EXPORT_DEBUG_INFO
243  COM::Attribute *vnormals = const_cast<COM::Attribute*>(_usr_window->attribute("vnormals"));
244  COM::Attribute *vnrms = _wrk_window->attribute("vnormals");
245  COM::Attribute *awnormals = const_cast<COM::Attribute*>(_usr_window->attribute("angleweighted"));
246  COM::Attribute *awnrms = _wrk_window->attribute("awnormals");
247  COM::Attribute *uwnormals = const_cast<COM::Attribute*>(_usr_window->attribute("unitweighted"));
248  COM::Attribute *uwnrms = _wrk_window->attribute("uwnormals");
249  COM::Attribute *tangranks = const_cast<COM::Attribute*>(_usr_window->attribute("tangranks"));
250  COM::Attribute *tranks = _wrk_window->attribute("tangranks");
251  COM::Attribute *evals = _wrk_window->attribute("lambda");
252  COM::Attribute *eigenvalues = const_cast<COM::Attribute*>(_usr_window->attribute("eigenvalues"));
253  COM::Attribute *ws = _wrk_window->attribute("weights");
254  COM::Attribute *weights = const_cast<COM::Attribute*>(_usr_window->attribute("adefects"));
255 
256  if ( vnormals) Rocblas::copy( vnrms, vnormals);
257  if ( awnormals) Rocblas::copy( awnrms, awnormals);
258  if ( uwnormals) Rocblas::copy( uwnrms, uwnormals);
259  if ( tangranks) Rocblas::copy( tranks, tangranks);
260  if ( eigenvalues) Rocblas::copy(evals, eigenvalues);
261  if ( weights) Rocblas::copy(ws,weights);
262 #endif
263 
264  // Identify ridge edges
265  //identify_ridge_edges();
266 
267  // Redistribute vertices within their tangent spaces
268  // FIXME.... MODIFY THESE TO USE PN TRIANGLES
269  for ( int i=0; i<_rediter; ++i) {
272  }
273 
274  // Add the displacements onto the nodal coords
275  // FIXME
276  const std::string att1("disps");
277  COM::Attribute *disps = _wrk_window->attribute(att1);
278  COM::Attribute *nc = _wrk_window->attribute( COM::COM_NC);
279  // Rocblas::add(disps,nc,nc);
280 
281  if(_verb > 2)
282  std::cout << "Exiting Rocmop::smooth_medial" << std::endl;
283 }
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
#define COM_assertion_msg(EX, msg)
void compute_medial_quadric()
Compute medial quadric for every vertex.
void evaluate_face_normals()
Evaluate face normals (copied from FaceOffset_3.[hC].
void redistribute_vertices_smooth()
Redistribute smooth vertices within their tangent spaces.
blockLoc i
Definition: read.cpp:79
int _rediter
No.iterations for vertex redistribution.
Definition: Rocmop.h:423
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
void redistribute_vertices_ridge()
Redistribute ridge vertices within their tangent spaces.
int _verb
Verbose level.
Definition: Rocmop.h:453
static void copy(const Attribute *x, Attribute *y)
Wrapper for copy.
Definition: op2args.C:333

Here is the call graph for this function:

void smooth_surf_medial ( )
protected

Smooths a surface using the medial quadric.

void smooth_surf_medial ( )
protected

Smooths a surface using the medial quadric.

void smooth_vol_mesq_ng ( )
inlineprotected

Smooths a volume using Mesquite with only shared node information.

This method operates in two steps. First the shared nodes which are not on the physical boundary of the mesh are redistributed via element based laplacian smoothing. Then, the real nodes of the panes are smoothed individually with pane boundaries fixed.

Parameters
pre_qualityMesh quality prior to smoothing.

Definition at line 276 of file Rocmop_1.h.

276  {
277  ;
278  }
void smooth_vol_mesq_ng ( double  pre_quality)
protected

Smooths a volume using Mesquite with only shared node information.

This method operates in two steps. First the shared nodes which are not on the physical boundary of the mesh are redistributed via element based laplacian smoothing. Then, the real nodes of the panes are smoothed individually with pane boundaries fixed.

Parameters
pre_qualityMesh quality prior to smoothing.

Definition at line 64 of file smooth_mesquite_ng.C.

References COM_assertion_msg, COM_DOUBLE, COM_INT, COM_NC, COM_PCONN, COMMPI_Initialized(), Angle_Metric_3::compute(), Rocblas::copy(), Rocblas::copy_scalar(), dist(), Rocblas::div(), i, Geo_Metric_Base_3::initialize(), j, k, MPI_MAX, MPI_MIN, ni, nj, nk, Vector_3< Type >::norm(), nvc::norm(), Vector_3< Type >::normalize(), rank, Rocmap::reduce_maxabs_on_shared_nodes(), and total_npanes.

64  {
65  if(_verb)
66  std::cout << " Entering Rocmop::smooth_mesquite_ng" << std::endl;
67 
68  const std::string surf_attr("is_surface");
69  COM::Attribute* w_is_surface = _wrk_window->attribute(surf_attr);
70  COM_assertion_msg( w_is_surface, "Unexpected NULL pointer");
71 
72  // First Perform Element-based Laplacian smoothing on pane boundary volume nodes
73  // implemented as follows:
74 
75  // * this part should go into smoother_specific_init
76  // 0 Declare and resize variables and buffers
77  // 1 Loop through panes
78  // a. Find the set of shared nodes.
79  // b. Remove surface nodes from above set, "leaving submerged boundary nodes"
80  // c. Loop through all elements
81  // if(element contains submersed boundary nodes)
82  // increment submersed_boundary nodes' adj. element count
83  // add element center to each submersed_boundary nodes' new position
84 
85 
86  // 2 Sum reduction on nodal positions and adj. element counts
87  // 3 Divide new nodal positions by element counts
88 
89  // 0 Declare and resize data structures.
90  if(_verb > 2) std::cout << " Declaring Variables\n";
91 
92  // Allocate buffer space for new nodal positions
93  COM::Attribute *w_new_coords =
94  _wrk_window->new_attribute("new_coords", 'n', COM_DOUBLE, 3, "");
95  _wrk_window->resize_array(w_new_coords, 0);
96 
97  // Allocate buffer space for adjacent element counts
98  COM::Attribute *w_adj_elem_cnts =
99  _wrk_window->new_attribute("adj_elem_cnts", 'n', COM_DOUBLE, 1, "");
100  _wrk_window->resize_array(w_adj_elem_cnts, 0);
101  _wrk_window->init_done();
102 
103  // Allocate buffer space for safe distance
104  COM::Attribute *w_safe_dist =
105  _wrk_window->new_attribute("safe_dist", 'n', COM_DOUBLE, 1, "");
106  _wrk_window->resize_array(w_safe_dist, 0);
107  _wrk_window->init_done();
108 
109  // Allocate buffer space for backup coords
110  COM::Attribute *w_backup =
111  _wrk_window->new_attribute("backup", 'n', COM_DOUBLE, 3, "");
112  _wrk_window->resize_array(w_backup, 0);
113  _wrk_window->init_done();
114 
115  // Allocate buffer space for reset flags
116  COM::Attribute *w_reset =
117  _wrk_window->new_attribute("reset", 'n', COM_INT, 1, "");
118  _wrk_window->resize_array(w_reset, 0);
119  _wrk_window->init_done();
120 
121  // Initialize buffer spaces to zeroes.
122  double dzero = 0.;
123  double dlarge =99999999;
124  int izero = 0;
125  Rocblas::copy_scalar( &dzero, w_new_coords);
126  Rocblas::copy_scalar( &dzero, w_adj_elem_cnts);
127  Rocblas::copy_scalar( &dlarge, w_safe_dist);
128  Rocblas::copy_scalar( &izero, w_reset);
129 
130  //backup nodal coords.
131  Rocblas::copy( _wrk_window->attribute(COM::COM_NC), w_backup);
132 
133  // Get worst qualities, pre smoothing.
134 
135  // Get a list of local panes
136  std::vector<COM::Pane*> allpanes;
137  _wrk_window->panes(allpanes);
138  int total_npanes = (int)allpanes.size();
139 
140  // Allocate space for the set of submerged_boundary.
141  std::vector<std::vector<bool> > is_sub_bnd; // Is submerged boundary node?
142  std::vector<std::vector<bool> > is_pan_bnd; // Is pane boundary node?
143  is_sub_bnd.resize(total_npanes);
144  is_pan_bnd.resize(total_npanes);
145 
146  // Get attribute ids
147  int new_coords_id = w_new_coords->id();
148  int adj_elem_cnts_id = w_adj_elem_cnts->id();
149  int is_surface_id = w_is_surface->id();
150  int safe_dist_id = w_safe_dist->id();
151  int reset_id = w_reset->id();
152  int backup_id = w_backup->id();
153 
154  // get the pconn offset
155  int pconn_offset = MAP::Pane_connectivity::pconn_offset();
156 
157  // 1 Loop through panes
158 
159  if(_verb > 2) std::cout << " Step 1\n";
160  for(int i=0; i < total_npanes; ++i){
161  int size_of_real_nodes = allpanes[i]->size_of_real_nodes();
162  int size_of_real_elems = allpanes[i]->size_of_real_elements();
163  is_sub_bnd[i].resize(size_of_real_nodes,0);
164  is_pan_bnd[i].resize(size_of_real_nodes,0);
165 
166  std::vector<bool> is_isolated; // is a node isolated?
167  MAP::Pane_boundary pb (allpanes[i]);
168  pb.determine_border_nodes(is_pan_bnd[i], is_isolated);
169 
170  // a. Find the set of shared nodes.
171 
172  // get pane level pointers
173  COM::Attribute *p_is_surface = allpanes[i]->attribute(is_surface_id);
174  int *is_surface_ptr = (int*)p_is_surface->pointer();
175 
176  double * adj_elem_cnts_ptr = reinterpret_cast<double*>
177  (allpanes[i]->attribute(adj_elem_cnts_id)->pointer());
178 
179  double * safe_dist_ptr =
180  (double*)(allpanes[i]->attribute(safe_dist_id)->pointer());
181 
182  const Vector_3<double> *pnts = reinterpret_cast<Vector_3<double>*>
183  (allpanes[i]->attribute(COM_NC)->pointer());
184 
185  Vector_3<double> *new_coords_ptr = reinterpret_cast<Vector_3<double>*>
186  (allpanes[i]->attribute(new_coords_id)->pointer());
187 
188  // Obtain the pane connectivity of the local pane
189  const COM::Attribute *pconn = allpanes[i]->attribute(COM::COM_PCONN);
190  const int *vs = (const int*)pconn->pointer() + pconn_offset;
191  int vs_size = pconn->size_of_real_items() - pconn_offset;
192 
193  // Determine the number of communicating panes for shared nodes.
194  int count=0;
195  for (int j=0, nj=vs_size; j<nj; j+=vs[j+1]+2) {
196  if (_wrk_window->owner_rank( vs[j]) >=0) ++count;
197  }
198 
199  int index = 0;
200  // Loop through communicating panes for shared nodes.
201  for ( int j=0; j<count; ++j, index+=vs[index+1]+2) {
202  // We skip the panes that are not in the current window
203  while ( _wrk_window->owner_rank(vs[index])<0) {
204  index+=vs[index+1]+2;
205  COM_assertion_msg( index<=vs_size, "Invalid communication map");
206  }
207  // Mark node as shared
208  for(int k=0; k<vs[index+1]; ++k){
209  is_sub_bnd[i][vs[index+2+k]-1]=1;
210  }
211  }
212 
213  // b. Remove surface nodes from above set, leaving submerged boundary nodes
214  for (int j =0; j < size_of_real_nodes; ++j){
215  if(is_surface_ptr[j])
216  is_sub_bnd[i][j] = 0;
217  }
218 
219  // c. Loop through all elements
220  // if(element contains submersed boundary nodes)
221  // increment submersed_boundary nodes' adj. element count
222  // add element center to each submersed_boundary nodes' new position
223  Element_node_enumerator ene(allpanes[i],1);
224  for(int j =0; j < size_of_real_elems; ++j, ene.next()){
225  // Collect element indices of submerged boundary nodes.
226  int nn = ene.size_of_nodes(), flag = 0;
227  for(int k =0; k < nn; ++k){
228  if(is_sub_bnd[i][ene[k]-1]){
229  flag = 1;
230  adj_elem_cnts_ptr[ene[k]-1] += 1.0;
231  }
232  }
233  // If the element contains submerged boundary nodes
234  if(flag!=0){
235  // Calculate the element's center
236  Vector_3<double> elem_cntr_pos(0.0,0.0,0.0);
237  for(int k =0; k < nn; ++k){
238  elem_cntr_pos += pnts[ene[k]-1];
239  }
240  elem_cntr_pos /= (double)nn;
241  // Add the center position to the accumulating new positions
242  // of the constituent submerged boundary nodes.
243  // And update safe distance if needed
244  for(int k =0; k < nn; ++k){
245  if(is_sub_bnd[i][ene[k]-1]){
246  // initialize safe distance with distance to center
247  double local_safe_dist = (pnts[ene[k]-1] - elem_cntr_pos).norm();
248  int long_src = -1;
249  double long_dist = -1.0;
250  // replace safe distance with .5 shortest adj. edge length
251  // if less than distance to center.
252  int safe_source = -1;
253  for(int ii=1; ii<nn; ++ii){
254  double cur_edge_dist =
255  .5*(pnts[ene[k]-1] - pnts[ene[(k+ii)%nn]-1]).norm();
256  if(cur_edge_dist < local_safe_dist){
257  safe_source = ii;
258  local_safe_dist = cur_edge_dist;
259  }
260  if(cur_edge_dist > long_dist){
261  long_dist = cur_edge_dist;
262  long_src = ii;
263  }
264  }
265  new_coords_ptr[ene[k]-1] += elem_cntr_pos;
266 #if 0
267  if(safe_source == -1)
268  new_coords_ptr[ene[k]-1] += elem_cntr_pos;
269  else {
270  Vector_3<double> direction =
271  (pnts[ene[(k+long_src)%nn]-1] - pnts[ene[k]-1]);
272  direction.normalize();
273  new_coords_ptr[ene[k]-1] += pnts[ene[k]-1];
274  new_coords_ptr[ene[k]-1] += direction*local_safe_dist;
275  //new_coords_ptr[ene[k]-1] -= pnts[ene[(k+safe_source)%nn]-1];
276  }
277 #endif
278  if(local_safe_dist < safe_dist_ptr[ene[k]-1])
279  safe_dist_ptr[ene[k]-1] = local_safe_dist;
280  }
281  }
282  }
283  }
284  }
285 
286  // 2 Sum reduction on nodal positions and adj. element counts
287  if(_verb > 1) std::cout << " Step 2\n";
288  reduce_sum_on_shared_nodes(w_new_coords);
289  reduce_sum_on_shared_nodes(w_adj_elem_cnts);
290  if(COMMPI_Initialized()){
291  MAP::Pane_communicator pc(_wrk_window, _wrk_window->get_communicator());
292  pc.init(w_safe_dist);
293  pc.begin_update_shared_nodes();
294  pc.reduce_on_shared_nodes(MPI_MIN);
295  pc.end_update_shared_nodes();
296  }
297 
298  // 3 Divide new nodal positions by element counts
299  if(_verb > 1) std::cout << " Step 3\n";
300  Rocblas::div(w_new_coords, w_adj_elem_cnts, w_new_coords);
301 
302  //std::string msg("\n I submerged quality = ");
303  //print_mquality(msg, is_sub_bnd);
304  //msg = " I pane boundary quality = ";
305  //print_mquality(msg, is_pan_bnd);
306 
307  std::vector<std::vector<bool> > elem_to_check;
308  mark_elems_from_nodes(is_sub_bnd, elem_to_check);
309 
310  // get min,max angles for later use
311  double max_angle = 0.0;
312  double min_angle = 180.0;
313  double angles[] = {0.0, 0.0};
314  for(int i=0,ni = allpanes.size(); i<ni; ++i){
315  for(int k =0,nk = elem_to_check[i].size(); k<nk; ++k){
316  if(elem_to_check[i][k]){
317  Element_node_enumerator ene(allpanes[i],k+1);
318  Angle_Metric_3 am;
319  am.initialize(ene);
320  am.compute(angles);
321  if(angles[1]>max_angle)
322  max_angle = angles[1];
323  if(angles[0]<min_angle)
324  min_angle = angles[0];
325  }
326  }
327  }
328  int rank =0;
329  double temp = min_angle;
330  if(COMMPI_Initialized()){
331  agree_double(max_angle,MPI_MAX);
332  agree_double(min_angle,MPI_MIN);
333  int ierr = MPI_Comm_rank( _wrk_window->get_communicator()
334  , &rank);
335  assert( ierr == 0);
336  }
337 
338  if(_verb > 1) std::cout << " Step 4\n";
339  // 4 Copy new nodal coords into mesh for submerged boundary nodes
340 
341  for(int i=0; i < total_npanes; ++i){
342 
343  // get pane level attributes
344  Vector_3<double>* new_coords_ptr =
345  reinterpret_cast<Vector_3<double>* >(allpanes[i]->
346  attribute(new_coords_id)->
347  pointer());
348  Vector_3<double>* coords_ptr =
349  reinterpret_cast<Vector_3<double>* >(allpanes[i]->
350  attribute(COM::COM_NC)
351  ->pointer());
352 
353  double* safe_dist_ptr =
354  (double*)(allpanes[i]->attribute(safe_dist_id)->pointer());
355 
356  for (int j = 0, nj = allpanes[i]->size_of_real_nodes(); j<nj; ++j){
357  if(is_sub_bnd[i][j]){
358  Vector_3<double> direction =
359  new_coords_ptr[j] - coords_ptr[j];
360  double dist = direction.norm();
361  if (dist > safe_dist_ptr[j]){
362  double alpha = .9*safe_dist_ptr[j]/dist;
363  coords_ptr[j] =
364  alpha*new_coords_ptr[j] +(1.0-alpha)*coords_ptr[j];
365  }
366  else{
367  coords_ptr[j] = .5*new_coords_ptr[j] +.5*coords_ptr[j];
368  }
369  }
370  }
371  }
372  //msg = ("\n L submerged quality = ");
373  //print_mquality(msg, is_sub_bnd);
374  //msg = " L pane boundary quality = ";
375  //print_mquality(msg, is_pan_bnd);
376  //msg = " L overall quality = ";
377  //print_quality(msg);
378 
379  // Decide which positions to reset
380  for(int i=0; i < total_npanes; ++i){
381 
382  int* reset_ptr =
383  (int*)(allpanes[i]->attribute(reset_id)->pointer());
384 
385  for(int k =0,nk = elem_to_check[i].size(); k<nk; ++k){
386  if(elem_to_check[i][k]){
387  double angles[] = {0.0, 0.0};
388 
389  Element_node_enumerator ene(allpanes[i],k+1);
390  Angle_Metric_3 am;
391  am.initialize(ene);
392  am.compute(angles);
393  if(angles[1]>max_angle ||
394  angles[0]<min_angle){
395  std::vector<int> nodes;
396  ene.get_nodes(nodes);
397  for(int j =0, nj=nodes.size(); j<nj; ++j){
398  if (is_sub_bnd[i][nodes[j]-1])
399  reset_ptr[nodes[j]-1] = 1;
400  }
401  }
402  }
403  }
404  }
405 
406  // All nodes being moved are shared, so this should be valid
408 
409  for(int i=0; i < total_npanes; ++i){
410 
411  // get pane level attributes
412  Vector_3<double>* backup_ptr =
413  reinterpret_cast<Vector_3<double>* >(allpanes[i]->
414  attribute(backup_id)->
415  pointer());
416  Vector_3<double>* coords_ptr =
417  reinterpret_cast<Vector_3<double>* >(allpanes[i]->
418  attribute(COM::COM_NC)
419  ->pointer());
420 
421  int* reset_ptr =
422  (int*)(allpanes[i]->attribute(reset_id)->pointer());
423 
424  for(int j=0, nj = allpanes[i]->size_of_real_nodes(); j<nj; ++j){
425  if(reset_ptr[j])
426  coords_ptr[j] = backup_ptr[j];
427  }
428  }
429 
430  //msg = ("\n R submerged quality = ");
431  //print_mquality(msg, is_sub_bnd);
432  //msg = " R pane boundary quality = ";
433  //print_mquality(msg, is_pan_bnd);
434  //msg = " R overall quality = ";
435  //print_quality(msg);
436 
437  // Smooth using mesquite.
438  smooth_mesquite(allpanes,0);
439 
440  //msg = "\n M submerged quality = ";
441  //print_mquality(msg, is_sub_bnd);
442  // msg = " M pane boundary quality = ";
443  //print_mquality(msg, is_pan_bnd);
444  //msg = " M overall quality = ";
445  //print_quality(msg);
446 
447  //Deallocate buffer space
448  _wrk_window->delete_attribute( w_adj_elem_cnts->name());
449  _wrk_window->delete_attribute( w_new_coords->name());
450  _wrk_window->init_done();
451 
452  if(_verb > 1)
453  std::cout << " Exiting Rocmop::smooth_mesquite_ng" << std::endl;
454 }
virtual void compute(double atts[]) const
Calculate the metric value on this element.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
j indices k indices k
Definition: Indexing.h:6
#define COM_assertion_msg(EX, msg)
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MIN
Vector_3 & normalize()
Definition: mapbasic.h:114
const int total_npanes
Definition: ex1.C:94
static void reduce_sum_on_shared_nodes(COM::Attribute *att)
Perform a sum-reduction on the shared nodes for the given attribute.
Definition: Rocmop.C:595
T norm(const NVec< DIM, T > &v)
static void reduce_maxabs_on_shared_nodes(COM::Attribute *att, COM::Attribute *pconn=NULL)
Perform a maxabs-reduction on the shared nodes for the given attribute.
Definition: Rocmap.C:77
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
static void div(const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for division.
Definition: op3args.C:269
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
int _verb
Verbose level.
Definition: Rocmop.h:453
void agree_double(double &val, MPI_Op op)
Agree on a double value across all panes.
Definition: Rocmop.h:240
void int int * nk
Definition: read.cpp:74
static void copy_scalar(const void *x, Attribute *y)
Operation wrapper for copy (x is a scalar pointer).
Definition: op2args.C:583
j indices j
Definition: Indexing.h:6
3D Max and Min Angle Metric Class
static void copy(const Attribute *x, Attribute *y)
Wrapper for copy.
Definition: op2args.C:333
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
static int rank
Definition: advectest.C:66
long double dist(long double *coord1, long double *coord2, int size)
void mark_elems_from_nodes(std::vector< std::vector< bool > > &marked_nodes, std::vector< std::vector< bool > > &marked_elems)
Mark the nodes which contain marked elems.
Definition: Rocmop.C:712
int COMMPI_Initialized()
Definition: commpi.h:168
void smooth_mesquite(std::vector< COM::Pane * > &allpanes, int ghost_level=0)
Smooth the panes of the working window using MESQUITE.
Definition: Rocmop.C:570
Type norm() const
Definition: mapbasic.h:112

Here is the call graph for this function:

void smooth_vol_mesq_ng ( )
inlineprotected

Smooths a volume using Mesquite with only shared node information.

This method operates in two steps. First the shared nodes which are not on the physical boundary of the mesh are redistributed via element based laplacian smoothing. Then, the real nodes of the panes are smoothed individually with pane boundaries fixed.

Parameters
pre_qualityMesh quality prior to smoothing.

Definition at line 298 of file Rocmop_2.h.

298  {
299  ;
300  }
void smooth_vol_mesq_wg ( )
protected

Smooth a volume via Mesquite using ghost information.

This method operates in two steps. First the panes, including ghost nodes, are smoothed individually using Mesquite. Then, shared nodes are moved to the average of their positions across all panes. These steps two steps repeat until either ncycles sub-cycles are completed or the loss in quality between the two steps is less than ctol.

Parameters
pre_qualityMesh quality prior to smoothing.

Definition at line 58 of file smooth_mesquite_1.C.

References COM_NC, COM_PCONN, Rocmap::reduce_average_on_shared_nodes(), and Rocmap::update_ghosts().

58  {
59 
60  print_legible(1," Entering Rocmop::smooth_vol_mesq_wg");
61 
62  print_legible(2," Updating ghost node positions.");
64  _buf_window->attribute(COM::COM_PCONN));
65 
66  std::vector<COM::Pane*> allpanes;
67  _buf_window->panes(allpanes);
68 
69  // smooth the panes via MESQUITE with ghosts.
70  smooth_mesquite(allpanes,1);
71 
72  print_legible(2," Updating shared and ghost node positions.");
75  _buf_window->attribute(COM::COM_PCONN));
76 
77  print_legible(1," Exiting Rocmop::smooth_vol_mesq_wg");
78 }
void print_legible(int verb, const char *msg)
Single process print message if given verbosity level is exceeded.
Definition: Rocmop_1.C:1408
static void update_ghosts(COM::Attribute *att, const COM::Attribute *pconn=NULL)
Update ghost nodal or elemental values for the given attribute.
Definition: Rocmap.C:87
static void reduce_average_on_shared_nodes(COM::Attribute *att, COM::Attribute *pconn=NULL)
Perform an average-reduction on the shared nodes for the given attribute.
Definition: Rocmap.C:57
void smooth_mesquite(std::vector< COM::Pane * > &allpanes, int ghost_level=0)
Smooth the panes of the working window using MESQUITE.
Definition: Rocmop.C:570
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464

Here is the call graph for this function:

void smooth_vol_mesq_wg ( double  pre_quality)
protected

Smooth a volume via Mesquite using ghost information.

This method operates in two steps. First the panes, including ghost nodes, are smoothed individually using Mesquite. Then, shared nodes are moved to the average of their positions across all panes. These steps two steps repeat until either ncycles sub-cycles are completed or the loss in quality between the two steps is less than ctol.

Parameters
pre_qualityMesh quality prior to smoothing.

Definition at line 59 of file smooth_mesquite.C.

References COM_NC, COM_PCONN, i, MPI_MAX, Rocmap::reduce_average_on_shared_nodes(), total_npanes, and Rocmap::update_ghosts().

59  {
60  if(_verb)
61  std::cout << " Entering Rocmop::smooth_vol_mesq_wg" << std::endl;
62 
63  std::vector<COM::Pane*> allpanes;
64  _wrk_window->panes(allpanes);
65  int total_npanes = (int)allpanes.size();
66 
67  // Get the worst dihedral angle of all of the elements
68  double pre_worst = initial_quality, post_worst = 180.0;
69  double pre_worst_all = 180.0;
70  double post_worst_all = 0.0;
71  int to_cycle = 1;
72 
73  //std::string msg("\n Initial shared quality = ");
74  //print_mquality(msg, _is_shared_node);
75 
76  for(int i=0; (i<_ncycle && to_cycle); ++i){
77  if(_verb > 2)
78  std::cout << " Subcycle " << i << std::endl;
79 
80  // smooth the panes via MESQUITE with ghosts.
81  smooth_mesquite(allpanes,1);
82 
83  //msg = "\n Post-mesquite quality = ";
84  //print_mquality(msg, _is_shared_node);
85 
86  //msg = "\n Post-mesquite all quality = ";
87  //print_quality(msg);
88 
89  //get the worst quality of all the shared elements
90  pre_worst = check_marked_elem_quality(_is_shared_elem,allpanes);
91 
92  if(_verb > 2)
93  std::cout << " Updating shared and ghost node positions.\n";
96  _wrk_window->attribute(COM::COM_PCONN));
97 
98  //msg = "\n Post-communicated quality = ";
99  //print_mquality(msg, _is_shared_node);
100 
101  //msg = "\n Post-communicated all quality = ";
102  //print_quality(msg);
103 
104  if(_ctol != 0.0){
105  post_worst = check_marked_elem_quality(_is_shared_elem,allpanes);
106  if(pre_worst/post_worst > _ctol)
107  to_cycle = 0;
108  }
109  agree_int(to_cycle, MPI_MAX);
110  }
111 
112  if(_verb > 1)
113  std::cout << " Exiting Rocmop::smooth_vol_mesq_wg" << std::endl;
114 }
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
int _ncycle
Max number of subcycles for convergence.
Definition: Rocmop.h:479
const int total_npanes
Definition: ex1.C:94
double check_marked_elem_quality(std::vector< std::vector< bool > > &marked_elems, std::vector< COM::Pane * > &allpanes)
Get the largest dihedral angle of marked real elements.
Definition: Rocmop.C:760
blockLoc i
Definition: read.cpp:79
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
int _verb
Verbose level.
Definition: Rocmop.h:453
static void update_ghosts(COM::Attribute *att, const COM::Attribute *pconn=NULL)
Update ghost nodal or elemental values for the given attribute.
Definition: Rocmap.C:87
float _ctol
Subcycling tolerance.
Definition: Rocmop.h:471
void agree_int(int &val, MPI_Op op)
Agree on an integer value across all panes.
Definition: Rocmop.h:226
static void reduce_average_on_shared_nodes(COM::Attribute *att, COM::Attribute *pconn=NULL)
Perform an average-reduction on the shared nodes for the given attribute.
Definition: Rocmap.C:57
std::vector< std::vector< bool > > _is_shared_elem
Does the element contain shared nodes?
Definition: Rocmop.h:432
void smooth_mesquite(std::vector< COM::Pane * > &allpanes, int ghost_level=0)
Smooth the panes of the working window using MESQUITE.
Definition: Rocmop.C:570

Here is the call graph for this function:

void smooth_vol_mesq_wg ( )
protected

Smooth a volume via Mesquite using ghost information.

This method operates in two steps. First the panes, including ghost nodes, are smoothed individually using Mesquite. Then, shared nodes are moved to the average of their positions across all panes. These steps two steps repeat until either ncycles sub-cycles are completed or the loss in quality between the two steps is less than ctol.

Parameters
pre_qualityMesh quality prior to smoothing.
void smoother_specific_init ( )
protected

Perform smoother specific initialization.

Perform smoother specific initializing, for example initializing the Window_manifold_2 for a surface mesh, adding smoother specific attributes to the buffer window, etc.

Definition at line 364 of file Rocmop.C.

References COM_assertion_msg, COM_compatible_types(), COM_DOUBLE, COM_INT, COM_MESH, COM_PMESH, and Rocsurf::initialize().

364  {
365  if(_verb)
366  std::cout << " Entering Rocmop::smoother_specific_init" << std::endl;
367 
368  // get rid of any old data
369  if(_wm){ delete _wm; _wm = NULL; }
370 
371  // perform initialization common to surface smoothers
373  // Initialize the Window_manifold
374  if(_wm == NULL)
376 
377  }
378 
379  // perform smoother specific initialization
380  switch (_method){
381 
382 #ifdef MESQUITE
383  case SMOOTH_VOL_MESQ_WG: {
384  // Obtain a list of elements containing shared nodes for each pane.
385  // Don't bother if _ctol == 0 or _ncycle ==1
386  // if(!(_ctol==0.) && !(_ncycle==1))
388  if(_invert)
389  invert_tets();
390  break;
391  }
392  case SMOOTH_VOL_MESQ_NG: {
393 
394  // Check to see if the physical surface boundary exists
395  const std::string surf_attr("is_surface");
396  const COM::Attribute *w_is_surface = _usr_window->attribute(surf_attr);
397  if(w_is_surface){
398 
399  COM_assertion_msg( COM_compatible_types( w_is_surface->data_type(), COM_INT),
400  "Surface-list must have integer type");
401  COM_assertion_msg( w_is_surface->is_nodal() == 1,
402  "Surface-list must be nodal");
403  COM_assertion_msg( w_is_surface->size_of_components() == 1,
404  "Surface-list must have a single component");
405  COM_assertion_msg( w_is_surface->initialized() == 1,
406  "Surface-list must be initialized");
407 
408  // Clone the attribute
409  COM::Attribute * new_attr =
410  _wrk_window->inherit( const_cast<COM::Attribute *>(w_is_surface),
411  surf_attr, COM::Pane::INHERIT_CLONE, true, NULL, 0);
412  }
413  // else, detect the physical boundary ourselves
414  else{
415  COM::Attribute* w_surf_attr =
416  _wrk_window->new_attribute( "is_surface", 'n', COM_INT, 1, "");
417  _wrk_window->resize_array( w_surf_attr, 0);
418 
419  determine_physical_border(w_surf_attr);
420  }
421  _wrk_window->init_done();
422 
423  if(_invert)
424  invert_tets();
425  break;
426  }
427 #else
428  case SMOOTH_VOL_MESQ_WG:
429  case SMOOTH_VOL_MESQ_NG:
430  COM_assertion_msg(0, "Not compiled with MESQUITE");
431  break;
432 #endif
433 
434  case SMOOTH_SURF_MEDIAL: {
435 
436  // Extend buffer window
437  COM::Attribute* w_disps =
438  _wrk_window->new_attribute( "disps", 'n', COM_DOUBLE, 3, "");
439  _wrk_window->resize_array( w_disps, 0);
440 
441  COM::Attribute* w_facenormals =
442  _wrk_window->new_attribute( "facenormals", 'e', COM_DOUBLE, 3, "");
443  _wrk_window->resize_array( w_facenormals, 0);
444 
445  COM::Attribute* w_facecenters =
446  _wrk_window->new_attribute( "facecenters", 'e', COM_DOUBLE, 3, "");
447  _wrk_window->resize_array( w_facecenters, 0);
448 
449  COM::Attribute* w_eigvalues =
450  _wrk_window->new_attribute( "lambda", 'n', COM_DOUBLE, 3, "");
451  _wrk_window->resize_array( w_eigvalues, 0);
452 
453  COM::Attribute* w_vnormals =
454  _wrk_window->new_attribute( "vnormals", 'n', COM_DOUBLE, 3, "");
455  _wrk_window->resize_array( w_vnormals, 0);
456 
457  COM::Attribute* w_awnormals =
458  _wrk_window->new_attribute( "awnormals", 'n', COM_DOUBLE, 3, "");
459  _wrk_window->resize_array( w_awnormals, 0);
460 
461  COM::Attribute* w_uwnormals =
462  _wrk_window->new_attribute( "uwnormals", 'n', COM_DOUBLE, 3, "");
463  _wrk_window->resize_array( w_uwnormals, 0);
464 
465  COM::Attribute* w_eigvecs =
466  _wrk_window->new_attribute( "eigvecs", 'n', COM_DOUBLE, 9, "");
467  _wrk_window->resize_array( w_eigvecs, 0);
468 
469  COM::Attribute* w_tangranks =
470  _wrk_window->new_attribute( "tangranks", 'n', COM_INT, 1, "");
471  _wrk_window->resize_array( w_tangranks, 0);
472 
473  COM::Attribute* w_cntnranks =
474  _wrk_window->new_attribute( "cntnranks", 'n', COM_INT, 1, "");
475  _wrk_window->resize_array( w_cntnranks, 0);
476 
477  COM::Attribute* w_cntnvecs =
478  _wrk_window->new_attribute( "cntnvecs", 'n', COM_DOUBLE, 6, "");
479  _wrk_window->resize_array( w_cntnvecs, 0);
480 
481  COM::Attribute* w_scales =
482  _wrk_window->new_attribute( "scales", 'n', COM_DOUBLE, 1, "");
483  _wrk_window->resize_array( w_scales, 0);
484 
485  COM::Attribute* w_weights =
486  _wrk_window->new_attribute( "weights", 'n', COM_DOUBLE, 1, "");
487  _wrk_window->resize_array( w_weights, 0);
488 
489  COM::Attribute* w_weights2 =
490  _wrk_window->new_attribute( "weights2", 'n', COM_DOUBLE, 1, "");
491  _wrk_window->resize_array( w_weights2, 0);
492 
493  COM::Attribute* w_barycrds =
494  _wrk_window->new_attribute( "barycrds", 'n', COM_DOUBLE, 2, "");
495  _wrk_window->resize_array( w_barycrds, 0);
496 
497  COM::Attribute* w_PNelemids =
498  _wrk_window->new_attribute( "PNelemids", 'n', COM_INT, 1, "");
499  _wrk_window->resize_array( w_PNelemids, 0);
500 
501  // Extend the buffer window to hold local contributions to new placement
502  // and the number of contributing faces for Laplacian smoothing.
503  COM::Attribute * w_pnt_contrib =
504  _wrk_window->new_attribute("pnt_contrib", 'n', COM_DOUBLE, 3, "");
505  _wrk_window->resize_array(w_pnt_contrib, 0);
506 
507  COM::Attribute * w_disp_count =
508  _wrk_window->new_attribute("disp_count", 'n', COM_DOUBLE, 1, "");
509  _wrk_window->resize_array(w_disp_count, 0);
510 
511  _wrk_window->init_done();
512 
513  break;
514  }
515  // case SMOOTH_LAPLACE : {
516  //break;
517  //}
518  default:
519  COM_assertion_msg(0, "Can't initialize for invalid smoother.");
520  break;
521  }
522 
523  COM_assertion_msg(_wrk_window, "Unexpected NULL pointer encountered.");
524 
525  if(_verb > 1)
526  std::cout << " Exiting Rocmop::smoother_specific_init" << std::endl;
527 }
void determine_physical_border()
Determine which nodes and elements are on the physical border.
Definition: Rocmop.C:677
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
void invert_tets()
Repair inverted tets.
Definition: Rocmop.C:748
#define COM_assertion_msg(EX, msg)
int _method
Choice of smoothing method.
Definition: Rocmop.h:447
void initialize(const COM::Attribute *pmesh)
Constructs the communication patterns of a distributed mesh.
Definition: Rocsurf.C:35
int COM_compatible_types(COM_Type type1, COM_Type type2)
Definition: roccom_c++.h:563
void determine_shared_border()
Determine which nodes and elements are shared.
Definition: Rocmop.C:631
COM::Window * _wrk_window
The working window.
Definition: Rocmop.h:439
int _invert
If true (default false), then invert the mesh.
Definition: Rocmop.h:489
int _verb
Verbose level.
Definition: Rocmop.h:453
bool _is_pmesh
pmesh or mesh ?
Definition: Rocmop.h:441

Here is the call graph for this function:

void smoother_specific_init ( )
protected

Perform smoother specific initialization.

Perform smoother specific initializing, for example initializing the Window_manifold_2 for a surface mesh, adding smoother specific attributes to the buffer window, etc.

void smoother_specific_init ( )
protected

Perform smoother specific initialization.

Perform smoother specific initializing, for example initializing the Window_manifold_2 for a surface mesh, adding smoother specific attributes to the buffer window, etc.

static void solve ( const FT &  a1,
const FT &  a2,
const FT &  b1,
const FT &  b2,
const FT &  c1,
const FT &  c2,
FT &  x,
FT &  y 
)
inlinestaticprotected

Definition at line 378 of file Rocmop.h.

References denom.

Referenced by get_redist_safe_factor(), and solve().

382  {
383  FT denom = a1*b2-b1*a2;
384 
385  x = - (b1*c2-c1*b2)/denom;
386 
387  y = (a1*c2-c1*a2)/denom;
388  }
void int int REAL REAL * y
Definition: read.cpp:74
void int int REAL * x
Definition: read.cpp:74
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom

Here is the caller graph for this function:

static void solve ( const FT &  a1,
const FT &  a2,
const FT &  a3,
const FT &  b1,
const FT &  b2,
const FT &  b3,
const FT &  c1,
const FT &  c2,
const FT &  c3,
const FT &  d1,
const FT &  d2,
const FT &  d3,
FT &  x,
FT &  y,
FT &  z 
)
inlinestaticprotected

Definition at line 391 of file Rocmop.h.

References denom.

396  {
397  FT denom = b2*c1*a3-b1*c2*a3+c3*b1*a2+b3*c2*a1-c1*b3*a2-b2*c3*a1;
398 
399  x = - (b2*c3*d1-b2*c1*d3+c1*b3*d2+b1*c2*d3-c3*b1*d2-b3*c2*d1)/denom;
400 
401  z = (b2*d1*a3-b2*a1*d3+b1*a2*d3-b1*d2*a3-d1*b3*a2+a1*b3*d2)/denom;
402 
403  y = (a2*c3*d1-a2*c1*d3-c2*d1*a3+c2*a1*d3+d2*c1*a3-d2*c3*a1)/denom;
404  }
void int int REAL REAL * y
Definition: read.cpp:74
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom
static void solve ( const FT &  a1,
const FT &  a2,
const FT &  b1,
const FT &  b2,
const FT &  c1,
const FT &  c2,
FT &  x,
FT &  y 
)
inlinestaticprotected

Definition at line 403 of file Rocmop_1.h.

References denom.

407  {
408  FT denom = a1*b2-b1*a2;
409 
410  x = - (b1*c2-c1*b2)/denom;
411 
412  y = (a1*c2-c1*a2)/denom;
413  }
void int int REAL REAL * y
Definition: read.cpp:74
void int int REAL * x
Definition: read.cpp:74
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom
static void solve ( const Vector_3< double >  A[3],
const Vector_3< double > &  q,
Vector_3< double > &  x 
)
inlinestaticprotected

Definition at line 407 of file Rocmop.h.

References solve().

409  {
410  solve( A[0][0], A[0][1], A[0][2], A[1][0], A[1][1], A[1][2],
411  A[2][0], A[2][1], A[2][2], q[0], q[1], q[2],
412  x[0], x[1], x[2]);
413  }
static void solve(const FT &a1, const FT &a2, const FT &b1, const FT &b2, const FT &c1, const FT &c2, FT &x, FT &y)
Definition: Rocmop.h:378

Here is the call graph for this function:

static void solve ( const FT &  a1,
const FT &  a2,
const FT &  a3,
const FT &  b1,
const FT &  b2,
const FT &  b3,
const FT &  c1,
const FT &  c2,
const FT &  c3,
const FT &  d1,
const FT &  d2,
const FT &  d3,
FT &  x,
FT &  y,
FT &  z 
)
inlinestaticprotected

Definition at line 416 of file Rocmop_1.h.

References denom.

421  {
422  FT denom = b2*c1*a3-b1*c2*a3+c3*b1*a2+b3*c2*a1-c1*b3*a2-b2*c3*a1;
423 
424  x = - (b2*c3*d1-b2*c1*d3+c1*b3*d2+b1*c2*d3-c3*b1*d2-b3*c2*d1)/denom;
425 
426  z = (b2*d1*a3-b2*a1*d3+b1*a2*d3-b1*d2*a3-d1*b3*a2+a1*b3*d2)/denom;
427 
428  y = (a2*c3*d1-a2*c1*d3-c2*d1*a3+c2*a1*d3+d2*c1*a3-d2*c3*a1)/denom;
429  }
void int int REAL REAL * y
Definition: read.cpp:74
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom
static void solve ( const FT &  a1,
const FT &  a2,
const FT &  b1,
const FT &  b2,
const FT &  c1,
const FT &  c2,
FT &  x,
FT &  y 
)
inlinestaticprotected

Definition at line 430 of file Rocmop_2.h.

References denom.

434  {
435  FT denom = a1*b2-b1*a2;
436 
437  x = - (b1*c2-c1*b2)/denom;
438 
439  y = (a1*c2-c1*a2)/denom;
440  }
void int int REAL REAL * y
Definition: read.cpp:74
void int int REAL * x
Definition: read.cpp:74
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom
static void solve ( const Vector_3< double >  A[3],
const Vector_3< double > &  q,
Vector_3< double > &  x 
)
inlinestaticprotected

Definition at line 432 of file Rocmop_1.h.

References solve().

434  {
435  solve( A[0][0], A[0][1], A[0][2], A[1][0], A[1][1], A[1][2],
436  A[2][0], A[2][1], A[2][2], q[0], q[1], q[2],
437  x[0], x[1], x[2]);
438  }
static void solve(const FT &a1, const FT &a2, const FT &b1, const FT &b2, const FT &c1, const FT &c2, FT &x, FT &y)
Definition: Rocmop.h:378

Here is the call graph for this function:

static void solve ( const FT &  a1,
const FT &  a2,
const FT &  a3,
const FT &  b1,
const FT &  b2,
const FT &  b3,
const FT &  c1,
const FT &  c2,
const FT &  c3,
const FT &  d1,
const FT &  d2,
const FT &  d3,
FT &  x,
FT &  y,
FT &  z 
)
inlinestaticprotected

Definition at line 443 of file Rocmop_2.h.

References denom.

448  {
449  FT denom = b2*c1*a3-b1*c2*a3+c3*b1*a2+b3*c2*a1-c1*b3*a2-b2*c3*a1;
450 
451  x = - (b2*c3*d1-b2*c1*d3+c1*b3*d2+b1*c2*d3-c3*b1*d2-b3*c2*d1)/denom;
452 
453  z = (b2*d1*a3-b2*a1*d3+b1*a2*d3-b1*d2*a3-d1*b3*a2+a1*b3*d2)/denom;
454 
455  y = (a2*c3*d1-a2*c1*d3-c2*d1*a3+c2*a1*d3+d2*c1*a3-d2*c3*a1)/denom;
456  }
void int int REAL REAL * y
Definition: read.cpp:74
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom
static void solve ( const Vector_3< double >  A[3],
const Vector_3< double > &  q,
Vector_3< double > &  x 
)
inlinestaticprotected

Definition at line 459 of file Rocmop_2.h.

References solve().

461  {
462  solve( A[0][0], A[0][1], A[0][2], A[1][0], A[1][1], A[1][2],
463  A[2][0], A[2][1], A[2][2], q[0], q[1], q[2],
464  x[0], x[1], x[2]);
465  }
static void solve(const FT &a1, const FT &a2, const FT &b1, const FT &b2, const FT &c1, const FT &c2, FT &x, FT &y)
Definition: Rocmop.h:378

Here is the call graph for this function:

void unload ( const std::string &  mname)
static

Unloads Rocmop from Roccom.

Definition at line 120 of file Rocmop.C.

References COM_delete_window(), and COM_get_object().

Referenced by COM_F_FUNC2(), and Rocmop_unload_module().

120  {
121 
122  Rocmop *mop;
123  std::string glb=mname+".global";
124 
125  COM_get_object( glb.c_str(), 0, &mop);
126  delete mop;
127 
128  COM_delete_window( mname.c_str());
129 
130 }
void COM_delete_window(const char *wname)
Definition: roccom_c++.h:94
A Roccom mesh optimization module.
Definition: Rocmop.h:41
void COM_get_object(const char *wa_str, int pane_id, Type **addr)
Definition: roccom_c++.h:152

Here is the call graph for this function:

Here is the caller graph for this function:

static void unload ( const std::string &  mname)
static

Unloads Rocmop from Roccom.

static void unload ( const std::string &  mname)
static

Unloads Rocmop from Roccom.

void update_buf_real_nc ( )
protected

Update real nodal coordinates of _buf_window from _usr_window.

Use real nodal coordinates of _usr_window to update real nodal coordinates of _buf_window

Definition at line 824 of file Rocmop_2.C.

References COM_assertion_msg, COM_NC, i, j, ni, and nj.

825 {
826  std::vector<const Pane*> allbufpanes;
827  _buf_window->panes(allbufpanes);
828  std::vector<const Pane*> allusrpanes;
829  _usr_window->panes(allusrpanes);
830 
831  COM_assertion_msg(allbufpanes.size() == allusrpanes.size(),
832  "Different number of panes on buffer and user windows.");
833 
834  for(int i = 0, ni = allbufpanes.size(); i < ni; ++i)
835  {
836  // Obtain pane level attributes
837  const COM::Attribute *usr_nc = allusrpanes[i]->attribute( COM::COM_NC);
838  const COM::Attribute *buf_nc = allbufpanes[i]->attribute( COM::COM_NC);
839 
840  COM_assertion_msg(usr_nc->stride() != 0,
841  "Rocmop can not operate on meshes with stride == 0");
842 
843  COM_assertion_msg(usr_nc->size_of_real_items() == buf_nc->size_of_real_items(),
844  "Number of real items differs between buffer and user windows");
845 
846  double* usr_nc_ptr = (double*)usr_nc->pointer();
847  double* buf_nc_ptr = (double*)buf_nc->pointer();
848 
849  // get stride and distance_to_next_component
850  int usr_nc_stride = usr_nc->stride();
851  int buf_nc_stride = buf_nc->stride();
852  int usr_nc_next_comp;
853  int buf_nc_next_comp;
854 
855  if (usr_nc_stride == 1)
856  usr_nc_next_comp = usr_nc->size_of_items();
857  else
858  usr_nc_next_comp = 1;
859 
860  if (buf_nc_stride == 1)
861  buf_nc_next_comp = buf_nc->size_of_items();
862  else
863  buf_nc_next_comp = 1;
864 
865  // update real node coordinates
866  for(int j=0, nj = usr_nc->size_of_real_items(); j<nj; ++j){
867  *buf_nc_ptr = *usr_nc_ptr;
868  *(buf_nc_ptr+ 1*buf_nc_next_comp) = *(usr_nc_ptr + 1*usr_nc_next_comp);
869  *(buf_nc_ptr+ 2*buf_nc_next_comp) = *(usr_nc_ptr + 2*usr_nc_next_comp);
870 
871  buf_nc_ptr += buf_nc_stride;
872  usr_nc_ptr += usr_nc_stride;
873  }
874  }
875 }
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
#define COM_assertion_msg(EX, msg)
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
COM::Window * _buf_window
The buffer window.
Definition: Rocmop_1.h:464
int validate_object ( ) const
inlineprotected

Check that the object is valid.

Definition at line 205 of file Rocmop_1.h.

References _cookie, and MOP_COOKIE.

205  {
206  if ( _cookie != MOP_COOKIE) return -1;
207  else return COM_Object::validate_object();
208  }
int _cookie
For Roccom.
Definition: Rocmop.h:487
int validate_object ( ) const
inlineprotected

Check that the object is valid.

Definition at line 206 of file Rocmop.h.

References _cookie, and MOP_COOKIE.

206  {
207  if ( _cookie != MOP_COOKIE) return -1;
208  else return COM_Object::validate_object();
209  }
int _cookie
For Roccom.
Definition: Rocmop.h:487
int validate_object ( ) const
inlineprotected

Check that the object is valid.

Definition at line 227 of file Rocmop_2.h.

References _cookie, and MOP_COOKIE.

227  {
228  if ( _cookie != MOP_COOKIE) return -1;
229  else return COM_Object::validate_object();
230  }
int _cookie
For Roccom.
Definition: Rocmop.h:487
void zero_displacements ( COM::Attribute *  disp)
protected

Definition at line 426 of file Rocmop_1.C.

References i, j, ni, and nj.

427 {
428 #ifdef ROCPROF
429  Profile_begin("Rocmop::zero_disp");
430 #endif
431 
432  int disp_id = w_disp->id();
433  std::vector<Pane*> allpanes;
434  const_cast<COM::Window*>(_usr_window)->panes(allpanes);
435 
436  for(int i=0,ni = allpanes.size(); i<ni; ++i){
437  Vector_3<double> *ptr = NULL;
438  COM::Attribute* ptr_att = allpanes[i]->attribute(disp_id);
439  void* void_ptr = ptr_att->pointer();
440  ptr = reinterpret_cast<Vector_3<double>*>(void_ptr);
441  for(int j=0,nj = allpanes[i]->size_of_real_nodes(); j<nj; ++j){
442  // Zero to maintain original physics module behavior
443  ptr[j][0] = 0.0;
444  ptr[j][1] = 0.0;
445  ptr[j][2] = 0.0;
446  }
447  }
448 #ifdef ROCPROF
449  Profile_end("Rocmop::zero_disp");
450 #endif
451 }
const COM::Window * _usr_window
The user&#39;s window.
Definition: Rocmop.h:438
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
void zero_displacements ( COM::Attribute *  disp)
protected

Member Data Documentation

COM::Window * _buf_window
protected

The buffer window.

Definition at line 464 of file Rocmop_1.h.

COM::Attribute * _cnstr_dirs
protected

Stores directions of nodal contraints.

Definition at line 425 of file Rocmop.h.

Referenced by compute_medial_quadric().

const COM::Attribute * _cnstr_types
protected

Stores types of nodal constraints.

Definition at line 424 of file Rocmop.h.

Referenced by compute_medial_quadric().

int _cookie
protected

For Roccom.

Definition at line 487 of file Rocmop.h.

Referenced by validate_object().

float _ctol
protected

Subcycling tolerance.

Definition at line 471 of file Rocmop.h.

std::vector< MAP::Pane_dual_connectivity * > _dcs
protected

Definition at line 466 of file Rocmop_1.h.

double _dir_thres
protected

Another threshold.

Definition at line 421 of file Rocmop.h.

Referenced by eigen_analyze_vertex().

float _disp_thresh
protected

originally a static in check_displacements

Smooth every _smoothfreq'th call.

Definition at line 520 of file Rocmop_1.h.

std::vector< std::set< Edge_ID > > _edges
protected

ridge edges

Definition at line 426 of file Rocmop.h.

Referenced by identify_ridge_edges(), and redistribute_vertices_ridge().

double _eig_thres
protected

Eigenvalue thresholds.

Definition at line 420 of file Rocmop.h.

Referenced by eigen_analyze_vertex().

int _invert
protected

If true (default false), then invert the mesh.

Definition at line 489 of file Rocmop.h.

int _invert_hexes
protected

If true (default false), then invert hexes.

Definition at line 543 of file Rocmop_2.h.

int _invert_tets
protected

If true (default false), then invert tets.

Definition at line 541 of file Rocmop_2.h.

std::vector< std::vector< bool > > _is_pane_bnd_elem
protected

Does the element contain nodes on the pane boundary?

Definition at line 436 of file Rocmop.h.

std::vector< std::vector< bool > > _is_pane_bnd_node
protected

Is the node on the pane boundary?

Definition at line 435 of file Rocmop.h.

std::vector< std::vector< bool > > _is_phys_bnd_elem
protected

Does the element contain nodes on the phys. boundary?

Definition at line 434 of file Rocmop.h.

std::vector< std::vector< bool > > _is_phys_bnd_node
protected

Is the node on the physical boundary?

Definition at line 433 of file Rocmop.h.

bool _is_pmesh
protected

pmesh or mesh ?

Definition at line 441 of file Rocmop.h.

std::vector< std::vector< bool > > _is_shared_elem
protected

Does the element contain shared nodes?

Definition at line 432 of file Rocmop.h.

std::vector< std::vector< bool > > _is_shared_node
protected

Is the node shared?

Definition at line 431 of file Rocmop.h.

int _lazy
protected

Check quality before smoothing?

Definition at line 462 of file Rocmop.h.

float _maxdisp
protected

Maximum displacement allowed.

Definition at line 512 of file Rocmop_1.h.

int _method
protected

Choice of smoothing method.

Definition at line 447 of file Rocmop.h.

int _monotone
protected

Impose non-decreasing quality?

Definition at line 481 of file Rocmop.h.

int _ncycle
protected

Max number of subcycles for convergence.

Definition at line 479 of file Rocmop.h.

int _niter
protected

Maximum number of iterations for smoothing.

Definition at line 469 of file Rocmop.h.

int _rediter
protected

No.iterations for vertex redistribution.

Definition at line 423 of file Rocmop.h.

Referenced by smooth_surf_medial().

bool _reorthog
protected

Reorthogonalize?

Definition at line 418 of file Rocmop.h.

Referenced by eigen_analyze_vertex().

double _saliency_crn
protected

Definition at line 422 of file Rocmop.h.

Referenced by eigen_analyze_vertex().

int _smoothfreq
protected

Definition at line 514 of file Rocmop_1.h.

float _tol
protected

Smoother iterating tolerance.

Definition at line 464 of file Rocmop.h.

const COM::Window * _usr_window
protected

The user's window.

Definition at line 438 of file Rocmop.h.

Referenced by agree_double(), agree_int(), and smooth_surf_medial().

int _verb
protected

Verbose level.

Definition at line 453 of file Rocmop.h.

Referenced by compute_medial_quadric(), evaluate_face_normals(), and smooth_surf_medial().

char _wght_scheme
protected

Weighting scheme.

Definition at line 419 of file Rocmop.h.

Referenced by compute_medial_quadric().

int _wrapper
protected

Choice of Mesquite Smoothing Wrappers.

Definition at line 507 of file Rocmop_2.h.

double disp_tally
protected

originally a static in smooth()

Definition at line 518 of file Rocmop_1.h.

int N
protected

Smooth every _smoothfreq'th call.

Definition at line 516 of file Rocmop_1.h.


The documentation for this class was generated from the following files: