Tatooine
|
Fields are functors that map a spatio-temporal domain to a tensor.
There is tatooine::polymorphic::field that every field is derived from. Use references or pointers of this type to be able to write generic code that involves fields.
Then there is tatooine::field that uses CRTP to provide some more compile-time-optimization.
Every field should be derived from tatooine::field.
For each analytical field exists a numerical and a symbolic version. The symbolic versions use GiNaC. The numerical versions simply use functions from the cmath header and tatooine::vec, tatooine::mat or tatooine::tensor and its Operations and.
The following example shows how to define an easy vector field. When creating a field two methods have to be provided:
in_domain
andevaluate
.Both methods get a position and a time. in_domain
defines the domain of a field. In this example the domain is unbounded. evaluate
returns a tensor. In this case parent_type::tensor_type is tatooine::vec2. The methods do not need to be marked virtual or override. The CRTP mechanism just needs those two methods with the correct signature.
There are some typedefs that should be used due to their shortness.
Fields can be derived using the tatooine::diff
operator. This function creates a tatooine::differentiated_field
that computes the derivative by using central differences.
using tatooine::diff(<scalarfield>)
you will get the gradient of field.
using tatooine::diff(<vectorfield>)
you will get the jacobian of field.
using tatooine::diff(<matrixfield>)
you will get a field that evaluates to a rank-3 tensor that describes the derivative of this rank-2 tensor field.
In some specific cases one can specialize tatooine::differentiated_field. Checkout center.h for example.
Flow Maps of vector fields can be created by using the tatooine::flowmap
operator.
By default a numerical integration is used to perform this action.
tatooine::flowmap
is a templated function that can use a specific ODE solver. By default tatooine::ode::vclibs::rungekutta43 is used.