Represents the solution of a PDE. More...
#include <solution.h>
Inherits MeshFunction.
Inherited by ExactSolution.
Public Member Functions | |
| Solution () | |
| virtual | ~Solution () |
| virtual void | free () |
| Frees all precalculated tables. | |
| void | assign (Solution *sln) |
| Solution & | operator= (Solution &sln) |
| void | copy (const Solution *sln) |
| void | set_exact (Mesh *mesh, scalar(*exactfn)(double x, double y, scalar &dx, scalar &dy)) |
| void | set_exact (Mesh *mesh, scalar2 &(*exactfn)(double x, double y, scalar2 &dx, scalar2 &dy)) |
| void | set_const (Mesh *mesh, scalar c) |
| void | set_const (Mesh *mesh, scalar c0, scalar c1) |
| void | set_zero (Mesh *mesh) |
| void | set_zero_2 (Mesh *mesh) |
| void | set_dirichlet_lift (Space *space, PrecalcShapeset *pss) |
| Sets solution equal to Dirichlet lift only, solution vector = 0. | |
| void | enable_transform (bool enable=true) |
| Enables or disables transformation of the solution derivatives (H1 case) or values (vector (Hcurl) case). This means H2D_FN_DX_0 and H2D_FN_DY_0 or H2D_FN_VAL_0 and H2D_FN_VAL_1 will or will not be returned premultiplied by the reference mapping matrix. The default is enabled (true). | |
| void | save (const char *filename, bool compress=true) |
| Saves the complete solution (i.e., including the internal copy of the mesh and element orders) to a binary file. On Linux, if `compress` is true, the file is compressed with gzip and a ".gz" suffix added to the file name. | |
| void | load (const char *filename) |
| Loads the solution from a file previously created by Solution::save(). This completely restores the solution in the memory. The file name has to include the ".gz" suffix, in which case the file is piped through gzip to decompress the data (Linux only). | |
| scalar | get_ref_value (Element *e, double xi1, double xi2, int component=0, int item=0) |
| Returns solution value or derivatives at element e, in its reference domain point (xi1, xi2). 'item' controls the returned value: 0 = value, 1 = dx, 2 = dy, 3 = dxx, 4 = dyy, 5 = dxy. NOTE: This function should be used for postprocessing only, it is not effective enough for calculations. | |
| scalar | get_ref_value_transformed (Element *e, double xi1, double xi2, int a, int b) |
| Returns solution value or derivatives (correctly transformed) at element e, in its reference domain point (xi1, xi2). 'item' controls the returned value: 0 = value, 1 = dx, 2 = dy, 3 = dxx, 4 = dyy, 5 = dxy. NOTE: This function should be used for postprocessing only, it is not effective enough for calculations. | |
| virtual scalar | get_pt_value (double x, double y, int item=H2D_FN_VAL_0) |
| Returns solution value or derivatives at the physical domain point (x, y). 'item' controls the returned value: H2D_FN_VAL_0, H2D_FN_VAL_1, H2D_FN_DX_0, H2D_FN_DX_1, H2D_FN_DY_0,.... NOTE: This function should be used for postprocessing only, it is not effective enough for calculations. Since it searches for an element sequentinally, it is extremelly slow. Prefer Solution::get_ref_value if possible. | |
| int | get_num_dofs () const |
| Returns the number of degrees of freedom of the solution. Returns -1 for exact or constant solutions. | |
| void | multiply (scalar coef) |
| Multiplies the function represented by this class by the given coefficient. | |
| virtual void | set_fe_solution (Space *space, PrecalcShapeset *pss, scalar *vec, double dir=1.0) |
| Internal. Used by LinSystem::solve(). Should not be called directly. | |
| virtual void | set_active_element (Element *e) |
| Internal. | |
Protected Types | |
| enum | { SLN, EXACT, CNST, UNDEF } |
Protected Member Functions | |
| void | transform_values (int order, Node *node, int newmask, int oldmask, int np) |
| virtual void | precalculate (int order, int mask) |
| precalculates the current function at the current integration points. | |
| double ** | calc_mono_matrix (int o, int *&perm) |
| void | init_dxdy_buffer () |
| void | free_tables () |
Protected Attributes | |
| enum Solution:: { ... } | type |
| bool | own_mesh |
| bool | transform |
| void * | tables [4][4] |
| precalculated tables for last four used elements | |
| Element * | elems [4][4] |
| int | cur_elem |
| int | oldest [4] |
| scalar * | mono_coefs |
| monomial coefficient array | |
| int * | elem_coefs [2] |
| array of pointers into mono_coefs | |
| int * | elem_orders |
| stored element orders | |
| int | num_coefs |
| int | num_elems |
| int | num_dofs |
| int | space_type |
| scalar(* | exactfn1 )(double x, double y, scalar &dx, scalar &dy) |
| scalar2 &(* | exactfn2 )(double x, double y, scalar2 &dx, scalar2 &dy) |
| scalar | cnst [2] |
| scalar | exact_mult |
| scalar * | dxdy_coefs [2][6] |
| scalar * | dxdy_buffer |
| Element * | e_last |
| last visited element when getting solution values at specific points | |
Represents the solution of a PDE.
The Solution class represents the solution of a PDE. Given a space and a solution vector, it calculates the appropriate linear combination of basis functions at the specified element and integration points.
TODO: write how to obtain solution values, maybe include inherited methods from Function as comments.
| Solution::Solution | ( | ) |
| Solution::~Solution | ( | ) | [virtual] |
| void Solution::assign | ( | Solution * | sln | ) |
| double ** Solution::calc_mono_matrix | ( | int | o, | |
| int *& | perm | |||
| ) | [protected] |
| void Solution::copy | ( | const Solution * | sln | ) |
| void Solution::enable_transform | ( | bool | enable = true |
) |
Enables or disables transformation of the solution derivatives (H1 case) or values (vector (Hcurl) case). This means H2D_FN_DX_0 and H2D_FN_DY_0 or H2D_FN_VAL_0 and H2D_FN_VAL_1 will or will not be returned premultiplied by the reference mapping matrix. The default is enabled (true).
| void Solution::free | ( | ) | [virtual] |
Frees all precalculated tables.
Implements Function< TYPE >.
| void Solution::free_tables | ( | ) | [protected] |
| int Solution::get_num_dofs | ( | ) | const [inline] |
Returns the number of degrees of freedom of the solution. Returns -1 for exact or constant solutions.
| scalar Solution::get_pt_value | ( | double | x, | |
| double | y, | |||
| int | item = H2D_FN_VAL_0 | |||
| ) | [virtual] |
Returns solution value or derivatives at the physical domain point (x, y). 'item' controls the returned value: H2D_FN_VAL_0, H2D_FN_VAL_1, H2D_FN_DX_0, H2D_FN_DX_1, H2D_FN_DY_0,.... NOTE: This function should be used for postprocessing only, it is not effective enough for calculations. Since it searches for an element sequentinally, it is extremelly slow. Prefer Solution::get_ref_value if possible.
Implements MeshFunction.
| scalar Solution::get_ref_value | ( | Element * | e, | |
| double | xi1, | |||
| double | xi2, | |||
| int | component = 0, |
|||
| int | item = 0 | |||
| ) |
Returns solution value or derivatives at element e, in its reference domain point (xi1, xi2). 'item' controls the returned value: 0 = value, 1 = dx, 2 = dy, 3 = dxx, 4 = dyy, 5 = dxy. NOTE: This function should be used for postprocessing only, it is not effective enough for calculations.
Returns solution value or derivatives (correctly transformed) at element e, in its reference domain point (xi1, xi2). 'item' controls the returned value: 0 = value, 1 = dx, 2 = dy, 3 = dxx, 4 = dyy, 5 = dxy. NOTE: This function should be used for postprocessing only, it is not effective enough for calculations.
| void Solution::init_dxdy_buffer | ( | ) | [protected] |
| void Solution::load | ( | const char * | filename | ) |
Loads the solution from a file previously created by Solution::save(). This completely restores the solution in the memory. The file name has to include the ".gz" suffix, in which case the file is piped through gzip to decompress the data (Linux only).
| void Solution::multiply | ( | scalar | coef | ) |
Multiplies the function represented by this class by the given coefficient.
| void Solution::precalculate | ( | int | order, | |
| int | mask | |||
| ) | [protected, virtual] |
precalculates the current function at the current integration points.
Implements Function< TYPE >.
| void Solution::save | ( | const char * | filename, | |
| bool | compress = true | |||
| ) |
Saves the complete solution (i.e., including the internal copy of the mesh and element orders) to a binary file. On Linux, if `compress` is true, the file is compressed with gzip and a ".gz" suffix added to the file name.
| void Solution::set_active_element | ( | Element * | e | ) | [virtual] |
Internal.
Reimplemented from MeshFunction.
| void Solution::set_dirichlet_lift | ( | Space * | space, | |
| PrecalcShapeset * | pss | |||
| ) |
Sets solution equal to Dirichlet lift only, solution vector = 0.
| void Solution::set_exact | ( | Mesh * | mesh, | |
| scalar2 &(*)(double x, double y, scalar2 &dx, scalar2 &dy) | exactfn | |||
| ) |
| void Solution::set_exact | ( | Mesh * | mesh, | |
| scalar(*)(double x, double y, scalar &dx, scalar &dy) | exactfn | |||
| ) |
| void Solution::set_fe_solution | ( | Space * | space, | |
| PrecalcShapeset * | pss, | |||
| scalar * | vec, | |||
| double | dir = 1.0 | |||
| ) | [virtual] |
Internal. Used by LinSystem::solve(). Should not be called directly.
| void Solution::set_zero | ( | Mesh * | mesh | ) |
| void Solution::set_zero_2 | ( | Mesh * | mesh | ) |
| void Solution::transform_values | ( | int | order, | |
| Node * | node, | |||
| int | newmask, | |||
| int | oldmask, | |||
| int | np | |||
| ) | [protected] |
scalar Solution::cnst[2] [protected] |
int Solution::cur_elem [protected] |
scalar* Solution::dxdy_buffer [protected] |
scalar* Solution::dxdy_coefs[2][6] [protected] |
Element* Solution::e_last [protected] |
last visited element when getting solution values at specific points
int* Solution::elem_coefs[2] [protected] |
array of pointers into mono_coefs
int* Solution::elem_orders [protected] |
stored element orders
Element* Solution::elems[4][4] [protected] |
scalar Solution::exact_mult [protected] |
scalar(* Solution::exactfn1)(double x, double y, scalar &dx, scalar &dy) [protected] |
scalar2&(* Solution::exactfn2)(double x, double y, scalar2 &dx, scalar2 &dy) [protected] |
scalar* Solution::mono_coefs [protected] |
monomial coefficient array
int Solution::num_coefs [protected] |
int Solution::num_dofs [protected] |
int Solution::num_elems [protected] |
int Solution::oldest[4] [protected] |
bool Solution::own_mesh [protected] |
int Solution::space_type [protected] |
void* Solution::tables[4][4] [protected] |
precalculated tables for last four used elements
bool Solution::transform [protected] |
enum { ... } Solution::type [protected] |
1.6.3