23 #ifndef __H2D_COMMON_H_
24 #define __H2D_COMMON_H_
26 #include "hermes_common.h"
30 #define H2D_MAX_ELEMENT_SONS 4
31 #define H2D_MAX_NUMBER_EDGES 4
32 #define H2D_MAX_NUMBER_VERTICES 4
35 #define H2D_NUM_MODES 2
36 #define H2D_SOLUTION_ELEMENT_CACHE_SIZE 2
37 #define H2D_MAX_NODE_ID 10000000
38 #define H2D_MAX_SOLUTION_COMPONENTS 2
40 #define HERMES_ONE NULL
41 #define HERMES_DEFAULT_FUNCTION NULL
42 #define HERMES_DEFAULT_SPLINE NULL
45 #define HERMES_TOTAL_ERROR_REL 0x00
48 #define HERMES_TOTAL_ERROR_ABS 0x01
51 #define HERMES_ELEMENT_ERROR_REL 0x00
56 #define HERMES_ELEMENT_ERROR_ABS 0x10
61 static const int H2D_TRF_TRI_NUM = 4;
63 static const int H2D_TRF_QUAD_NUM = 8;
65 static const int H2D_TRF_NUM = (H2D_TRF_QUAD_NUM + 1);
67 static const int H2D_TRF_IDENTITY = H2D_TRF_QUAD_NUM;
69 #define H2DRS_ASSUMED_MAX_CANDS 512
72 #define H2DRS_INTR_GIP_ORDER 20
73 #define H2DRS_MAX_ORDER_INC 1
75 #define H2DRS_SCORE_DIFF_ZERO 1E-13
77 #define H2DRS_ORDER_ANY -1
79 # define H2DRS_DEFAULT_ERR_WEIGHT_H 2.0
80 # define H2DRS_DEFAULT_ERR_WEIGHT_P 1.0
81 # define H2DRS_DEFAULT_ERR_WEIGHT_ANISO 1.414214
89 template<
typename Scalar>
class DiscreteProblem;
90 template<
typename Scalar>
class Space;
93 template<
typename Scalar>
class Solution;
103 #define H2D_GET_H_ORDER(encoded_order) ((encoded_order) & H2D_ORDER_MASK)
104 #define H2D_GET_V_ORDER(encoded_order) ((encoded_order) >> H2D_ORDER_BITS)
105 #define H2D_MAKE_QUAD_ORDER(h_encoded_order, v_encoded_order) (((v_encoded_order) << H2D_ORDER_BITS) + (h_encoded_order))
106 #define H2D_MAKE_EDGE_ORDER(mode, edge, order) ((mode == HERMES_MODE_TRIANGLE || edge == 0 || edge == 2) ? H2D_GET_H_ORDER(order) : H2D_GET_V_ORDER(order))
109 template<
typename Scalar>
110 class HERMES_API Global :
public Hermes::Mixins::Loggable
113 Global() : Hermes::Mixins::Loggable() {};
120 static double calc_rel_error(MeshFunction<Scalar>* sln1, MeshFunction<Scalar>* sln2,
int norm_type);
122 static double calc_abs_error(MeshFunction<Scalar>* sln1, MeshFunction<Scalar>* sln2,
int norm_type);
124 static double calc_norm(MeshFunction<Scalar>* sln,
int norm_type);
128 static double calc_norms(Hermes::vector<Solution<Scalar>*> slns);
129 static double calc_abs_errors(Hermes::vector<Solution<Scalar>*> slns1, Hermes::vector<Solution<Scalar>*> slns2);
130 static double calc_rel_errors(Hermes::vector<Solution<Scalar>*> slns1, Hermes::vector<Solution<Scalar>*> slns2);
132 static double error_fn_l2(MeshFunction<Scalar>* sln1, MeshFunction<Scalar>* sln2, RefMap* ru, RefMap* rv);
133 static double norm_fn_l2(MeshFunction<Scalar>* sln, RefMap* ru);
135 static double error_fn_h1(MeshFunction<Scalar>* sln1, MeshFunction<Scalar>* sln2, RefMap* ru, RefMap* rv);
136 static double norm_fn_h1(MeshFunction<Scalar>* sln, RefMap* ru);
138 static double error_fn_hc(MeshFunction<Scalar>* sln1, MeshFunction<Scalar>* sln2, RefMap* ru, RefMap* rv);
139 static double norm_fn_hc(MeshFunction<Scalar>* sln, RefMap* ru);
141 static double error_fn_hcl2(MeshFunction<Scalar>* sln1, MeshFunction<Scalar>* sln2, RefMap* ru, RefMap* rv);
142 static double norm_fn_hcl2(MeshFunction<Scalar>* sln, RefMap* ru);
144 static double error_fn_hdiv(MeshFunction<Scalar>* sln1, MeshFunction<Scalar>* sln2, RefMap* ru, RefMap* rv);
145 static double norm_fn_hdiv(MeshFunction<Scalar>* sln, RefMap* ru);
147 static double get_l2_norm(Vector<Scalar>* vec);
163 HERMES_MODE_TRIANGLE = 0,