Hermes2D  3.0
Hermes::Hermes2D::Adapt< Scalar > Singleton Reference

#include <adapt.h>

+ Inheritance diagram for Hermes::Hermes2D::Adapt< Scalar >:

Public Member Functions

 Adapt (std::vector< SpaceSharedPtr< Scalar > > spaces, ErrorCalculator< Scalar > *error_calculator, AdaptivityStoppingCriterion< Scalar > *strategy=nullptr)
 
 Adapt (SpaceSharedPtr< Scalar > space, ErrorCalculator< Scalar > *error_calculator, AdaptivityStoppingCriterion< Scalar > *strategy=nullptr)
 
 Adapt (ErrorCalculator< Scalar > *error_calculator, AdaptivityStoppingCriterion< Scalar > *strategy=nullptr)
 
virtual ~Adapt ()
 Destructor. Deallocates allocated private data.
 
void free ()
 Deallocates allocated private data.
 
bool adapt (std::vector< RefinementSelectors::Selector< Scalar > * > refinement_selectors)
 Refines elements based on results from the ErrorCalculator class. More...
 
bool adapt (RefinementSelectors::Selector< Scalar > *refinement_selector)
 Refines elements based on results from the ErrorCalculator class. More...
 
void set_strategy (AdaptivityStoppingCriterion< Scalar > *strategy)
 
void set_regularization_level (int regularization)
 
virtual bool isOkay () const
 Internal checking.
 
std::string getClassName () const
 
void set_spaces (std::vector< SpaceSharedPtr< Scalar > > spaces)
 Set spaces.
 
void set_space (SpaceSharedPtr< Scalar > space)
 
MeshFunctionSharedPtr< double > get_refinementInfoMeshFunction (int component=-1)
 

Protected Member Functions

void set_defaults ()
 Set default values.
 
void init_adapt (std::vector< RefinementSelectors::Selector< Scalar > * > &refinement_selectors, ElementToRefine ***element_refinement_location, MeshSharedPtr *meshes)
 Initialization.
 
int calculate_attempted_element_refinements_count ()
 Return the number of element where a refinement will be sought.
 
void adapt_postprocess (MeshSharedPtr *meshes, int element_refinements_count)
 Handle meshes and spaces at the end of the routine.
 
void deinit_adapt (ElementToRefine ***element_refinement_location)
 Deinitialization.
 
void init ()
 Common code for the constructors.
 
void apply_refinement (const ElementToRefine &elem_ref)
 Apply a single refinement. More...
 
virtual void apply_refinements (ElementToRefine *elems_to_refine, int num_elem_to_process)
 Apply a vector of refinements. More...
 
void fix_shared_mesh_refinements (MeshSharedPtr *meshes, ElementToRefine *&elems_to_refine, int &num_elem_to_process, ElementToRefine ***refinement_location, RefinementSelectors::Selector< Scalar > **refinement_selectors)
 Fixes refinements of a mesh which is shared among multiple components of a multimesh. More...
 
void homogenize_shared_mesh_orders (MeshSharedPtr *meshes)
 Enforces the same order to an element of a mesh which is shared among multiple components. More...
 

Protected Attributes

AdaptivityStoppingCriterion
< Scalar > * 
strategy
 Current strategy.
 
int num
 Number of solution components (as in wf->neq).
 
int regularization
 Regularization (max. level of hanging nodes) level.
 
std::vector< MeshSharedPtr > meshes
 Meshes.
 
std::vector< SpaceSharedPtr
< Scalar > > 
spaces
 Spaces.
 
ErrorCalculator< Scalar > * errorCalculator
 Error calculator.
 
ElementToRefineelements_to_refine
 Information about performed refinements.
 
int elements_to_refine_count
 
MeshFunctionSharedPtr< double > refinementInfoMeshFunction [H2D_MAX_COMPONENTS]
 Mesh function for postprocessing the information about which elements have been refined - on component basis.
 
MeshFunctionSharedPtr< double > refinementInfoMeshFunctionGlobal
 Mesh function for postprocessing the information about which elements have been refined - for the whole system.
 
- Protected Attributes inherited from Hermes::Hermes2D::Mixins::Parallel
unsigned char num_threads_used
 
std::string exceptionMessageCaughtInParallelBlock
 

Friends

template<typename T , typename S >
class AdaptSolver
 

Detailed Description

template<typename Scalar>
singleton Hermes::Hermes2D::Adapt< Scalar >

Evaluation of an error between a (coarse) solution and a reference solution and adaptivity. The class provides basic functionality necessary to adaptively refine elements. Given a reference solution and a coarse solution, it calculates error estimates and it acts as a container for the calculated errors. For default values of attributes, see the method set_defaults().

