#include <mesh_smoother_vsmoother.h>
Classes | |
struct | Array2D |
struct | Array3D |
Public Types | |
enum | MetricType { UNIFORM = 1, VOLUMETRIC = 2, DIRECTIONAL = 3 } |
enum | AdaptType { CELL = -1, NONE = 0, NODE = 1 } |
Public Member Functions | |
VariationalMeshSmoother (UnstructuredMesh &mesh, double theta=0.5, unsigned miniter=2, unsigned maxiter=5, unsigned miniterBC=5) | |
VariationalMeshSmoother (UnstructuredMesh &mesh, std::vector< float > *adapt_data, double theta=0.5, unsigned miniter=2, unsigned maxiter=5, unsigned miniterBC=5, double percent_to_move=1) | |
VariationalMeshSmoother (UnstructuredMesh &mesh, const UnstructuredMesh *area_of_interest, std::vector< float > *adapt_data, double theta=0.5, unsigned miniter=2, unsigned maxiter=5, unsigned miniterBC=5, double percent_to_move=1) | |
virtual | ~VariationalMeshSmoother () |
virtual void | smooth () override |
double | smooth (unsigned int n_iterations) |
double | distance_moved () const |
void | set_generate_data (bool b) |
void | set_metric (MetricType t) |
Protected Attributes | |
UnstructuredMesh & | _mesh |
Private Member Functions | |
void | adjust_adapt_data () |
float | adapt_minimum () const |
int | writegr (const Array2D< double > &R) |
int | readgr (Array2D< double > &R, std::vector< int > &mask, Array2D< int > &cells, std::vector< int > &mcells, std::vector< int > &edges, std::vector< int > &hnodes) |
int | readmetr (std::string name, Array3D< double > &H) |
int | read_adp (std::vector< double > &afun) |
double | jac3 (double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3) |
double | jac2 (double x1, double y1, double x2, double y2) |
int | basisA (Array2D< double > &Q, int nvert, const std::vector< double > &K, const Array2D< double > &H, int me) |
void | adp_renew (const Array2D< double > &R, const Array2D< int > &cells, std::vector< double > &afun, int adp) |
void | full_smooth (Array2D< double > &R, const std::vector< int > &mask, const Array2D< int > &cells, const std::vector< int > &mcells, const std::vector< int > &edges, const std::vector< int > &hnodes, double w, const std::vector< int > &iter, int me, const Array3D< double > &H, int adp, int gr) |
double | maxE (Array2D< double > &R, const Array2D< int > &cells, const std::vector< int > &mcells, int me, const Array3D< double > &H, double v, double epsilon, double w, std::vector< double > &Gamma, double &qmin) |
double | minq (const Array2D< double > &R, const Array2D< int > &cells, const std::vector< int > &mcells, int me, const Array3D< double > &H, double &vol, double &Vmin) |
double | minJ (Array2D< double > &R, const std::vector< int > &mask, const Array2D< int > &cells, const std::vector< int > &mcells, double epsilon, double w, int me, const Array3D< double > &H, double vol, const std::vector< int > &edges, const std::vector< int > &hnodes, int msglev, double &Vmin, double &emax, double &qmin, int adp, const std::vector< double > &afun) |
double | minJ_BC (Array2D< double > &R, const std::vector< int > &mask, const Array2D< int > &cells, const std::vector< int > &mcells, double epsilon, double w, int me, const Array3D< double > &H, double vol, int msglev, double &Vmin, double &emax, double &qmin, int adp, const std::vector< double > &afun, int NCN) |
double | localP (Array3D< double > &W, Array2D< double > &F, Array2D< double > &R, const std::vector< int > &cell_in, const std::vector< int > &mask, double epsilon, double w, int nvert, const Array2D< double > &H, int me, double vol, int f, double &Vmin, double &qmin, int adp, const std::vector< double > &afun, std::vector< double > &Gloc) |
double | avertex (const std::vector< double > &afun, std::vector< double > &G, const Array2D< double > &R, const std::vector< int > &cell_in, int nvert, int adp) |
double | vertex (Array3D< double > &W, Array2D< double > &F, const Array2D< double > &R, const std::vector< int > &cell_in, double epsilon, double w, int nvert, const std::vector< double > &K, const Array2D< double > &H, int me, double vol, int f, double &Vmin, int adp, const std::vector< double > &g, double sigma) |
void | metr_data_gen (std::string grid, std::string metr, int me) |
int | solver (int n, const std::vector< int > &ia, const std::vector< int > &ja, const std::vector< double > &a, std::vector< double > &x, const std::vector< double > &b, double eps, int maxite, int msglev) |
int | pcg_ic0 (int n, const std::vector< int > &ia, const std::vector< int > &ja, const std::vector< double > &a, const std::vector< double > &u, std::vector< double > &x, const std::vector< double > &b, std::vector< double > &r, std::vector< double > &p, std::vector< double > &z, double eps, int maxite, int msglev) |
int | pcg_par_check (int n, const std::vector< int > &ia, const std::vector< int > &ja, const std::vector< double > &a, double eps, int maxite, int msglev) |
void | gener (char grid[], int n) |
Private Attributes | |
double | _distance |
const double | _percent_to_move |
double | _dist_norm |
std::map< dof_id_type, std::vector< dof_id_type > > | _hanging_nodes |
std::vector< float > * | _adapt_data |
const unsigned | _dim |
const unsigned | _miniter |
const unsigned | _maxiter |
const unsigned | _miniterBC |
MetricType | _metric |
AdaptType | _adaptive_func |
const double | _theta |
bool | _generate_data |
dof_id_type | _n_nodes |
dof_id_type | _n_cells |
dof_id_type | _n_hanging_edges |
std::ofstream | _logfile |
const UnstructuredMesh * | _area_of_interest |
This is an implementation of Larisa Branets' smoothing algorithms. The initial implementation was done by her, the adaptation to libmesh was completed by Derek Gaston. The code was heavily refactored into something more closely resembling C++ by John Peterson in 2014.
Here are the relevant publications: 1) L. Branets, G. Carey, "Extension of a mesh quality metric for elements with a curved boundary edge or surface", Journal of Computing and Information Science in Engineering, vol. 5(4), pp.302-308, 2005.
2) L. Branets, G. Carey, "A local cell quality metric and variational grid smoothing algorithm", Engineering with Computers, vol. 21, pp.19-28, 2005.
3) L. Branets, "A variational grid optimization algorithm based on a local cell quality metric", Ph.D. thesis, The University of Texas at Austin, 2005.
Definition at line 63 of file mesh_smoother_vsmoother.h.
libMesh::VariationalMeshSmoother::VariationalMeshSmoother | ( | UnstructuredMesh & | mesh, |
double | theta = 0.5 , |
||
unsigned | miniter = 2 , |
||
unsigned | maxiter = 5 , |
||
unsigned | miniterBC = 5 |
||
) |
Simple constructor to use for smoothing purposes
Definition at line 45 of file mesh_smoother_vsmoother.C.
libMesh::VariationalMeshSmoother::VariationalMeshSmoother | ( | UnstructuredMesh & | mesh, |
std::vector< float > * | adapt_data, | ||
double | theta = 0.5 , |
||
unsigned | miniter = 2 , |
||
unsigned | maxiter = 5 , |
||
unsigned | miniterBC = 5 , |
||
double | percent_to_move = 1 |
||
) |
Slightly more complicated constructor for mesh redistribution based on adapt_data
Definition at line 71 of file mesh_smoother_vsmoother.C.
libMesh::VariationalMeshSmoother::VariationalMeshSmoother | ( | UnstructuredMesh & | mesh, |
const UnstructuredMesh * | area_of_interest, | ||
std::vector< float > * | adapt_data, | ||
double | theta = 0.5 , |
||
unsigned | miniter = 2 , |
||
unsigned | maxiter = 5 , |
||
unsigned | miniterBC = 5 , |
||
double | percent_to_move = 1 |
||
) |
Even more complicated constructor for mesh redistribution based on adapt_data with an area of interest
Definition at line 98 of file mesh_smoother_vsmoother.C.
|
inlinevirtual |
|
private |
Definition at line 512 of file mesh_smoother_vsmoother.C.
References _adapt_data, std::max(), and std::min().
Referenced by adjust_adapt_data().
|
private |
Definition at line 531 of file mesh_smoother_vsmoother.C.
References _adapt_data, _area_of_interest, libMesh::MeshSmoother::_mesh, adapt_minimum(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), and std::min().
Referenced by read_adp().
|
private |
Definition at line 829 of file mesh_smoother_vsmoother.C.
References _dim, _n_cells, and _n_nodes.
Referenced by full_smooth().
|
private |
Definition at line 3317 of file mesh_smoother_vsmoother.C.
References _dim, basisA(), jac2(), and jac3().
Referenced by localP().
|
private |
Definition at line 621 of file mesh_smoother_vsmoother.C.
References _dim.
Referenced by avertex(), maxE(), metr_data_gen(), minq(), and vertex().
|
inline |
Definition at line 137 of file mesh_smoother_vsmoother.h.
References _distance.
|
private |
Definition at line 876 of file mesh_smoother_vsmoother.C.
References _logfile, _n_cells, _n_hanging_edges, _n_nodes, std::abs(), adp_renew(), maxE(), minJ(), minJ_BC(), minq(), and read_adp().
Referenced by smooth().
|
private |
Definition at line 3918 of file mesh_smoother_vsmoother.C.
|
private |
Definition at line 610 of file mesh_smoother_vsmoother.C.
Referenced by avertex(), maxE(), metr_data_gen(), minq(), and vertex().
|
private |
Definition at line 595 of file mesh_smoother_vsmoother.C.
Referenced by avertex(), maxE(), metr_data_gen(), minq(), and vertex().
|
private |
Definition at line 2979 of file mesh_smoother_vsmoother.C.
References _dim, avertex(), and vertex().
Referenced by minJ(), and minJ_BC().
|
private |
Definition at line 1077 of file mesh_smoother_vsmoother.C.
References _dim, _n_cells, basisA(), jac2(), jac3(), and std::pow().
Referenced by full_smooth().
|
private |
Definition at line 3988 of file mesh_smoother_vsmoother.C.
References _dim, libMesh::MeshSmoother::_mesh, _n_cells, _n_nodes, std::abs(), basisA(), jac2(), jac3(), libMesh::MeshBase::n_active_elem(), libMesh::MeshBase::n_nodes(), std::pow(), readgr(), and libMesh::Real.
Referenced by smooth().
|
private |
Definition at line 1887 of file mesh_smoother_vsmoother.C.
References _dim, _logfile, _n_cells, _n_hanging_edges, _n_nodes, A, std::abs(), localP(), std::pow(), and solver().
Referenced by full_smooth().
|
private |
Definition at line 2359 of file mesh_smoother_vsmoother.C.
References _logfile, _n_cells, _n_nodes, std::abs(), localP(), and std::pow().
Referenced by full_smooth().
|
private |
Definition at line 1484 of file mesh_smoother_vsmoother.C.
References _dim, _n_cells, basisA(), jac2(), and jac3().
Referenced by full_smooth().
|
private |
Definition at line 3806 of file mesh_smoother_vsmoother.C.
References _logfile.
Referenced by solver().
|
private |
Definition at line 3664 of file mesh_smoother_vsmoother.C.
References _logfile.
Referenced by solver().
|
private |
Definition at line 573 of file mesh_smoother_vsmoother.C.
References _adapt_data, _area_of_interest, and adjust_adapt_data().
Referenced by full_smooth().
|
private |
Definition at line 269 of file mesh_smoother_vsmoother.C.
References _dim, _hanging_nodes, libMesh::MeshSmoother::_mesh, std::abs(), libMesh::MeshBase::active_element_ptr_range(), libMesh::MeshTools::build_nodes_to_elem_map(), end, libMesh::MeshTools::find_boundary_nodes(), libMesh::MeshTools::find_nodal_neighbors(), libMesh::MeshBase::node_ptr_range(), libMesh::out, libMesh::pi, and libMesh::Real.
Referenced by metr_data_gen(), and smooth().
|
private |
Definition at line 490 of file mesh_smoother_vsmoother.C.
References _dim, _n_cells, and libMesh::Quality::name().
Referenced by smooth().
|
inline |
Allow user to control whether the metric is generated from the initial mesh.
Definition at line 142 of file mesh_smoother_vsmoother.h.
References _generate_data.
|
inline |
Allow user to control the smoothing metric used.
Definition at line 147 of file mesh_smoother_vsmoother.h.
References _metric.
|
inlineoverridevirtual |
Redefinition of the smooth function from the base class. All this does is call the smooth function in this class which takes an int, using a default value of 1.
Implements libMesh::MeshSmoother.
Definition at line 125 of file mesh_smoother_vsmoother.h.
References _distance, and smooth().
Referenced by smooth().
double libMesh::VariationalMeshSmoother::smooth | ( | unsigned int | n_iterations | ) |
The actual smoothing function, gets called whenever the user specifies an actual number of smoothing iterations.
Definition at line 126 of file mesh_smoother_vsmoother.C.
References _adaptive_func, _dim, _dist_norm, _generate_data, _hanging_nodes, _logfile, _maxiter, libMesh::MeshSmoother::_mesh, _metric, _miniter, _miniterBC, _n_cells, _n_hanging_edges, _n_nodes, _theta, libMesh::MeshTools::find_hanging_nodes_and_parents(), full_smooth(), metr_data_gen(), libMesh::MeshBase::n_active_elem(), libMesh::MeshBase::n_nodes(), readgr(), readmetr(), and writegr().
|
private |
Definition at line 3627 of file mesh_smoother_vsmoother.C.
References _logfile, pcg_ic0(), and pcg_par_check().
Referenced by minJ().
|
private |
Definition at line 3409 of file mesh_smoother_vsmoother.C.
References _dim, basisA(), jac2(), jac3(), and std::pow().
Referenced by localP().
|
private |
Definition at line 223 of file mesh_smoother_vsmoother.C.
References _dim, _dist_norm, libMesh::MeshSmoother::_mesh, _percent_to_move, libMesh::MeshBase::n_nodes(), libMesh::MeshBase::node_ptr_range(), and libMesh::out.
Referenced by smooth().
|
private |
Vector for holding adaptive data
Definition at line 174 of file mesh_smoother_vsmoother.h.
Referenced by adapt_minimum(), adjust_adapt_data(), and read_adp().
|
private |
Definition at line 184 of file mesh_smoother_vsmoother.h.
Referenced by smooth().
|
private |
Area of Interest Mesh
Definition at line 217 of file mesh_smoother_vsmoother.h.
Referenced by adjust_adapt_data(), and read_adp().
|
private |
Smoother control variables
Definition at line 179 of file mesh_smoother_vsmoother.h.
Referenced by adp_renew(), avertex(), basisA(), localP(), maxE(), metr_data_gen(), minJ(), minq(), readgr(), readmetr(), smooth(), vertex(), and writegr().
|
private |
Records a relative "distance moved"
Definition at line 164 of file mesh_smoother_vsmoother.h.
|
private |
Max distance of the last set of movement.
Definition at line 154 of file mesh_smoother_vsmoother.h.
Referenced by distance_moved(), and smooth().
|
private |
Definition at line 186 of file mesh_smoother_vsmoother.h.
Referenced by set_generate_data(), and smooth().
|
private |
Map for hanging_nodes
Definition at line 169 of file mesh_smoother_vsmoother.h.
|
private |
All output (including debugging) is sent to the _logfile.
Definition at line 212 of file mesh_smoother_vsmoother.h.
Referenced by full_smooth(), minJ(), minJ_BC(), pcg_ic0(), pcg_par_check(), smooth(), and solver().
|
private |
Definition at line 181 of file mesh_smoother_vsmoother.h.
Referenced by smooth().
|
protectedinherited |
Definition at line 61 of file mesh_smoother.h.
Referenced by adjust_adapt_data(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::LaplaceMeshSmoother::init(), metr_data_gen(), readgr(), libMesh::LaplaceMeshSmoother::smooth(), smooth(), and writegr().
|
private |
Definition at line 183 of file mesh_smoother_vsmoother.h.
Referenced by set_metric(), and smooth().
|
private |
Definition at line 180 of file mesh_smoother_vsmoother.h.
Referenced by smooth().
|
private |
Definition at line 182 of file mesh_smoother_vsmoother.h.
Referenced by smooth().
|
private |
The number of active elements in the Mesh at the time of smoothing. Not set until smooth() is actually called to mimic the original code's behavior.
Definition at line 200 of file mesh_smoother_vsmoother.h.
Referenced by adp_renew(), full_smooth(), maxE(), metr_data_gen(), minJ(), minJ_BC(), minq(), readmetr(), and smooth().
|
private |
The number of hanging node edges in the Mesh at the time of smoothing. Not set until smooth() is actually called to mimic the original code's behavior.
Definition at line 207 of file mesh_smoother_vsmoother.h.
Referenced by full_smooth(), minJ(), and smooth().
|
private |
The number of nodes in the Mesh at the time of smoothing. Not set until smooth() is actually called to mimic the original code's behavior.
Definition at line 193 of file mesh_smoother_vsmoother.h.
Referenced by adp_renew(), full_smooth(), metr_data_gen(), minJ(), minJ_BC(), and smooth().
|
private |
|
private |
Definition at line 185 of file mesh_smoother_vsmoother.h.
Referenced by smooth().