A wrapper for refinement strategies. More...
#include <grid_refinement.h>
Public Member Functions | |
GridRefinement (const std::string §ion_name="", const unsigned int &n_refinement_cycles=1, const RefinementStrategy &strategy=RefinementStrategy::global, const std::string &estimator_type="kelly", const double &top_parameter=.3, const double &bottom_parameter=0.1, const unsigned int &max_cells=0, const int &min_level=0, const int &max_level=0, const std::map< std::string, std::function< void(Vector< float > &)>> &optional_estimators={}, const ComponentMask &component_mask=ComponentMask()) | |
Constructor. More... | |
template<int dim, int spacedim> | |
void | mark_cells (const Vector< float > &criteria, Triangulation< dim, spacedim > &tria) const |
Mark cells a the triangulation for refinement or coarsening, according to the given strategy applied to the supplied vector representing local error criteria. More... | |
template<int dim, int spacedim> | |
void | mark_cells (const Vector< float > &criteria, parallel::distributed::Triangulation< dim, spacedim > &tria) const |
Mark cells of a distribtued triangulation for refinement or coarsening, according to the given strategy applied to the supplied vector representing local error criteria. More... | |
template<int dim, int spacedim, typename VectorType > | |
void | estimate_error (const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, const VectorType &solution, Vector< float > &estimated_error_per_cell, const std::map< types::boundary_id, const Function< spacedim, typename VectorType::value_type > * > &neumann_bc={}, const Function< spacedim > *coefficients=nullptr, const typename KellyErrorEstimator< dim, spacedim >::Strategy strategy=KellyErrorEstimator< dim, spacedim >::cell_diameter_over_24) const |
Call the error estimator specified in the parameter file. More... | |
template<int dim, int spacedim, typename VectorType > | |
void | estimate_error (const DoFHandler< dim, spacedim > &dof_handler, const VectorType &solution, Vector< float > &estimated_error_per_cell, const std::map< types::boundary_id, const Function< spacedim, typename VectorType::value_type > * > &neumann_bc={}, const Function< spacedim > *coefficients=nullptr, const typename KellyErrorEstimator< dim, spacedim >::Strategy strategy=KellyErrorEstimator< dim, spacedim >::cell_diameter_over_24) const |
Call the error estimator specified in the parameter file with a default mapping. More... | |
const RefinementStrategy & | get_strategy () const |
Get the current strategy object. More... | |
const unsigned int & | get_n_refinement_cycles () const |
Get the total number of refinemt cycles. More... | |
std_cxx20::ranges::iota_view< unsigned int, unsigned int > | get_refinement_cycles () const |
Get Return an object that can be thought of as an array containing all indices from zero to n_refinement_cycles . More... | |
template<int dim, int spacedim, typename VectorType , typename Tria > | |
void | estimate_mark_refine (const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, const VectorType &solution, Tria &tria) const |
Perform all the steps of the ESTIMATE-MARK-REFINE cycle. More... | |
template<int dim, int spacedim, typename VectorType , typename Tria > | |
void | estimate_mark_refine (const DoFHandler< dim, spacedim > &dof_handler, const VectorType &solution, Tria &tria) const |
Perform all the steps of the ESTIMATE-MARK-REFINE cycle. More... | |
![]() | |
ParameterAcceptor (const std::string §ion_name="") | |
unsigned int | get_acceptor_id () const |
virtual | ~ParameterAcceptor () override |
virtual void | declare_parameters (ParameterHandler &prm) |
virtual void | parse_parameters (ParameterHandler &prm) |
std::string | get_section_name () const |
std::vector< std::string > | get_section_path () const |
void | add_parameter (const std::string &entry, ParameterType ¶meter, const std::string &documentation="", ParameterHandler &prm_=prm, const Patterns::PatternBase &pattern=*Patterns::Tools::Convert< ParameterType >::to_pattern()) |
void | enter_subsection (const std::string &subsection) |
void | leave_subsection () |
void | enter_my_subsection (ParameterHandler &prm) |
void | leave_my_subsection (ParameterHandler &prm) |
void | serialize (Archive &ar, const unsigned int version) |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
![]() | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
Subscriptor (Subscriptor &&) noexcept | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
Subscriptor & | operator= (Subscriptor &&) noexcept |
void | serialize (Archive &ar, const unsigned int version) |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
Private Member Functions | |
template<int dim, int spacedim> | |
void | limit_levels (Triangulation< dim, spacedim > &tria) const |
Make sure that the refinement level is kept between min_level and max_level . More... | |
Private Attributes | |
unsigned int | n_refinement_cycles |
RefinementStrategy | strategy |
double | top_parameter |
double | bottom_parameter |
unsigned int | max_cells |
int | min_level |
int | max_level |
std::string | estimator_type |
std::map< std::string, std::function< void(Vector< float > &)> > | optional_estimators |
ComponentMask | component_mask |
types::subdomain_id | subdomain_id |
types::material_id | material_id |
Additional Inherited Members | |
![]() | |
static void | initialize (const std::string &filename="", const std::string &output_filename="", const ParameterHandler::OutputStyle output_style_for_output_filename=ParameterHandler::Short, ParameterHandler &prm=ParameterAcceptor::prm, const ParameterHandler::OutputStyle output_style_for_filename=ParameterHandler::DefaultStyle) |
static void | initialize (std::istream &input_stream, ParameterHandler &prm=ParameterAcceptor::prm) |
static void | clear () |
static void | parse_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
static void | declare_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
![]() | |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
![]() | |
boost::signals2::signal< void()> | declare_parameters_call_back |
boost::signals2::signal< void()> | parse_parameters_call_back |
![]() | |
static ParameterHandler | prm |
![]() | |
const std::string | section_name |
std::vector< std::string > | subsections |
A wrapper for refinement strategies.
This class implements a parametrized version of the ESTIMATE-MARK-REFINE steps in AFEM methods. In particular, it allows you to select between
and to use KellyErrorEstimator, or a custom estimator, to compute the error indicators in the first two cases.
In addition we have also some control parameters to guarantee that the number of cells is maintained under a maximum, and that the refinement level is kept between min_level
and max_level
.
Definition at line 68 of file grid_refinement.h.
ParsedTools::GridRefinement::GridRefinement | ( | const std::string & | section_name = "" , |
const unsigned int & | n_refinement_cycles = 1 , |
||
const RefinementStrategy & | strategy = RefinementStrategy::global , |
||
const std::string & | estimator_type = "kelly" , |
||
const double & | top_parameter = .3 , |
||
const double & | bottom_parameter = 0.1 , |
||
const unsigned int & | max_cells = 0 , |
||
const int & | min_level = 0 , |
||
const int & | max_level = 0 , |
||
const std::map< std::string, std::function< void(Vector< float > &)> | , | ||
& | optional_estimators = {} , |
||
const ComponentMask & | component_mask = ComponentMask() |
||
) |
Constructor.
Definition at line 22 of file grid_refinement.cc.
References ParameterAcceptor::add_parameter(), e(), ParameterAcceptor::enter_subsection(), ParameterAcceptor::leave_subsection(), optional_estimators, and ParameterAcceptor::prm.
void ParsedTools::GridRefinement::mark_cells | ( | const Vector< float > & | criteria, |
Triangulation< dim, spacedim > & | tria | ||
) | const |
Mark cells a the triangulation for refinement or coarsening, according to the given strategy applied to the supplied vector representing local error criteria.
Cells are only marked for refinement or coarsening. No refinement is actually performed. You need to call Triangulation::execute_coarsening_and_refinement() yourself.
void ParsedTools::GridRefinement::mark_cells | ( | const Vector< float > & | criteria, |
parallel::distributed::Triangulation< dim, spacedim > & | tria | ||
) | const |
Mark cells of a distribtued triangulation for refinement or coarsening, according to the given strategy applied to the supplied vector representing local error criteria.
If the criterion which is specified in the parameter file is not available, an exception is thrown.
Cells are only marked for refinement or coarsening. No refinement is actually performed. You need to call Triangulation::execute_coarsening_and_refinement() yourself.
void ParsedTools::GridRefinement::estimate_error | ( | const Mapping< dim, spacedim > & | mapping, |
const DoFHandler< dim, spacedim > & | dof_handler, | ||
const VectorType & | solution, | ||
Vector< float > & | estimated_error_per_cell, | ||
const std::map< types::boundary_id, const Function< spacedim, typename VectorType::value_type > * > & | neumann_bc = {} , |
||
const Function< spacedim > * | coefficients = nullptr , |
||
const typename KellyErrorEstimator< dim, spacedim >::Strategy | strategy = KellyErrorEstimator< dim, spacedim >::cell_diameter_over_24 |
||
) | const |
Call the error estimator specified in the parameter file.
void ParsedTools::GridRefinement::estimate_error | ( | const DoFHandler< dim, spacedim > & | dof_handler, |
const VectorType & | solution, | ||
Vector< float > & | estimated_error_per_cell, | ||
const std::map< types::boundary_id, const Function< spacedim, typename VectorType::value_type > * > & | neumann_bc = {} , |
||
const Function< spacedim > * | coefficients = nullptr , |
||
const typename KellyErrorEstimator< dim, spacedim >::Strategy | strategy = KellyErrorEstimator< dim, spacedim >::cell_diameter_over_24 |
||
) | const |
Call the error estimator specified in the parameter file with a default mapping.
|
inline |
Get the current strategy object.
Definition at line 167 of file grid_refinement.h.
References strategy.
|
inline |
Get the total number of refinemt cycles.
Definition at line 176 of file grid_refinement.h.
References n_refinement_cycles.
|
inline |
Get Return an object that can be thought of as an array containing all indices from zero to n_refinement_cycles
.
Definition at line 186 of file grid_refinement.h.
References n_refinement_cycles.
void ParsedTools::GridRefinement::estimate_mark_refine | ( | const Mapping< dim, spacedim > & | mapping, |
const DoFHandler< dim, spacedim > & | dof_handler, | ||
const VectorType & | solution, | ||
Tria & | tria | ||
) | const |
Perform all the steps of the ESTIMATE-MARK-REFINE cycle.
void ParsedTools::GridRefinement::estimate_mark_refine | ( | const DoFHandler< dim, spacedim > & | dof_handler, |
const VectorType & | solution, | ||
Tria & | tria | ||
) | const |
Perform all the steps of the ESTIMATE-MARK-REFINE cycle.
|
private |
Make sure that the refinement level is kept between min_level
and max_level
.
|
private |
Definition at line 220 of file grid_refinement.h.
Referenced by get_n_refinement_cycles(), and get_refinement_cycles().
|
private |
Definition at line 221 of file grid_refinement.h.
Referenced by get_strategy().
|
private |
Definition at line 222 of file grid_refinement.h.
|
private |
Definition at line 223 of file grid_refinement.h.
|
private |
Definition at line 224 of file grid_refinement.h.
|
private |
Definition at line 225 of file grid_refinement.h.
|
private |
Definition at line 226 of file grid_refinement.h.
|
private |
Definition at line 228 of file grid_refinement.h.
|
private |
Definition at line 230 of file grid_refinement.h.
Referenced by GridRefinement().
|
private |
Definition at line 231 of file grid_refinement.h.
|
private |
Definition at line 232 of file grid_refinement.h.
|
private |
Definition at line 234 of file grid_refinement.h.