18#include "libmesh/libmesh_config.h"
19#if defined(LIBMESH_ENABLE_VSMOOTHER)
22#include "libmesh/mesh_smoother_vsmoother.h"
23#include "libmesh/mesh_tools.h"
24#include "libmesh/elem.h"
25#include "libmesh/unstructured_mesh.h"
26#include "libmesh/utility.h"
27#include "libmesh/boundary_info.h"
28#include "libmesh/equation_systems.h"
29#include "libmesh/distributed_mesh.h"
30#include "libmesh/steady_solver.h"
31#include "libmesh/diff_solver.h"
32#include "libmesh/parallel_ghost_sync.h"
33#include "libmesh/libmesh_logging.h"
47#ifdef __INTEL_COMPILER
48# pragma optimize ( "", off )
54 const bool preserve_subdomain_boundaries,
55 const Real relative_residual_tolerance,
56 const Real absolute_residual_tolerance,
const unsigned int verbosity)
58 _dilation_weight(dilation_weight),
59 _preserve_subdomain_boundaries(preserve_subdomain_boundaries),
61 _relative_residual_tolerance(relative_residual_tolerance),
62 _absolute_residual_tolerance(absolute_residual_tolerance) {}
68 libmesh_not_implemented_msg(
"Meshes containing elements of differing dimension are not yet supported.");
117 _constraint = std::make_unique<VariationalSmootherConstraint>(
138 solver.
quiet =
false;
151 LOG_SCOPE(
"smooth()",
"VariationalMeshSmoother");
163#ifdef LIBMESH_ENABLE_EXCEPTIONS
169 for (
auto * node_copy :
_mesh_copy->local_node_ptr_range())
173 node(d) = (*node_copy)(d);
189 libmesh_error_msg_if(!
_setup_called,
"Need to first call the setup() method of "
190 <<
"this VariationalMeshSmoother object, then call get_mesh_info() prior "
191 <<
"to calling smooth().");
A class representing a solver's failure to converge, to be thrown by "libmesh_convergence_failure();"...
This is a generic class that defines a solver to handle ImplicitSystem classes, including NonlinearIm...
bool verbose
The DiffSolver may print a lot more to libMesh::out if verbose is set to true; default is false.
bool quiet
The DiffSolver should not print anything to libMesh::out unless quiet is set to false; default is tru...
std::unique_ptr< TimeSolver > time_solver
A pointer to the solver object we're going to use.
virtual const Node & node_ref(const dof_id_type i) const
const std::set< unsigned char > & elem_dimensions() const
This class provides the necessary interface for mesh smoothing.
const Parallel::Communicator & comm() const
void attach_constraint_object(Constraint &constrain)
Register a user object for imposing constraints.
The UnstructuredMesh class is derived from the MeshBase class.
virtual void smooth() override
Redefinition of the smooth function from the base class.
VariationalMeshSmoother(UnstructuredMesh &mesh, Real dilation_weight=0.5, const bool preserve_subdomain_boundaries=true, const Real relative_residual_tolerance=TOLERANCE *TOLERANCE, const Real absolute_residual_tolerance=TOLERANCE *TOLERANCE, const unsigned int verbosity=0)
Constructor.
const Real _dilation_weight
Smoother control variables.
const unsigned int _verbosity
verbosity setting
std::unique_ptr< VariationalSmootherConstraint > _constraint
Constraints imposed on the smoothing process.
const MeshQualityInfo & get_mesh_info() const
Getter for the _system's _mesh_info attribute.
std::unique_ptr< EquationSystems > _equation_systems
EquationsSystems object associated with the smoother.
virtual void setup()
Setup method that creates equation systems, system, and constraints, to be called just prior to smoot...
Real _relative_residual_tolerance
Solver relative residual tolerance.
VariationalSmootherSystem * system() const
Getter for _system to protect against dangling pointers.
Real _absolute_residual_tolerance
Solver absolute residual tolerance.
VariationalSmootherSystem * _system
bool _setup_called
Attribute the keep track of whether the setup method has been called.
const bool _preserve_subdomain_boundaries
Whether subdomain boundaries are subject to change via smoothing.
std::unique_ptr< DistributedMesh > _mesh_copy
Mesh copy to avoid multiple EquationSystems.
const MeshQualityInfo & get_mesh_info()
Getter for the _mesh_info attribute.
Real & get_dilation_weight()
void set_verbosity(const unsigned int verbosity)
virtual void solve() override
Solves the system to smooth the mesh.
void sync_dofobject_data_by_id(const Communicator &comm, const Iterator &range_begin, const Iterator &range_end, SyncFunctor &sync)
Request data about a range of ghost dofobjects uniquely identified by their id.
The libMesh namespace provides an interface to certain functionality in the library.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Struct to hold smoother-relevant information about the mesh quality.