Definition at line 122 of file adapt.h.

Constructor & Destructor Documentation

template<typename Scalar >
Hermes::Hermes2D::Adapt< Scalar >::Adapt ( std::vector< SpaceSharedPtr< Scalar > >  spaces,
ErrorCalculator< Scalar > *  error_calculator,
AdaptivityStoppingCriterion< Scalar > *  strategy = nullptr 
)

Constructor. Suitable for problems where various solution components belong to different spaces (L2, H1, Hcurl, Hdiv). If proj_norms are not specified, they are defined according to the spaces.

Definition at line 83 of file adapt.cpp.

Member Function Documentation

template<typename Scalar >
bool Hermes::Hermes2D::Adapt< Scalar >::adapt ( std::vector< RefinementSelectors::Selector< Scalar > * >  refinement_selectors)

Refines elements based on results from the ErrorCalculator class.

Parameters
[in]refinement_selectorsVector of selectors.
Returns
True if no element was refined. In usual case, this indicates that adaptivity is not able to refine anything and the adaptivity loop should end.

Definition at line 257 of file adapt.cpp.

template<typename Scalar >
bool Hermes::Hermes2D::Adapt< Scalar >::adapt ( RefinementSelectors::Selector< Scalar > *  refinement_selector)

Refines elements based on results from the ErrorCalculator class.

Parameters
[in]refinement_selectorA pointer to a selector which will select a refinement.
Returns
True if no element was refined. In usual case, this indicates that adaptivity is not able to refine anything and the adaptivity loop should end.

Definition at line 500 of file adapt.cpp.

template<typename Scalar >
void Hermes::Hermes2D::Adapt< Scalar >::apply_refinement ( const ElementToRefine elem_ref)
protected

Apply a single refinement.

Parameters
[in]Arefinement to apply.

Definition at line 648 of file adapt.cpp.

template<typename Scalar >
void Hermes::Hermes2D::Adapt< Scalar >::apply_refinements ( ElementToRefine elems_to_refine,
int  num_elem_to_process 
)
protectedvirtual

Apply a vector of refinements.

Parameters
[in]Avector of refinements to apply.

Definition at line 641 of file adapt.cpp.

template<typename Scalar >
void Hermes::Hermes2D::Adapt< Scalar >::fix_shared_mesh_refinements ( MeshSharedPtr *  meshes,
ElementToRefine *&  elems_to_refine,
int &  num_elem_to_process,
ElementToRefine ***  refinement_location,
RefinementSelectors::Selector< Scalar > **  refinement_selectors 
)
protected

Fixes refinements of a mesh which is shared among multiple components of a multimesh.

If a mesh is shared among components, it has to be refined similarly in order to avoid inconsistency.

Parameters
[in]meshesAn array of meshes of components.
[in]elems_to_refineAn array of refinements.
[in]num_elem_to_processLength of the array elems_to_refine.
[in]idxA 2D array that translates a pair (a component index, an element id) to an index of a refinement in the vector of refinements. If the index is below zero, a given element was not refined.
[in]refinement_selectorsSelectors used by the adaptivity. The selector is used to correct orders of modified refinements using RefinementSelectors::Selector::update_shared_mesh_orders().

Definition at line 510 of file adapt.cpp.

template<typename Scalar >
MeshFunctionSharedPtr< double > Hermes::Hermes2D::Adapt< Scalar >::get_refinementInfoMeshFunction ( int  component = -1)

Return the error mesh function - for postprocessing the information about which elements have been refined.

Parameters
componentThe component.

Definition at line 425 of file adapt.cpp.

template<typename Scalar >
void Hermes::Hermes2D::Adapt< Scalar >::homogenize_shared_mesh_orders ( MeshSharedPtr *  meshes)
protected

Enforces the same order to an element of a mesh which is shared among multiple components.

Parameters
[in]meshesAn array of meshes of components.

Definition at line 615 of file adapt.cpp.

template<typename Scalar >
void Hermes::Hermes2D::Adapt< Scalar >::set_regularization_level ( int  regularization)

Set the regularization level. See attribute regularization.

Definition at line 167 of file adapt.cpp.

template<typename Scalar >
void Hermes::Hermes2D::Adapt< Scalar >::set_strategy ( AdaptivityStoppingCriterion< Scalar > *  strategy)

Set the current strategy.

Parameters
[in]strategyThe strategy, see the info for AdaptivityStoppingCriterion.

Definition at line 161 of file adapt.cpp.


The documentation for this singleton was generated from the following files: