Hermes2D  2.0
Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar > Class Template Referenceabstract

A general projection-based selector. More...

#include <proj_based_selector.h>

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

Classes

struct  ElemGIP
 Integration points in the reference domain of an element of a candidate. More...
 
struct  ElemProj
 Projection of an element of a candidate. More...
 
struct  ElemSubShapeFunc
 A shape function on subdomain of an element. More...
 
struct  ElemSubTrf
 A transformation from a reference domain of a subdomain to a reference domain of an element of a candidate. More...
 
class  TrfShapeExp
 A transform shaped function expansions. More...
 
struct  ValueCacheItem
 An item of a value cache. More...
 

Public Types

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 Member Functions

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.
 

Public Attributes

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.
 
- Public Attributes inherited from Hermes::Hermes2D::RefinementSelectors::OptimumSelector< Scalar >
int **** num_shapes
 

Protected Types

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 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 ** precalc_ref_solution (int inx_son, Solution< Scalar > *rsln, Element *element, int intr_gip_order)=0
 Returns an array of values of the reference solution at integration points. More...
 
virtual double ** build_projection_matrix (double3 *gip_points, int num_gip_points, const int *shape_inx, const int num_shapes, ElementMode2D)=0
 Builds projection matrix using a given set of shapes. 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...
 
virtual void set_current_order_range (Element *element)=0
 Sets OptimumSelector::current_max_order and OptimumSelector::current_min_order. 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...
 
virtual Selector< Scalar > * clone ()=0
 Cloning for paralelism.
 

Protected Attributes

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_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.
 

Detailed Description

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

A general projection-based selector.

Calculates an error of a candidate as a combination of errors of elements of a candidate. Each element of a candidate is calculated separatelly.

Expanding

In order to implement a support for a new space or a new approach to calculation of squared error, implement following methods:

Definition at line 34 of file function.h.

Member Typedef Documentation

template<typename Scalar>
typedef double** Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::ProjMatrixCache[H2DRS_MAX_ORDER+2][H2DRS_MAX_ORDER+2]
protected

A projection matrix cache type.

Defines a cache of projection matrices for all possible permutations of orders.

Definition at line 221 of file proj_based_selector.h.

Constructor & Destructor Documentation

template<typename Scalar >
Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::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 
)
protected

Constructor.

Intializes attributes, projection matrix cache (ProjBasedSelector::proj_matrix_cache), and allocates rhs cache (ProjBasedSelector::rhs_cache).

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.
[in]shapesetA shapeset. It cannot be NULL.
[in]vertex_orderA range of orders for vertex functions. Use an empty range (i.e. Range()) to skip vertex functions.
[in]edge_bubble_orderA range of orders for edge and bubble functions. Use an empty range (i.e. Range()) to skip edge and bubble functions.

Definition at line 17 of file proj_based_selector.cpp.

Member Function Documentation

template<typename Scalar>
virtual double** Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::build_projection_matrix ( double3 *  gip_points,
int  num_gip_points,
const int *  shape_inx,
const int  num_shapes,
ElementMode2D   
)
protectedpure virtual

Builds projection matrix using a given set of shapes.

Override to calculate a projection matrix.

Parameters
[in]gip_pointsIntegration points. The first index is an index of an integration point, the second index is defined through the enum GIP2DIndices.
[in]num_gip_pointsA number of integration points.
[in]shape_inxAn array of shape indices.
[in]num_shapesA number of shape indices in the array.
Returns
A projection matrix. The matrix has to be allocated trought new_matrix(). The size of the matrix has to be num_shapes x num_shapes.

Implemented in Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >, Hermes::Hermes2D::RefinementSelectors::H1ProjBasedSelector< Scalar >, and Hermes::Hermes2D::RefinementSelectors::L2ProjBasedSelector< Scalar >.

Referenced by Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::calc_error_cand_element().

template<typename Scalar >
void Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::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 
)
protected

Calculate projection errors of an element of an candidate considering multiple orders.

An element of a candidate may span over multiple sub-domains. All integration uses the reference domain.

Modify this method in order to add ortho-adaptivity.

Parameters
[in]modeA mode (enum ElementMode2D).
[in]gip_pointsIntegration points in the reference domain.
[in]num_gip_pointsA number of integration points.
[in]num_subA number of subdomains.
[in]sub_domainsSubdomains (elements of a reference mesh) that occupy the element of a candidate. The first index is an index of the subdomain.
[in]sub_trfsTransformation from a reference domain of a subdomain to a reference domain of the element of a candidate. The first index is an index of the subdomain.
[in]sub_rvalsValues at integration points for every subdomain. Contents of this array (the second index) is defined by the method precalc_ref_solution(). The first index is an index of the subdomain.
[in]sub_nonortho_svals
[in]sub_ortho_svals
[in]infoInformation about candidates: range of orders, etc.
[out]errors_squaredCalculated squared errors for all orders specified through info.

