Hermes2D  2.0
Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar > Class Template Reference

A projection-based selector for Hcurl space. More...

#include <hcurl_proj_based_selector.h>

+ Inheritance diagram for Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >:

Public Member Functions

 HcurlProjBasedSelector (CandList cand_list=H2D_HP_ANISO, double conv_exp=1.0, int max_order=H2DRS_DEFAULT_ORDER, HcurlShapeset *user_shapeset=NULL)
 Constructor. More...
 
virtual Selector< Scalar > * clone ()
 Cloning for paralelism.
 
virtual ~HcurlProjBasedSelector ()
 Destructor.
 
- Public Member Functions inherited from Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >
virtual ~ProjBasedSelector ()
 Destructor.
 
void set_error_weights (double weight_h=H2DRS_DEFAULT_ERR_WEIGHT_H, double weight_p=H2DRS_DEFAULT_ERR_WEIGHT_P, double weight_aniso=H2DRS_DEFAULT_ERR_WEIGHT_ANISO)
 Sets error weights. More...
 
double get_error_weight_h () const
 
double get_error_weight_p () const
 
double get_error_weight_aniso () const
 
- Public Member Functions inherited from Hermes::Hermes2D::RefinementSelectors::OptimumSelector< Scalar >
virtual void set_option (const SelOption option, bool enable)
 Enables or disables an option. More...
 
const Hermes::vector< Cand > & get_candidates () const
 Returns a vector of the last generated candidates. More...
 
virtual ~OptimumSelector ()
 Destructor.
 

Protected Types

enum  LocalFuncExpansion { H2D_HCFE_VALUE0 = 0, H2D_HCFE_VALUE1 = 1, H2D_HCFE_CURL = 2, H2D_HCFE_NUM = 3 }
 A function expansion of a function f used by this selector. More...
 
- Protected Types inherited from Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >
typedef double ** ProjMatrixCache [H2DRS_MAX_ORDER+2][H2DRS_MAX_ORDER+2]
 A projection matrix cache type. More...
 
- Protected Types inherited from Hermes::Hermes2D::RefinementSelectors::OptimumSelector< Scalar >
enum  ShapeType {
  H2DST_VERTEX = 0x01, H2DST_HORIZ_EDGE = 0x02, H2DST_VERT_EDGE = 0x04, H2DST_TRI_EDGE = 0x08,
  H2DST_BUBBLE = 0x10
}
 A shape function type. More...
 
enum  ShapeTypeInt {
  H2DSI_VERTEX, H2DSI_HORIZ_EDGE, H2DSI_VERT_EDGE, H2DSI_TRI_EDGE,
  H2DSI_BUBBLE, H2DSI_ANY
}
 

Protected Member Functions

virtual void set_current_order_range (Element *element)
 Sets OptimumSelector::current_max_order and OptimumSelector::current_min_order. More...
 
virtual Scalar ** precalc_ref_solution (int inx_son, Solution< Scalar > *rsln, Element *element, int intr_gip_order)
 Returns an array of values of the reference solution at integration points. More...
 
virtual void precalc_shapes (const double3 *gip_points, const int num_gip_points, const Trf *trfs, const int num_noni_trfs, const Hermes::vector< typename OptimumSelector< Scalar >::ShapeInx > &shapes, const int max_shape_inx, typename ProjBasedSelector< Scalar >::TrfShape &svals, ElementMode2D mode)
 Calculates values of shape function at GIP for all transformations. More...
 
virtual void precalc_ortho_shapes (const double3 *gip_points, const int num_gip_points, const Trf *trfs, const int num_noni_trfs, const Hermes::vector< typename OptimumSelector< Scalar >::ShapeInx > &shapes, const int max_shape_inx, typename ProjBasedSelector< Scalar >::TrfShape &svals, ElementMode2D mode)
 Calculates values of orthogonalized shape function at GIP for all transformations. More...
 
virtual double ** build_projection_matrix (double3 *gip_points, int num_gip_points, const int *shape_inx, const int num_shapes, ElementMode2D mode)
 Builds projection matrix using a given set of shapes. More...
 
