Commit Graph

11 Commits

Author SHA1 Message Date
Atgeirr Flø Rasmussen
cfc79fd6d5 Revert "[WIP] Evaluation: specialize evaluations for used numbers in Blackoil setting" 2017-03-28 13:26:10 +02:00
Andreas Lauser
2f44918a2b dense AD: fix a few stupid bugs
e.g., looping over the wrong range or an infinite loop. also, the
dense-AD unit test is shortend to test one specialization and the
unspecialized class.
2017-03-17 20:48:39 +01:00
Robert Kloefkorn
db46b907a2 Evaluation: specialize evaluations for used number in Blackoil setting
to increase performance. Also, change from unsigned to int because it's
better supported by compilers.
2017-03-14 14:49:24 +01:00
Andreas Lauser
19f1a27447 place the OPM_UNUSED macro after the variable name
this is analogous to OPM/ewoms#134.
2017-01-18 17:55:58 +01:00
Andreas Lauser
69b2ebc5c6 delete Unused.hpp
it is moved to opm-common. use that file instead.
2016-11-22 14:43:00 +01:00
Andreas Lauser
66ec787438 DenseAD: access the value and derivatives of Evaluations via accessor functions
this allows some flexibility of how an Evaluation object is
represented internally. the main motivation for this is to allow using
SIMD instruction which expect special data types as their operants.
2016-10-30 19:01:06 +01:00
Andreas Lauser
48d570afc5 DenseAD: add copyDerivatives(x) and clearDerivatives() methods to Evaluation
this makes it possible to implement these functions more
efficiently...
2016-10-30 19:01:06 +01:00
Andreas Lauser
e33fc441b3 Dense AD convenience functions: introduce scalarValue(x) and getValue(x)
`getValue(x)` should be better called `value(x)` but this leads to
really cryptic compiler errors which seem to be related to the fact
that the Evaluation class has a `value` attribute (this is for GCC
5.2.1).
2016-08-11 16:54:15 +02:00
Andreas Lauser
d21a6fbefe dense AD convenience functions: add decay<LhsEval>()
with this, evaluation objects can be decayed via
`Opm::decay<Scalar>(x)`. since function templates do not require a
'template' qualifier, it is a bigger advantage for this function that
for the mathematical ones. (the conventional way to do this is way
more verbose:

```c++
Opm::MathToolbox<Evaluation>::template decay<Scalar>(x)
```
)
2016-08-11 16:43:10 +02:00
Andreas Lauser
9f465784a8 dense AD: introduce convenience functions
this PR was inspired by one of @atgeirr's recent comments. it allows
to get rid if the `MathToolbox<Eval>` detour for the dense AD code in
most cases: e.g. instead of writing

```c++
template <class Eval>
Eval f(const Eval& val)
{ return Opm::MathToolbox<Eval>::sqrt(val); }
```

one can simply write

```c++
template <class Eval>
Eval f(const Eval& val)
{ return Opm::sqrt(val); }
```

and it will work transparently with DenseAD `Evaluation` objects and
primitive floating point values.

one complication of this is that the type of the `Evaluation` object
does not need to be explicitly defined. for functions which take more
than one argument (like e.g. `pow()`, `min()` and `max()`), it is thus
assumed that the type of the result is the same as the type of the
first argument.

another drawback is that when both, the contents of the `Opm::` and
the `std::` namespaces are implicitly available, it is not clear to me
what's used for primitive floating point values. (it seems to compile
but IMO it could lead to surprising behaviour. thus, please only merge
if you consider the benefits of these convenience functions to be
greater than their drawbacks.)
2016-08-11 15:54:03 +02:00
Andreas Lauser
9bbe67d19f rename "LocalAd" to "DenseAd"
Since "dense automatic differentiation" describes what this code is
all about much better in my opinion. ("Local AD" is just a possible
use case in the context of PDE discretization.)
2016-06-03 21:28:45 +02:00