Definition at line 428 of file proj_based_selector.cpp.

Referenced by Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::calc_projection_errors().

template<typename Scalar >
void Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::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] 
)
protectedvirtual

Calculates projection errors of an elements of candidates for all permutations of orders.

Errors are not normalized and they are squared. The range of orders is defined through parameters info_h, info_h, and info_aniso.

If defining a new evalution (e.g. using a difference space) of errors, follows instructions in Expanding.

Parameters
[in]eAn element that is being examined by the selector.
[in]info_hInformation about H-candidates: range of orders, etc.
[in]info_pInformation about P-candidates: range of orders, etc.
[in]info_anisoInformation about ANISO-candidates: range of orders, etc.
[in]rslnA reference solution.
[out]herrAn error of elements of H-candidates of various permutation of orders.
[out]perrAn error of elements of P-candidates of various permutation of orders.
[out]anisoerrAn error of elements of ANISO-candidates of various permutation of orders.

Definition at line 233 of file proj_based_selector.cpp.

Referenced by Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::evaluate_cands_error().

template<typename Scalar >
void Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::evaluate_cands_error ( Element e,
Solution< Scalar > *  rsln,
double *  avg_error,
double *  dev_error 
)
protectedvirtual

Calculates error of candidates.

Overriden function. For details, see OptimumSelector::evaluate_cands_error().

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

Definition at line 126 of file proj_based_selector.cpp.

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

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

Override to calculate an error using a provided projection and subdomains.

Parameters
[in]sub_elemAn element of a reference mesh that corresponds to a subdomain.
[in]sub_gipIntegration points. Locations of integration points are defined in the reference domain. Use sub_trf to transform it to the reference domain of an element of a candidate.
[in]sub_trfA transformation from a reference domain of a subdomain to the reference domain of an element of a candidate.
[in]elem_projA projection of an element of a candidate on subdomains.
Returns
A squared error of an element of a candidate.

Referenced by Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::calc_error_cand_element().

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

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

Override to calculate a value of the right-hand side.

Parameters
[in]sub_elemAn element of a reference mesh that corresponds to a subdomain.
[in]sub_gipIntegration points. Locations of integration points are defined in the reference domain. Use sub_trf to transform it to the reference domain of an element of a candidate.
[in]sub_trfA transformation from a reference domain of a subdomain to the reference domain of an element of a candidate.
[in]sub_shapeInformation about a shape function: shape index and calculated expansions at integration points, if any.
Returns
A value of the righ-hand size of a given shape function.

Referenced by Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::calc_error_cand_element().

template<typename Scalar>
virtual void Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< 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,
TrfShape ortho_svals,
ElementMode2D  mode 
)
inlineprotectedvirtual

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

Override this method to supply a pre-calculated vales of orthonormalized shape function expansions at integration points. If override, the method has to supply precalculate expansions for all transformations plus an identity transformation. An index of the identity transformation is ::H2D_TRF_IDENTITY.

If overridden and if this method orthonormalizes shape functions at the integration points, it is suggested to use the method precalc_shapes() in order to obtain initial values of shape functions at integration points.

Parameters
[in]gip_pointsIntegration points. The first index is an index of an integration point, the second index is an element of the enum GIP2DIndices.
[in]num_gip_pointsA number of integration points.
[in]trfsA transformations. The array has ::H2D_TRF_NUM elements. The index of the identity transformation is ::H2D_TRF_IDENTITY.
[in]num_noni_trfsA number of transformations which are not identity. This number might be lower than than ::H2D_TRF_NUM.
[in]shapesShape functions.
[in]max_shape_inxA maximum index of a shape function. This is used to resize a sub-array of the array svals.
[out]svalsA precalculated values of shape functions. The user has to resize the array of shape functions for every used transformation including the identity to the a size defined by max_shape_inx. The system will assume that shape functions are precalculated if the array corresponding to the identity function is not empty.

Definition at line 165 of file proj_based_selector.h.

Referenced by Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::calc_projection_errors().

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

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

The method have to set an active element and an quadrature on its own.

Override to provide all necessary values. Provided pointers should stay valid through an execution of the method calc_projection_errors(). Since an explicit deallocation of these pointers is not done, it is suggested to provide pointers to attributes of the class rather than to dynamically allocate an array. The method can assume that the an element is refined into H2D_MAX_ELEMENT_SONS elements (sons) in the reference mesh.