virtual Scalar evaluate_rhs_subdomain (Element *sub_elem, const typename ProjBasedSelector< Scalar >::ElemGIP &sub_gip, const typename ProjBasedSelector< Scalar >::ElemSubTrf &sub_trf, const typename ProjBasedSelector< Scalar >::ElemSubShapeFunc &sub_shape)
 Evaluates a value of the right-hande side in a subdomain. More...
 
virtual double evaluate_error_squared_subdomain (Element *sub_elem, const typename ProjBasedSelector< Scalar >::ElemGIP &sub_gip, const typename ProjBasedSelector< Scalar >::ElemSubTrf &sub_trf, const typename ProjBasedSelector< Scalar >::ElemProj &elem_proj)
 Evaluates an squared error of a projection of an element of a candidate onto subdomains. More...
 
- Protected Member Functions inherited from Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >
virtual void precalc_shapes (const double3 *gip_points, const int num_gip_points, const Trf *trfs, const int num_noni_trfs, const Hermes::vector< typename OptimumSelector< Scalar >::ShapeInx > &shapes, const int max_shape_inx, TrfShape &svals, ElementMode2D mode)
 Calculates values of shape function at GIP for all transformations. More...
 
virtual void precalc_ortho_shapes (const double3 *gip_points, const int num_gip_points, const Trf *trfs, const int num_noni_trfs, const Hermes::vector< typename OptimumSelector< Scalar >::ShapeInx > &shapes, const int max_shape_inx, TrfShape &ortho_svals, ElementMode2D mode)
 Calculates values of orthogonalized shape function at GIP for all transformations. More...
 
 ProjBasedSelector (CandList cand_list, double conv_exp, int max_order, Shapeset *shapeset, const typename OptimumSelector< Scalar >::Range &vertex_order, const typename OptimumSelector< Scalar >::Range &edge_bubble_order)
 Constructor. More...
 
virtual void evaluate_cands_error (Element *e, Solution< Scalar > *rsln, double *avg_error, double *dev_error)
 Calculates error of candidates. More...
 
virtual void calc_projection_errors (Element *e, const typename OptimumSelector< Scalar >::CandsInfo &info_h, const typename OptimumSelector< Scalar >::CandsInfo &info_p, const typename OptimumSelector< Scalar >::CandsInfo &info_aniso, Solution< Scalar > *rsln, CandElemProjError herr[H2D_MAX_ELEMENT_SONS], CandElemProjError perr, CandElemProjError anisoerr[H2D_MAX_ELEMENT_SONS])
 Calculates projection errors of an elements of candidates for all permutations of orders. More...
 
void calc_error_cand_element (const ElementMode2D mode, double3 *gip_points, int num_gip_points, const int num_sub, Element **sub_domains, Trf **sub_trfs, Scalar ***sub_rvals, Hermes::vector< TrfShapeExp > **sub_nonortho_svals, Hermes::vector< TrfShapeExp > **sub_ortho_svals, const typename OptimumSelector< Scalar >::CandsInfo &info, CandElemProjError errors_squared)
 Calculate projection errors of an element of an candidate considering multiple orders. More...
 
virtual Scalar evaluate_rhs_subdomain (Element *sub_elem, const ElemGIP &sub_gip, const ElemSubTrf &sub_trf, const ElemSubShapeFunc &sub_shape)=0
 Evaluates a value of the right-hande side in a subdomain. More...
 
virtual double evaluate_error_squared_subdomain (Element *sub_elem, const ElemGIP &sub_gip, const ElemSubTrf &sub_trf, const ElemProj &elem_proj)=0
 Evaluates an squared error of a projection of an element of a candidate onto subdomains. More...
 
- Protected Member Functions inherited from Hermes::Hermes2D::RefinementSelectors::OptimumSelector< Scalar >
void update_cands_info (CandsInfo &info_h, CandsInfo &info_p, CandsInfo &info_aniso) const
 Updates information about candidates. Initial information is provided. More...
 
void append_candidates_split (const int start_quad_order, const int last_order, const int split, bool iso_p)
 Appends cancidates of a given refinement and a given range of orders. More...
 
virtual void create_candidates (Element *e, int quad_order, int max_ha_quad_order, int max_p_quad_order)
 Fill a list of candidates. More...
 
