libMesh
|
This is an implementation of Larisa Branets' smoothing algorithms. More...
#include <mesh_smoother_vsmoother.h>
Classes | |
struct | Array2D |
2D array type for interfacing with C APIs. More... | |
struct | Array3D |
3D array type for interfacing with C APIs. More... | |
Public Types | |
enum | MetricType { UNIFORM = 1, VOLUMETRIC = 2, DIRECTIONAL = 3 } |
enum | AdaptType { CELL = -1, NONE = 0, NODE = 1 } |
Public Member Functions | |
VariationalMeshSmoother (UnstructuredMesh &mesh, Real theta=0.5, unsigned miniter=2, unsigned maxiter=5, unsigned miniterBC=5) | |
Simple constructor to use for smoothing purposes. More... | |
VariationalMeshSmoother (UnstructuredMesh &mesh, std::vector< float > *adapt_data, Real theta=0.5, unsigned miniter=2, unsigned maxiter=5, unsigned miniterBC=5, Real percent_to_move=1) | |
Slightly more complicated constructor for mesh redistribution based on adapt_data. More... | |
VariationalMeshSmoother (UnstructuredMesh &mesh, const UnstructuredMesh *area_of_interest, std::vector< float > *adapt_data, Real theta=0.5, unsigned miniter=2, unsigned maxiter=5, unsigned miniterBC=5, Real percent_to_move=1) | |
Even more complicated constructor for mesh redistribution based on adapt_data with an area of interest. More... | |
virtual | ~VariationalMeshSmoother ()=default |
Destructor. More... | |
virtual void | smooth () override |
Redefinition of the smooth function from the base class. More... | |
Real | smooth (unsigned int n_iterations) |
The actual smoothing function, gets called whenever the user specifies an actual number of smoothing iterations. More... | |
Real | distance_moved () const |
void | set_generate_data (bool b) |
Allow user to control whether the metric is generated from the initial mesh. More... | |
void | set_metric (MetricType t) |
Allow user to control the smoothing metric used. More... | |
Protected Attributes | |
UnstructuredMesh & | _mesh |
Private Member Functions | |
void | adjust_adapt_data () |
float | adapt_minimum () const |
int | writegr (const Array2D< Real > &R) |
int | readgr (Array2D< Real > &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< Real > &H) |
int | read_adp (std::vector< Real > &afun) |
Real | jac3 (Real x1, Real y1, Real z1, Real x2, Real y2, Real z2, Real x3, Real y3, Real z3) |
Real | jac2 (Real x1, Real y1, Real x2, Real y2) |
int | basisA (Array2D< Real > &Q, int nvert, const std::vector< Real > &K, const Array2D< Real > &H, int me) |
void | adp_renew (const Array2D< Real > &R, const Array2D< int > &cells, std::vector< Real > &afun, int adp) |
void | full_smooth (Array2D< Real > &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, Real w, const std::vector< int > &iter, int me, const Array3D< Real > &H, int adp, int gr) |
Real | maxE (Array2D< Real > &R, const Array2D< int > &cells, const std::vector< int > &mcells, int me, const Array3D< Real > &H, Real v, Real epsilon, Real w, std::vector< Real > &Gamma, Real &qmin) |
Real | minq (const Array2D< Real > &R, const Array2D< int > &cells, const std::vector< int > &mcells, int me, const Array3D< Real > &H, Real &vol, Real &Vmin) |
Real | minJ (Array2D< Real > &R, const std::vector< int > &mask, const Array2D< int > &cells, const std::vector< int > &mcells, Real epsilon, Real w, int me, const Array3D< Real > &H, Real vol, const std::vector< int > &edges, const std::vector< int > &hnodes, int msglev, Real &Vmin, Real &emax, Real &qmin, int adp, const std::vector< Real > &afun) |
Real | minJ_BC (Array2D< Real > &R, const std::vector< int > &mask, const Array2D< int > &cells, const std::vector< int > &mcells, Real epsilon, Real w, int me, const Array3D< Real > &H, Real vol, int msglev, Real &Vmin, Real &emax, Real &qmin, int adp, const std::vector< Real > &afun, int NCN) |
Real | localP (Array3D< Real > &W, Array2D< Real > &F, Array2D< Real > &R, const std::vector< int > &cell_in, const std::vector< int > &mask, Real epsilon, Real w, int nvert, const Array2D< Real > &H, int me, Real vol, int f, Real &Vmin, Real &qmin, int adp, const std::vector< Real > &afun, std::vector< Real > &Gloc) |
Real | avertex (const std::vector< Real > &afun, std::vector< Real > &G, const Array2D< Real > &R, const std::vector< int > &cell_in, int nvert, int adp) |
Real | vertex (Array3D< Real > &W, Array2D< Real > &F, const Array2D< Real > &R, const std::vector< int > &cell_in, Real epsilon, Real w, int nvert, const std::vector< Real > &K, const Array2D< Real > &H, int me, Real vol, int f, Real &Vmin, int adp, const std::vector< Real > &g, Real 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< Real > &a, std::vector< Real > &x, const std::vector< Real > &b, Real eps, int maxite, int msglev) |
int | pcg_ic0 (int n, const std::vector< int > &ia, const std::vector< int > &ja, const std::vector< Real > &a, const std::vector< Real > &u, std::vector< Real > &x, const std::vector< Real > &b, std::vector< Real > &r, std::vector< Real > &p, std::vector< Real > &z, Real eps, int maxite, int msglev) |
int | pcg_par_check (int n, const std::vector< int > &ia, const std::vector< int > &ja, const std::vector< Real > &a, Real eps, int maxite, int msglev) |
void | gener (char grid[], int n) |
Private Attributes | |
Real | _distance |
Max distance of the last set of movement. More... | |
const Real | _percent_to_move |
Dampening factor. More... | |
Real | _dist_norm |
Records a relative "distance moved". More... | |
std::map< dof_id_type, std::vector< dof_id_type > > | _hanging_nodes |
Map for hanging_nodes. More... | |
std::vector< float > * | _adapt_data |
Vector for holding adaptive data. More... | |
const unsigned | _dim |
Smoother control variables. More... | |
const unsigned | _miniter |
const unsigned | _maxiter |
const unsigned | _miniterBC |
MetricType | _metric |
AdaptType | _adaptive_func |
const Real | _theta |
bool | _generate_data |
dof_id_type | _n_nodes |
The number of nodes in the Mesh at the time of smoothing. More... | |
dof_id_type | _n_cells |
The number of active elements in the Mesh at the time of smoothing. More... | |
dof_id_type | _n_hanging_edges |
The number of hanging node edges in the Mesh at the time of smoothing. More... | |
std::ofstream | _logfile |
All output (including debugging) is sent to the _logfile. More... | |
const UnstructuredMesh * | _area_of_interest |
Area of Interest Mesh. More... | |
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, |
Real | 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, | ||
Real | theta = 0.5 , |
||
unsigned | miniter = 2 , |
||
unsigned | maxiter = 5 , |
||
unsigned | miniterBC = 5 , |
||
Real | 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, | ||
Real | theta = 0.5 , |
||
unsigned | miniter = 2 , |
||
unsigned | maxiter = 5 , |
||
unsigned | miniterBC = 5 , |
||
Real | 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.
|
virtualdefault |
Destructor.
|
private |
Definition at line 512 of file mesh_smoother_vsmoother.C.
References _adapt_data.
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, and adapt_minimum().
Referenced by read_adp().
|
private |
Definition at line 829 of file mesh_smoother_vsmoother.C.
References _dim, _n_cells, _n_nodes, and libMesh::Real.
Referenced by full_smooth().
|
private |
Definition at line 3323 of file mesh_smoother_vsmoother.C.
References _dim, basisA(), jac2(), jac3(), and libMesh::Real.
Referenced by localP().
|
private |
Definition at line 621 of file mesh_smoother_vsmoother.C.
References _dim, libMesh::Real, and std::sqrt().
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 880 of file mesh_smoother_vsmoother.C.
References _logfile, _n_cells, _n_hanging_edges, _n_nodes, std::abs(), adp_renew(), maxE(), minJ(), minJ_BC(), minq(), read_adp(), libMesh::Real, and std::sqrt().
Referenced by smooth().
|
private |
Definition at line 3924 of file mesh_smoother_vsmoother.C.
References libMesh::Real.
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 2985 of file mesh_smoother_vsmoother.C.
References _dim, avertex(), libMesh::Real, and vertex().
Referenced by minJ(), and minJ_BC().
|
private |
Definition at line 1083 of file mesh_smoother_vsmoother.C.
References _dim, _n_cells, basisA(), jac2(), jac3(), libMesh::Utility::pow(), libMesh::Real, and std::sqrt().
Referenced by full_smooth().
|
private |
Definition at line 3994 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(), libMesh::Utility::pow(), readgr(), libMesh::Real, and std::sqrt().
Referenced by smooth().
|
private |
Definition at line 1893 of file mesh_smoother_vsmoother.C.
References _dim, _logfile, _n_cells, _n_hanging_edges, _n_nodes, std::abs(), int, localP(), libMesh::make_range(), libMesh::Utility::pow(), libMesh::Real, solver(), and std::sqrt().
Referenced by full_smooth().
|
private |
Definition at line 2365 of file mesh_smoother_vsmoother.C.
References _logfile, _n_cells, _n_nodes, std::abs(), localP(), libMesh::make_range(), libMesh::Utility::pow(), libMesh::Real, and std::sqrt().
Referenced by full_smooth().
|
private |
Definition at line 1490 of file mesh_smoother_vsmoother.C.
References _dim, _n_cells, basisA(), jac2(), jac3(), and libMesh::Real.
Referenced by full_smooth().
|
private |
Definition at line 3812 of file mesh_smoother_vsmoother.C.
References _logfile, libMesh::Real, and std::sqrt().
Referenced by solver().
|
private |
Definition at line 3670 of file mesh_smoother_vsmoother.C.
References _logfile.
Referenced by solver().
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::MeshTools::build_nodes_to_elem_map(), libMesh::MeshTools::find_boundary_nodes(), libMesh::MeshTools::find_nodal_neighbors(), libMesh::make_range(), libMesh::out, libMesh::pi, and libMesh::Real.
Referenced by metr_data_gen(), and smooth().
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().
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(), libMesh::Real, and writegr().
|
private |
Definition at line 3633 of file mesh_smoother_vsmoother.C.
References _logfile, pcg_ic0(), and pcg_par_check().
Referenced by minJ().
|
private |
Definition at line 3415 of file mesh_smoother_vsmoother.C.
References _dim, basisA(), jac2(), jac3(), libMesh::Utility::pow(), libMesh::Real, and std::sqrt().
Referenced by localP().
Definition at line 223 of file mesh_smoother_vsmoother.C.
References _dim, _dist_norm, libMesh::MeshSmoother::_mesh, _percent_to_move, distance(), libMesh::MeshBase::n_nodes(), libMesh::out, libMesh::Real, and std::sqrt().
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 |
Dampening factor.
Definition at line 159 of file mesh_smoother_vsmoother.h.
Referenced by writegr().
|
private |
Definition at line 185 of file mesh_smoother_vsmoother.h.
Referenced by smooth().