Parameters
[in]inx_sonAn index of a son of an element, i.e., an index of a subdomain. The index is in a range[0, H2D_MAX_ELEMENT_SONS - 1].
[in]rslnA reference solution.
[in]elementAn element of the coarse solution. An element of both the same geometry and the same ID have to be present in the mesh of the reference solution.
[in]intr_gip_orderAn order of quadrature integration. The number of quadrature points should be retrieved through a quadrature stored in the paremeter rsln.
Returns
A pointer to 2D array. The first index is an index of the function expansion (f, df/dx, ...), the second index is an index of the integration point.

Implemented in Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >, Hermes::Hermes2D::RefinementSelectors::H1ProjBasedSelector< Scalar >, and Hermes::Hermes2D::RefinementSelectors::L2ProjBasedSelector< Scalar >.

Referenced by Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::calc_projection_errors().

template<typename Scalar>
virtual void Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< 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,
TrfShape svals,
ElementMode2D  mode 
)
inlineprotectedvirtual

Calculates values of shape function at GIP for all transformations.

Override this method to supply a pre-calculated vales of shape function expansions at integration points. If override, the method has to supply precalculate expansions for all transformations plus an identity transformation. An index of the identity transformation is ::H2D_TRF_IDENTITY.

Parameters
[in]gip_pointsIntegration points. The first index is an index of an integration point, the second index is an element of the enum GIP2DIndices.
[in]num_gip_pointsA number of integration points.
[in]trfsA transformations. The array has ::H2D_TRF_NUM elements. The index of the identity transformation is ::H2D_TRF_IDENTITY.
[in]num_noni_trfsA number of transformations which are not identity. This number might be lower than than ::H2D_TRF_NUM.
[in]shapesShape functions.
[in]max_shape_inxA maximum index of a shape function. This is used to resize a sub-array of the array svals.
[out]svalsA precalculated values of shape functions. The user has to resize the array of shape functions for every used transformation including the identity to the a size defined by max_shape_inx. The system will assume that shape functions are precalculated if the array corresponding to the identity function is not empty.

Definition at line 145 of file proj_based_selector.h.

Referenced by Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::calc_projection_errors().

template<typename Scalar >
void Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::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.

An error weight is a multiplicative coefficient that modifies an error of candidate. Error weights can be used to proritize refinements. Error weights are applied in the method evaluate_cands_error().

Parameters
[in]weight_hAn error weight of H-candidate. The default value is H2DRS_DEFAULT_ERR_WEIGHT_H.
[in]weight_pAn error weight of P-candidate. The default value is H2DRS_DEFAULT_ERR_WEIGHT_P.
[in]weight_anisoAn error weight of ANISO-candidate. The default value is H2DRS_DEFAULT_ERR_WEIGHT_ANISO.

Definition at line 70 of file proj_based_selector.cpp.

Referenced by Hermes::Hermes2D::RefinementSelectors::HcurlProjBasedSelector< Scalar >::clone(), Hermes::Hermes2D::RefinementSelectors::L2ProjBasedSelector< Scalar >::clone(), and Hermes::Hermes2D::RefinementSelectors::H1ProjBasedSelector< Scalar >::clone().

Member Data Documentation

template<typename Scalar>
Hermes::vector< ValueCacheItem<Scalar> > Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::nonortho_rhs_cache
protected

An array of cached right-hand side values.

The first index is an index of the shape function.

Contents of the array is valid in the method calc_error_cand_element(). The array is allocated in the constructor, the size of the array is equal to the maximum index of a shape function + 1.

Note
It is kept here in order to avoid frequent reallocating.

Definition at line 237 of file proj_based_selector.h.

Referenced by Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::calc_error_cand_element(), and Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::ProjBasedSelector().

template<typename Scalar>
ProjMatrixCache Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::proj_matrix_cache[H2D_NUM_MODES]
protected

An array of projection matrices.

The first index is the mode (see the enum ElementMode2D). The second and the third index is the horizontal and the vertical order respectively.

All matrices are square dense matrices and they have to be created through the function new_matrix(). If record is NULL, the corresponding matrix has to be calculated.

Definition at line 229 of file proj_based_selector.h.

Referenced by Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::calc_error_cand_element(), and Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::ProjBasedSelector().

template<typename Scalar>
bool Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::warn_uniform_orders
protected

True if the selector has already warned about possible inefficiency.

If OptimumSelector::cand_list does not generate candidates with elements of non-uniform orders and if the precalculate orthonormal base is available, the user should not use non-uniform order in the meshed in order to gain efficiency.

Definition at line 184 of file proj_based_selector.h.

Referenced by Hermes::Hermes2D::RefinementSelectors::ProjBasedSelector< Scalar >::calc_projection_errors().


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