void evaluate_candidates (Element *e, Solution< Scalar > *rsln, double *avg_error, double *dev_error)
 Calculates error, dofs, and score of candidates. More...
 
virtual void select_best_candidate (Element *e, const double avg_error, const double dev_error, int *selected_cand, int *selected_h_cand)
 Sorts and selects the best candidate and the best H-candidate according to the score. More...
 
virtual void evaluate_cands_dof (Element *e, Solution< Scalar > *rsln)
 Calculates DOF of candidates. More...
 
virtual void evaluate_cands_score (Element *e)
 Evalutes score of candidates. More...
 
void add_bubble_shape_index (int order_h, int order_v, std::map< int, bool > &used_shape_index, Hermes::vector< ShapeInx > &indices, ElementMode2D mode)
 Adds an index (or indices) of a bubble function of a given order if the shape index was not used yet. More...
 
void build_shape_indices (const ElementMode2D mode, const Range &vertex_order, const Range &edge_bubble_order)
 Builds shape index table OptimumSelector::shape_indices. More...
 
int calc_num_shapes (int mode, int order_h, int order_v, int allowed_type_mask)
 Returns a number of shapes that may be contained in an element of a given order. More...
 
 OptimumSelector (CandList cand_list, double conv_exp, int max_order, Shapeset *shapeset, const Range &vertex_order, const Range &edge_bubble_order)
 Constructor. More...
 
virtual bool select_refinement (Element *element, int quad_order, Solution< Scalar > *rsln, ElementToRefine &refinement)
 Selects a refinement. More...
 
virtual void generate_shared_mesh_orders (const Element *element, const int orig_quad_order, const int refinement, int tgt_quad_orders[H2D_MAX_ELEMENT_SONS], const int *suggested_quad_orders)
 Generates orders of elements which will be created due to a proposed refinement in another component that shares the same a mesh. More...
 
- Protected Member Functions inherited from Hermes::Hermes2D::RefinementSelectors::Selector< Scalar >
 Selector (int max_order=H2DRS_DEFAULT_ORDER)
 Constructor. More...
 

Protected Attributes

Scalar * precalc_rvals [H2D_MAX_ELEMENT_SONS][H2D_HCFE_NUM]
 Array of arrays of precalculates. The first index is an index of a subdomain, the second index is an index of a function expansion (see enum LocalFuncExpansion).
 
Scalar ** precalc_rvals_curl
 Pre-calculated values of curls for every subdomain. Allocated using new_matrix.
 
- Protected Attributes inherited from Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >
bool warn_uniform_orders
 True if the selector has already warned about possible inefficiency. More...
 
ProjMatrixCache proj_matrix_cache [H2D_NUM_MODES]
 An array of projection matrices. More...
 
Hermes::vector< ValueCacheItem
< Scalar > > 
nonortho_rhs_cache
 An array of cached right-hand side values. More...
 
Hermes::vector< ValueCacheItem
< Scalar > > 
ortho_rhs_cache
 
double error_weight_h
 A coefficient that multiplies error of H-candidate. The default value is H2DRS_DEFAULT_ERR_WEIGHT_H.
 
double error_weight_p
 A coefficient that multiplies error of P-candidate. The default value is H2DRS_DEFAULT_ERR_WEIGHT_P.
 
double error_weight_aniso
 A coefficient that multiplies error of ANISO-candidate. The default value is H2DRS_DEFAULT_ERR_WEIGHT_ANISO.
 
- Protected Attributes inherited from Hermes::Hermes2D::RefinementSelectors::OptimumSelector< Scalar >
bool opt_symmetric_mesh
 True if H2D_PREFER_SYMMETRIC_MESH is set. True by default.
 
bool opt_apply_exp_dof
 True if H2D_APPLY_CONV_EXP_DOF is set. False by default.
 
CandList cand_list
 Allowed candidate types.
 
double conv_exp
 Convergence power. Modifies difference between DOFs before they are used to calculate the score.
 
Hermes::vector< Candcandidates
 A vector of candidates. The first candidate has to be equal to the original element with a refinement ::H2D_REFINEMENT_P.
 
