|
Feel++
0.92.0
|
typedef
P0 FunctionSpace typedef
Now we turn to the instantiation of the function space
of type functionspace_type. We have already instantiated a mesh (see this Section) of type mesh_ptrtype. The code looks like this
Then we instantiate
using space_type::New() static member function and obtain a functionspace_ptrtype.
We are now able to instantiate elements of the FunctionSpace
. Two ways are presented, one with the auto keyword allowing to infer automatically the type of
elements
and one knowing the actual type of the element
"u" and "v" are the name we give to these elements of
.First, we define some mathematical expression/functions
They are implemented using the new auto C++ keyword to infer the type of expression automatically.
Then we build the interpolant (Lagrange interpolant in this case since we chose Lagrange basis function), by calling the vf::project() function which can be applied on all or parts of the mesh thanks to the mesh iterators such as elements(mesh) or markedelements(mesh,marker). The return object is the interpolant of the function in the space
given as an argument to vf::project().
It is easy to compute norms
projection
We execute this example on a simplex domain an export to the Gmsh format:
feel_doc_myfunctionspace --shape="simplex"--nochdir --exporter-format=gmsh
the output log of the execution of this example gives
Here are the graphical outputs on the d-simplex, d=1,2,3:
f on the Line |
f on the Triangle |
f on the Tetrahedron |
g on the Line |
g on the Triangle |
g on the Tetrahedron |
We execute this example on a hypercube domain an export to the Gmsh format:
feel_doc_myfunctionspace --shape="hypercube"--nochdir --exporter-format=gmsh
the output log of the execution of this example gives
Here are the graphical outputs on the d-hypercube, d=1,2,3:
f plot on Line |
f plot on Unit Square |
f plot on Unit Cube |
g plot on Line |
g plot on Unit Square |
g plot on Unit Cube |
1.7.6.1