[draft] Introduce the ADValue class for templated traceless forward mode #64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This was initially developed within the Dune module dune-fufem (https://gitlab.dune-project.org/fufem/dune-fufem).
The class
adolc::ADValue<T, maxOrder,dim>
implementes a traceless forward mode templated with respect to the underlying typeT
, the maximal tracked derivative ordermaxOrder
and the domain dimensiondim
. Currently onlymaxOrder<=2
is implemented.Using the special value
dynamicDim
allows to use a runtime dimension. In the latter case the default is to usestd::vector
as storage. If support forboost::pool
is activated, this is used instead.Notable differences to
adtl::adouble
are:T=double
e.g. allows for low/high precision or interval arithmetics.boost:pool
s per dimension instead of a single one for a globally fixed dimension. This also avoids the memory leaks ofadtl::adouble
when changing the global dimension. Since the pools arethread_local
instead of global, this again provides thread-safety (X).The last point could probably also be implemented for
adtl::adouble
.(x) "Thread-safety" hear does not mean that concurrent access to a single
ADValue
object is safe. Instead if means that concurrent accesss to different objects in different threads is safe and not prone to race-conditions due to internally used global variables.