int current_max_order
 Current maximum order.
 
int current_min_order
 Current minimum order.
 
Shapesetshapeset
 A shapeset used to calculate error.
 
Hermes::vector< ShapeInxshape_indices [H2D_NUM_MODES]
 Shape indices. The first index is a mode (ElementMode2D).
 
int max_shape_inx [H2D_NUM_MODES]
 A maximum index of a shape function. The first index is a mode (ElementMode2D).
 
int next_order_shape [H2D_NUM_MODES][H2DRS_MAX_ORDER+1]
 An index to the array OptimumSelector::shape_indices of a shape function of the next uniform order. The first index is a mode (ElementMode2D), the second index is an order.
 
bool has_vertex_shape [H2D_NUM_MODES]
 True if the shapeset OptimumSelector::shapeset contains vertex functions. The index is a mode (ElementMode2D).
 
bool has_edge_shape [H2D_NUM_MODES]
 True if the shapeset OptimumSelector::shapeset contains edge functions. The index is a mode (ElementMode2D).
 
bool has_bubble_shape [H2D_NUM_MODES]
 True if the shapeset OptimumSelector::shapeset contains bubble functions. The index is a mode (ElementMode2D).
 
- Protected Attributes inherited from Hermes::Hermes2D::RefinementSelectors::Selector< Scalar >
const int max_order
 
bool isAClone
 Internal.
 

Static Protected Attributes

static const int H2DRS_MAX_HCURL_ORDER = 6
 A maximum used order in this Hcurl-space selector. More...
 
- Static Protected Attributes inherited from Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >
static const int H2DRS_VALCACHE_INVALID = 0
 State of value cache: item contains undefined or invalid value.
 
static const int H2DRS_VALCACHE_VALID = 1
 State of value cache: item contains a valid value.
 
static const int H2DRS_VALCACHE_USER = 2
 State of value cache: the first state ID which can be used by the user.
 

Additional Inherited Members

- Public Types inherited from Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >
typedef Hermes::vector
< TrfShapeExp
TrfShape [H2D_TRF_NUM]
 Evaluated shapes for all possible transformations for all points. The first index is a transformation, the second index is an index of a shape function.
 
- Public Attributes inherited from Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >
bool * cached_shape_vals_valid
 True if shape values were already initialized.
 
TrfShapecached_shape_ortho_vals
 Precalculated valus of orthogonalized shape functions.
 
TrfShapecached_shape_vals
 Precalculate values of shape functions.
 

Detailed Description

template<typename Scalar>
class Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >

A projection-based selector for Hcurl space.

This class is designed to be used with the class HcurlAdapt. Since an initialization of the class may take a long time, it is suggested to create the instance outside the adaptivity loop.

Definition at line 37 of file function.h.

Member Enumeration Documentation

A function expansion of a function f used by this selector.

Enumerator
H2D_HCFE_VALUE0 

A function expansion: f_0.

H2D_HCFE_VALUE1 

A function expansion: f_1.

H2D_HCFE_CURL 

A function expansion: curl = df_1/dx - df_0/dy.

H2D_HCFE_NUM 

A total considered function expansion.

Definition at line 49 of file hcurl_proj_based_selector.h.

Constructor & Destructor Documentation

template<typename Scalar >
Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >::HcurlProjBasedSelector ( CandList  cand_list = H2D_HP_ANISO,
double  conv_exp = 1.0,
int  max_order = H2DRS_DEFAULT_ORDER,
HcurlShapeset user_shapeset = NULL 
)

Constructor.

Parameters
[in]cand_listA predefined list of candidates.
[in]conv_expA conversion exponent, see evaluate_cands_score().
[in]max_orderA maximum order which considered. If H2DRS_DEFAULT_ORDER, a maximum order supported by the selector is used, see HcurlProjBasedSelector::H2DRS_MAX_HCURL_ORDER.
[in]user_shapesetA shapeset. If NULL, it will use internal instance of the class HcurlShapeset.

Definition at line 17 of file hcurl_proj_based_selector.cpp.

Member Function Documentation

