16 #ifndef __H2D_REFINEMENT_PROJ_BASED_SELECTOR_H
17 #define __H2D_REFINEMENT_PROJ_BASED_SELECTOR_H
19 #include "optimum_selector.h"
26 namespace RefinementSelectors {
47 template<
typename Scalar>
65 double get_error_weight_h()
const;
66 double get_error_weight_p()
const;
67 double get_error_weight_aniso()
const;
70 typedef std::vector<TrfShapeExp> TrfShape[H2D_TRF_NUM];
101 free_with_check(values);
104 if (other.values ==
nullptr)
105 throw Exceptions::Exception(
"Unable to assign a non-empty values. Use references instead.");
119 void allocate(
int num_expansion,
int num_gip);
124 inline double* operator[](
int inx_expansion);
128 inline bool empty()
const;
134 template<
typename T>
friend class Adapt;
194 static const int H2DRS_VALCACHE_INVALID = 0;
196 static const int H2DRS_VALCACHE_VALID = 1;
198 static const int H2DRS_VALCACHE_USER = 2;
205 bool is_valid()
const {
return state != H2DRS_VALCACHE_INVALID; };
209 void mark(
int new_state = H2DRS_VALCACHE_VALID) { state = new_state; };
213 void set(T new_value) { value = new_value; };
217 T
get()
const {
return value; };
223 ValueCacheItem(
const T& value = 0,
const int state = H2DRS_VALCACHE_INVALID) : value(value), state(state) {};
285 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,
int* sons, std::vector<TrfShapeExp>** sub_nonortho_svals, std::vector<TrfShapeExp>** sub_ortho_svals,
const typename OptimumSelector<Scalar>::CandsInfo& info, CandElemProjError errors_squared, Scalar* rval[
H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]);
345 virtual void free_ref_solution_data(
int inx_son, Scalar* rval[
H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]) = 0;
354 virtual double** build_projection_matrix(double3* gip_points,
int num_gip_points,
const int* shape_inx,
const int num_shapes,
ElementMode2D) = 0;
double coef_my
A coefficient that scales df/dy for each subdomain. A coefficient represents effects of a transformat...
virtual void precalc_shapes(const double3 *gip_points, const int num_gip_points, const Trf *trfs, const int num_noni_trfs, const std::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.
A projection-based selector for Hcurl space.
A transform shaped function expansions.
Stores one element of a mesh.
int * shape_inxs
Used shape indices.
#define H2DRS_DEFAULT_ERR_WEIGHT_P
A default multiplicative coefficient of an error of a P-candidate.
#define H2DRS_MAX_ORDER
A maximum order suported by refinement selectors.
Information about candidates.
double error_weight_h
A coefficient that multiplies error of H-candidate. The default value is H2DRS_DEFAULT_ERR_WEIGHT_H.
A shape function on subdomain of an element.
bool is_valid() const
Returns true if value is mared as valid.
Represents a function defined on a mesh.
An item of a value cache.
Integration points in the reference domain of an element of a candidate.
A projection-based selector for H1 space.
double coef_mx
A coefficient that scales df/dx for each subdomain. A coefficient represents effects of a transformat...
double error_weight_aniso
A coefficient that multiplies error of ANISO-candidate. The default value is H2DRS_DEFAULT_ERR_WEIGHT...
bool warn_uniform_orders
True if the selector has already warned about possible inefficiency.
Projection of an element of a candidate.
double3 * gip_points
Integration points and weights. The first index is an index of an integration point, the second index is defined through the enum GIP2DIndices.
A general projection-based selector.
int num_gip_points
A number of integration points.
#define H2D_NUM_MODES
Internal.
TrfShape * cached_shape_ortho_vals
Precalculated valus of orthogonalized shape functions.
int num_shapes
A number of used shape indices.
CandList
Predefined list of candidates.
int inx
An index of a shape function.
double CandElemProjError[H2DRS_MAX_ORDER+2][H2DRS_MAX_ORDER+2]
Error of an element of a candidate for various permutations of orders.
bool * cached_shape_vals_valid
True if shape values were already initialized.
Scalar * shape_coeffs
Coefficients of shape indices of a projection.
std::vector< TrfShapeExp > & svals
A precalculated shape-function values. Empty is not defined.
TrfShapeExp & svals
Evaluate values of a shape function. If TrfShapeExp::empty(), no precalculated values are available...
Should be exactly the same as is the count of enum ShapesetType.
TrfShape * cached_shape_vals
Precalculate values of shape functions.
#define H2DRS_DEFAULT_ERR_WEIGHT_H
A default multiplicative coefficient of an error of a H-candidate.
double error_weight_p
A coefficient that multiplies error of P-candidate. The default value is H2DRS_DEFAULT_ERR_WEIGHT_P.
int max_quad_order
An encoded maximum order of the projection. If triangle, the vertical order is equal to the horizonta...
A transformation from a reference domain of a subdomain to a reference domain of an element of a cand...
A selector that chooses an optimal candidates based on a score.
#define H2D_MAX_ELEMENT_SONS
Macros.
#define H2DRS_DEFAULT_ERR_WEIGHT_ANISO
A default multiplicative coefficient of an error of a ANISO-candidate.
virtual void precalc_ortho_shapes(const double3 *gip_points, const int num_gip_points, const Trf *trfs, const int num_noni_trfs, const std::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.
void set(T new_value)
Sets a value.
A projection-based selector for L2 space.
void mark(int new_state=H2DRS_VALCACHE_VALID)
Marks a value.
Trf * trf
A transformation.