# Feel++

## Evaluating function

Once you have created an element, you may want to give it a value, that can depends on a lot of parameters ( mainly spaces, but others may apply ).

To do so, Feel++ relies on expressions. We may use various kind of expressions :

### Built-in

Let’s begin with the evaluation of the expression sin(\pi x) on a unit circle.

First at all, we define the unit circle and its function space :

Unresolved directive in 05-EvaluatingFunctions.adoc - include::../../../codes/05-myexporter.cpp[tags=meshspace]

Then the expression we would like to evaluate :

Unresolved directive in 05-EvaluatingFunctions.adoc - include::../../../codes/05-myexporter.cpp[tags=expr]

Px() refers to the variable x of our space.

With this,we can project it on our function space :

Unresolved directive in 05-EvaluatingFunctions.adoc - include::../../../codes/05-myexporter.cpp[tags=project]

The expression will be evaluated on each point of our mesh.

In order to visualize the result, we create an exporter, named exhi, and add to it the projection.

Unresolved directive in 05-EvaluatingFunctions.adoc - include::../../../codes/05-myexporter.cpp[tags=project]

#### Code

Unresolved directive in 05-EvaluatingFunctions.adoc - include::../../../codes/05-myexporter.cpp[tags=all]

The list of the Feel++ Keyword is here.

### Hard Coded

In this second method, we will use Functor :

Unresolved directive in 05-EvaluatingFunctions.adoc - include::../../../codes/myfunctor.cpp[tags=functor]

We create a unit square meshed by triangles and we define the associated function space :

Unresolved directive in 05-EvaluatingFunctions.adoc - include::../../../codes/myfunctor.cpp[tags=meshspace]

From this space, we can define two elements, here one equals to the variable x and the other to the variable y, obtain from Functor class.

Unresolved directive in 05-EvaluatingFunctions.adoc - include::../../../codes/myfunctor.cpp[tags=elements]

The data exportation is the final step to visualize our expression x and y on the defined mesh.

Unresolved directive in 05-EvaluatingFunctions.adoc - include::../../../codes/myfunctor.cpp[tags=exporter]

#### Code

The complete code reads as follows

Unresolved directive in 05-EvaluatingFunctions.adoc - include::../../../codes/myfunctor.cpp[tags=all]

The list of the Feel++ Keyword is here.