template<typename Scalar >
double ** Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >::build_projection_matrix ( double3 *  gip_points,
int  num_gip_points,
const int *  shape_inx,
const int  num_shapes,
ElementMode2D  mode 
)
protectedvirtual

Builds projection matrix using a given set of shapes.

Overriden function. For details, see ProjBasedSelector::build_projection_matrix().

Implements Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >.

Definition at line 231 of file hcurl_proj_based_selector.cpp.

template<typename Scalar >
double Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >::evaluate_error_squared_subdomain ( Element sub_elem,
const typename ProjBasedSelector< Scalar >::ElemGIP sub_gip,
const typename ProjBasedSelector< Scalar >::ElemSubTrf sub_trf,
const typename ProjBasedSelector< Scalar >::ElemProj elem_proj 
)
protectedvirtual

Evaluates an squared error of a projection of an element of a candidate onto subdomains.

Overriden function. For details, see ProjBasedSelector::evaluate_error_squared_subdomain().

Definition at line 312 of file hcurl_proj_based_selector.cpp.

template<typename Scalar >
Scalar Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >::evaluate_rhs_subdomain ( Element sub_elem,
const typename ProjBasedSelector< Scalar >::ElemGIP sub_gip,
const typename ProjBasedSelector< Scalar >::ElemSubTrf sub_trf,
const typename ProjBasedSelector< Scalar >::ElemSubShapeFunc sub_shape 
)
protectedvirtual

Evaluates a value of the right-hande side in a subdomain.

Overriden function. For details, see ProjBasedSelector::evaluate_rhs_subdomain().

Definition at line 271 of file hcurl_proj_based_selector.cpp.

template<typename Scalar >
void Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >::precalc_ortho_shapes ( const double3 *  gip_points,
const int  num_gip_points,
const Trf trfs,
const int  num_noni_trfs,
const Hermes::vector< typename OptimumSelector< Scalar >::ShapeInx > &  shapes,
const int  max_shape_inx,
typename ProjBasedSelector< Scalar >::TrfShape svals,
ElementMode2D  mode 
)
protectedvirtual

Calculates values of orthogonalized shape function at GIP for all transformations.

Overriden function. For details, see ProjBasedSelector::precalc_ortho_shapes().

Definition at line 108 of file hcurl_proj_based_selector.cpp.

template<typename Scalar >
Scalar ** Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >::precalc_ref_solution ( int  inx_son,
Solution< Scalar > *  rsln,
Element element,
int  intr_gip_order 
)
protectedvirtual

Returns an array of values of the reference solution at integration points.

Overriden function. For details, see ProjBasedSelector::precalc_ref_solution().

Implements Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >.

Definition at line 206 of file hcurl_proj_based_selector.cpp.

template<typename Scalar >
void Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >::precalc_shapes ( const double3 *  gip_points,
const int  num_gip_points,
const Trf trfs,
const int  num_noni_trfs,
const Hermes::vector< typename OptimumSelector< Scalar >::ShapeInx > &  shapes,
const int  max_shape_inx,
typename ProjBasedSelector< Scalar >::TrfShape svals,
ElementMode2D  mode 
)
protectedvirtual

Calculates values of shape function at GIP for all transformations.

Overriden function. For details, see ProjBasedSelector::precalc_shapes().

Definition at line 55 of file hcurl_proj_based_selector.cpp.

template<typename Scalar >
void Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >::set_current_order_range ( Element element)
protectedvirtual

Sets OptimumSelector::current_max_order and OptimumSelector::current_min_order.

The default order range is[1, ::H2DRS_MAX_HCURL_ORDER]. If curved, the upper boundary of the range becomes lower. Overriden function. For details, see OptimumSelector::set_current_order_range().

Implements Hermes::Hermes2D::RefinementSelectors::OptimumSelector< Scalar >.

Definition at line 44 of file hcurl_proj_based_selector.cpp.

Member Data Documentation

template<typename Scalar >
const int Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >::H2DRS_MAX_HCURL_ORDER = 6
staticprotected

A maximum used order in this Hcurl-space selector.

Todo:
Replace the numerical constant after a symbolic constant is added to Hcurl shapeset which would declare the maximum supported order.

Definition at line 59 of file hcurl_proj_based_selector.h.


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