16 #ifndef __H2D_FUNCTION_H
17 #define __H2D_FUNCTION_H
19 #include "transformable.h"
20 #include "../quadrature/quad.h"
21 #include "exceptions.h"
27 class PrecalcShapeset;
28 namespace RefinementSelectors{
42 H2D_FN_VAL_0 = 0x0001, H2D_FN_VAL_1 = 0x0040,
43 H2D_FN_DX_0 = 0x0002, H2D_FN_DX_1 = 0x0080,
44 H2D_FN_DY_0 = 0x0004, H2D_FN_DY_1 = 0x0100,
45 #ifdef H2D_USE_SECOND_DERIVATIVES
46 H2D_FN_DXX_0 = 0x0008, H2D_FN_DXX_1 = 0x0200,
47 H2D_FN_DYY_0 = 0x0010, H2D_FN_DYY_1 = 0x0400,
48 H2D_FN_DXY_0 = 0x0020, H2D_FN_DXY_1 = 0x0800
54 const int H2D_FN_DX = H2D_FN_DX_0 | H2D_FN_DX_1;
55 const int H2D_FN_DY = H2D_FN_DY_0 | H2D_FN_DY_1;
59 #ifdef H2D_USE_SECOND_DERIVATIVES
60 const int H2D_FN_COMPONENT_0 = H2D_FN_VAL_0 | H2D_FN_DX_0 | H2D_FN_DY_0 | H2D_FN_DXX_0 | H2D_FN_DYY_0 | H2D_FN_DXY_0;
61 const int H2D_FN_COMPONENT_1 = H2D_FN_VAL_1 | H2D_FN_DX_1 | H2D_FN_DY_1 | H2D_FN_DXX_1 | H2D_FN_DYY_1 | H2D_FN_DXY_1;
63 const int H2D_FN_COMPONENT_0 = H2D_FN_VAL_0 | H2D_FN_DX_0 | H2D_FN_DY_0;
64 const int H2D_FN_COMPONENT_1 = H2D_FN_VAL_1 | H2D_FN_DX_1 | H2D_FN_DY_1;
67 const int H2D_GRAD = H2D_FN_DX_0 | H2D_FN_DY_0;
68 const int H2D_CURL = H2D_FN_DX | H2D_FN_DY;
70 #ifdef H2D_USE_SECOND_DERIVATIVES
71 const int H2D_FN_DXX = H2D_FN_DXX_0 | H2D_FN_DXX_1;
72 const int H2D_FN_DYY = H2D_FN_DYY_0 | H2D_FN_DYY_1;
73 const int H2D_FN_DXY = H2D_FN_DXY_0 | H2D_FN_DXY_1;
75 const int H2D_SECOND = H2D_FN_DXX_0 | H2D_FN_DXY_0 | H2D_FN_DYY_0;
78 const int H2D_FN_ALL = H2D_FN_DEFAULT | H2D_FN_DXX | H2D_FN_DYY | H2D_FN_DXY;
105 template<
typename Scalar>
118 unsigned char get_num_components()
const;
123 virtual const Scalar* get_fn_values(
int component = 0)
const;
128 virtual const Scalar* get_dx_values(
int component = 0)
const;
133 virtual const Scalar* get_dy_values(
int component = 0)
const;
135 #ifdef H2D_USE_SECOND_DERIVATIVES
136 virtual const Scalar* get_dxx_values(
int component = 0)
const;
144 virtual const Scalar* get_dyy_values(
int component = 0)
const;
149 virtual const Scalar* get_dxy_values(
int component = 0)
const;
155 Scalar* deep_copy_array(
int component = 0,
int item = 0)
const;
158 Quad2D* get_quad_2d()
const;
164 void set_quad_order(
unsigned short order,
unsigned short mask = H2D_FN_DEFAULT);
166 virtual const Scalar* get_values(
int component,
int item)
const;
169 virtual int get_fn_order()
const;
173 virtual void push_transform(
int son);
177 virtual void pop_transform();
180 virtual void set_active_element(
Element* e);
184 virtual void set_transform(uint64_t idx);
192 virtual void set_quad_2d(
Quad2D* quad_2d);
195 virtual void reset_transform();
197 virtual void force_transform(uint64_t sub_idx,
Trf* ctm);
200 virtual void free() = 0;
203 Scalar values[H2D_MAX_SOLUTION_COMPONENTS][H2D_NUM_FUNCTION_VALUES][H2D_MAX_INTEGRATION_POINTS_COUNT];
209 virtual int get_edge_fn_order(
unsigned char edge)
const;
212 virtual void precalculate(
unsigned short order,
unsigned short mask);
223 void invalidate_values();
231 static int idx2mask[H2D_NUM_FUNCTION_VALUES][2];
237 template<
typename T>
friend class Adapt;
243 template<
typename T>
friend class Func;
244 template<
typename T>
friend class Filter;
A projection-based selector for Hcurl space.
Calculates the Von Mises stress.
Stores one element of a mesh.
Caches precalculated shape function values.
This class represents a function with jump discontinuity on an interface of two elements.
Represents a function defined on a mesh.
A projection-based selector for H1 space.
A selector that selects H-refinements only.
HERMES_API Func< double > * init_fn(PrecalcShapeset *fu, RefMap *rm, const int order)
Init the shape function for the evaluation of the volumetric/surface integral (transformation of valu...
A general projection-based selector.
const int H2D_FN_DEFAULT
default precalculation mask
Represents an arbitrary function defined on an element.
A selector that increases order (i.e., it selects P-refinements only).
bool values_valid
Flag that the data are not 'dirty'.
Calculated function values (from the class Function) on an element for assembling.
const int H2D_FN_VAL
Both components are usually requested together...
A selector that chooses an optimal candidates based on a score.
Represents the reference mapping.
unsigned char num_components
Number of vector components.
A parent of all refinement selectors. Abstract class.
A projection-based selector for L2 space.
int cur_quad
Active quadrature (index into 'quads')
int order
Current function polynomial order.