Commit Graph

21 Commits

Author SHA1 Message Date
Arne Morten Kvarving
9c5f863ec1 test_densead: no reason to initialize MPI here
thus we no longer depend on dune-common
2022-12-23 08:49:44 +01:00
Arne Morten Kvarving
260a0c2dc3 replace Unused.hpp with [[maybe_unused]] or anonymous variables 2022-08-02 10:32:00 +02:00
Arne Morten Kvarving
0668699179 fixed: use std::numeric_limits<Scalar> in one more spot 2020-02-10 15:57:25 +01:00
Tor Harald Sandve
a62ea4b0f1 Add log10 AD function 2019-06-03 11:22:42 +02:00
Kai Bao
6fe8e1c74f adding a few more tests for DynamicEvaluation in test_densead 2019-03-22 08:51:16 +01:00
Kai Bao
bf4bf1aa1f adding staticSize to the template parameters for Evaluation and DynamicEvaluation 2019-03-21 11:51:45 +01:00
Andreas Lauser
f316b0699e add an Opm::blank(Evaluation) function
this creates an uninitialized "compatible" evaluation that is
compatible with its argument. For primitive floating point types and
statically-sized Evaluations, this is identical to calling the default
constructor, for dynamically sized ones, it creates an uninitialized
Evaluation object of identical size as the argument.

thanks to [at]GitPaen for the heads up.
2018-06-28 17:27:48 +02:00
Andreas Lauser
328efa793c add dynamic evaluations to the unit test for dense-AD
this requires a medium-sized refactoring of the test.
2018-06-28 17:27:48 +02:00
Andreas Lauser
27386851a2 move some basic infrastructure from opm-common to here
all of these classes have only been used in opm-material and its
downstreams in the first place.
2018-02-07 16:44:44 +01:00
Andreas Lauser
2f86c78dd8 Revert "Revert "[WIP] Evaluation: specialize evaluations for used numbers in Blackoil setting""
This reverts commit cfc79fd6d5.
2017-06-07 15:20:01 +02:00
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