20 #ifndef LIBMESH_MESH_REFINEMENT_H 21 #define LIBMESH_MESH_REFINEMENT_H 25 #include "libmesh/libmesh_config.h" 27 #ifdef LIBMESH_ENABLE_AMR 30 #include "libmesh/libmesh_common.h" 31 #include "libmesh/libmesh.h" 32 #include "libmesh/topology_map.h" 33 #include "libmesh/parallel_object.h" 46 class PeriodicBoundaries;
48 class PointLocatorBase;
508 #ifdef LIBMESH_ENABLE_DEPRECATED 518 #ifdef LIBMESH_ENABLE_DEPRECATED 720 Real & parent_error_min,
721 Real & parent_error_max);
752 const unsigned int side)
const;
760 const Elem * neighbor)
const;
888 unsigned max_mismatch);
890 #ifdef LIBMESH_ENABLE_PERIODIC 972 #ifdef LIBMESH_ENABLE_DEPRECATED 975 libmesh_deprecated();
981 libmesh_deprecated();
995 #endif // end #ifdef LIBMESH_ENABLE_AMR 996 #endif // LIBMESH_MESH_REFINEMENT_H bool limit_level_mismatch_at_edge(const unsigned int max_mismatch)
bool & enforce_mismatch_limit_prior_to_refinement()
Get/set the _enforce_mismatch_limit_prior_to_refinement flag.
~MeshRefinement()
Destructor.
void uniformly_p_refine(unsigned int n=1)
Uniformly p refines the mesh n times.
Data structures that enable topology-based lookups of nodes created by mesh refinement.
bool _refine_elements()
Refines user-requested elements.
A Node is like a Point, but with more information.
NeighborType
This helper function enforces the desired mismatch limits prior to refinement.
unsigned int _max_h_level
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
bool test_level_one(bool libmesh_assert_yes=false) const
bool limit_level_mismatch_at_node(const unsigned int max_mismatch)
This algorithm restricts the maximum level mismatch at any node in the mesh.
void flag_elements_by_error_tolerance(const ErrorVector &error_per_cell)
Flags elements for coarsening and refinement based on the computed error passed in error_per_cell...
void update_nodes_map()
Updates the _new_nodes_map.
TopologyMap _new_nodes_map
Data structure that holds the new nodes information.
bool limit_underrefined_boundary(const signed char max_mismatch)
bool has_topological_neighbor(const Elem *elem, const PointLocatorBase *point_locator, const Elem *neighbor) const
Local dispatch function for checking the correct has_neighbor function from the Elem class...
MeshBase & _mesh
Reference to the mesh.
Real & absolute_global_tolerance()
If absolute_global_tolerance is set to a nonzero value, methods like flag_elements_by_global_toleranc...
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
We're using a class instead of a typedef to allow forward declarations and future flexibility...
bool refine_elements()
Only refines the user-requested elements.
bool flag_elements_by_nelem_target(const ErrorVector &error_per_cell)
Flags elements for coarsening and refinement based on the computed error passed in error_per_cell...
This is the base class from which all geometric element types are derived.
Real & coarsen_fraction()
The coarsen_fraction sets either a desired target or a desired maximum number of elements to flag for...
void uniformly_p_coarsen(unsigned int n=1)
Attempts to uniformly p coarsen the mesh n times.
unsigned char & edge_level_mismatch_limit()
If edge_level_mismatch_limit is set to a nonzero value, then refinement and coarsening will produce m...
bool limit_overrefined_boundary(const signed char max_mismatch)
Real & refine_fraction()
The refine_fraction sets either a desired target or a desired maximum number of elements to flag for ...
MeshRefinement & operator=(const MeshRefinement &)
void clean_refinement_flags()
Sets the refinement flag to Elem::DO_NOTHING for each element in the mesh.
void create_parent_error_vector(const ErrorVector &error_per_cell, ErrorVector &error_per_parent, Real &parent_error_min, Real &parent_error_max)
Calculates the error on all coarsenable parents.
The libMesh namespace provides an interface to certain functionality in the library.
PeriodicBoundaries * _periodic_boundaries
unsigned int & max_h_level()
The max_h_level is the greatest refinement level an element should reach.
bool & coarsen_by_parents()
If coarsen_by_parents is true, complete groups of sibling elements (elements with the same parent) wi...
signed char _underrefined_boundary_limit
uint8_t processor_id_type
This is the MeshBase class.
bool make_refinement_compatible()
Take user-specified refinement flags and augment them so that level-one dependency is satisfied...
dof_id_type & nelem_target()
If nelem_target is set to a nonzero value, methods like flag_elements_by_nelem_target() will attempt ...
bool coarsen_elements()
Only coarsens the user-requested elements.
bool _allow_unrefined_patches
signed char & underrefined_boundary_limit()
If underrefined_boundary_limit is set to a nonnegative value, then refinement and coarsening will pro...
void switch_h_to_p_refinement()
Takes a mesh whose elements are flagged for h refinement and coarsening, and switches those flags to ...
void flag_elements_by_mean_stddev(const ErrorVector &error_per_cell, const Real refine_fraction=1.0, const Real coarsen_fraction=0.0, const unsigned int max_level=libMesh::invalid_uint)
Flags elements for coarsening and refinement based on the computed error passed in error_per_cell...
unsigned char & node_level_mismatch_limit()
If node_level_mismatch_limit is set to a nonzero value, then refinement and coarsening will produce m...
Implements (adaptive) mesh refinement algorithms for a MeshBase.
virtual ~ElementFlagging()=default
Destructor.
unsigned char _face_level_mismatch_limit
Abstract base class to be used for user-specified element flagging.
bool & allow_unrefined_patches()
This flag defaults to false in order to maintain the original behavior of the code, which was to always eliminate unrefined element patches.
bool _use_member_parameters
For backwards compatibility, we initialize this as false and then set it to true if the user uses any...
void uniformly_coarsen(unsigned int n=1)
Attempts to uniformly coarsen the mesh n times.
Real & coarsen_threshold()
The coarsen_threshold provides hysteresis in AMR/C strategies.
bool test_unflagged(bool libmesh_assert_yes=false) const
void set_enforce_mismatch_limit_prior_to_refinement(bool enforce)
Set _enforce_mismatch_limit_prior_to_refinement option.
bool make_flags_parallel_consistent()
Copy refinement flags on ghost elements from their local processors.
This is the base class for point locators.
signed char _overrefined_boundary_limit
bool make_coarsening_compatible()
Take user-specified coarsening flags and augment them so that level-one dependency is satisfied...
void flag_elements_by(ElementFlagging &element_flagging)
Flag elements based on a function object.
bool _enforce_mismatch_limit_prior_to_refinement
This option enforces the mismatch level prior to refinement by checking if refining any element mar...
unsigned char & face_level_mismatch_limit()
If face_level_mismatch_limit is set to a nonzero value, then refinement and coarsening will produce m...
An object whose state is distributed along a set of processors.
const MeshBase & get_mesh() const
void flag_elements_by_elem_fraction(const ErrorVector &error_per_cell, const Real refine_fraction=0.3, const Real coarsen_fraction=0.0, const unsigned int max_level=libMesh::invalid_uint)
Flags elements for coarsening and refinement based on the computed error passed in error_per_cell...
MeshRefinement(MeshBase &mesh)
Constructor.
Node * add_node(Elem &parent, unsigned int child, unsigned int node, processor_id_type proc_id)
Add a node to the mesh.
unsigned char _node_level_mismatch_limit
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Elem * add_elem(Elem *elem)
Adds the element elem to the mesh.
signed char & overrefined_boundary_limit()
If overrefined_boundary_limit is set to a nonnegative value, then refinement and coarsening will prod...
bool refine_and_coarsen_elements()
Refines and coarsens user-requested elements.
void clear()
Deletes all the data that are currently stored.
Elem * topological_neighbor(Elem *elem, const PointLocatorBase *point_locator, const unsigned int side) const
Local dispatch function for getting the correct topological neighbor from the Elem class...
void flag_elements_by_error_fraction(const ErrorVector &error_per_cell, const Real refine_fraction=0.3, const Real coarsen_fraction=0.0, const unsigned int max_level=libMesh::invalid_uint)
Flags elements for coarsening and refinement based on the computed error passed in error_per_cell...
void _smooth_flags(bool refining, bool coarsening)
Smooths refinement flags according to current settings.
void add_p_to_h_refinement()
Takes a mesh whose elements are flagged for h refinement and coarsening, and adds flags to request p ...
bool get_enforce_mismatch_limit_prior_to_refinement()
unsigned char _edge_level_mismatch_limit
bool _coarsen_elements()
Coarsens user-requested elements.
bool eliminate_unrefined_patches()
This algorithm selects an element for refinement if all of its neighbors are (or will be) refined...
dof_id_type _nelem_target
void set_periodic_boundaries_ptr(PeriodicBoundaries *pb_ptr)
Sets the PeriodicBoundaries pointer.
bool _coarsen_by_parents
Refinement parameter values.
Real _absolute_global_tolerance
void uniformly_refine(unsigned int n=1)
Uniformly refines the mesh n times.
virtual void flag_elements()=0
Callback function to be used for marking elements for refinement.