Commit Graph

54 Commits

Author SHA1 Message Date
Arne Morten Kvarving
76892ccd73 EvaluationXXX.hpp: do not include Evaluation.hpp
creates weird circular includes. users should always include
Evaluation.hpp
2022-12-23 13:30:34 +01:00
Arne Morten Kvarving
59d46bbf7e Evaluation: do not include Math.hpp 2022-12-23 13:15:53 +01:00
Arne Morten Kvarving
b487819384 Evaluation: remove unnecessary includes 2022-12-23 13:09:40 +01:00
Arne Morten Kvarving
e9ba866305 Evaluation: do not include valgrind if NDEBUG 2022-12-23 13:02:36 +01:00
Arne Morten Kvarving
9d92514157 Evaluation: move stream operator support to compile unit 2022-12-23 12:58:47 +01:00
Arne Morten Kvarving
fd6e793b6a don't include dune traits for Evaluation
unused and it creates an unnecessary dune-common dependency
now test_EvaluationFormat no longer depends on dune-common
2022-12-23 08:49:19 +01:00
Arne Morten Kvarving
7f694089a7 added: fmt formatter for Evaluation
and a simple test
2022-12-20 08:45:06 +01:00
Trine Mykkeltvedt
f4e6b700a3 added Svenns cubic solver 2022-06-08 08:46:52 +02:00
Arne Morten Kvarving
24dba01e99 changed: get rid of OPM_UNUSED macro usage
prefer anonymous parameters and c++17 [[maybe_unused]]
2021-08-03 09:32:02 +02:00
Arne Morten Kvarving
6689e6d08f fixed: do not use Opm:: prefix within Opm namespace part 2
have to use anchoring to root namespace in some places due
to overlapping namespace and class type names.
2021-05-05 21:58:33 +02:00
Atgeirr Flø Rasmussen
a9e1551e79 Silence unused argument warning for DynamicEvaluation. 2019-07-05 10:09:23 +02:00
Arne Morten Kvarving
51bf76a061 mark unused parameters as OPM_UNUSED 2019-06-26 10:55:33 +02:00
Atgeirr Flø Rasmussen
6cfd9b5740 Merge pull request #340 from andlaus/unify_eval_creation
unify the creation of evalutions
2019-06-14 09:16:29 +02:00
Andreas Lauser
819ee5bbf2 Evaluation code generator: add a missing OPM_UNUSED
thanks to [at]GitPaean for the catch!
2019-06-12 15:10:17 +02:00
Kai Bao
292e84ec08 fixing the compilation problem related to DenseAD 2019-06-12 14:53:54 +02:00
Andreas Lauser
3b933ae42a unify the creation of evalutions
to create a constant, there are now always the three functions

Opm::constant<Eval>(value);
Opm::constant<Eval>(numDeriv, value);
Opm::constant<Eval>(x, value); // with 'x' being the 'template' of the returned value

If a given call does not make sense, an exception is thrown:

- Plain floating point objects like `float`, `double` or `quad`
  complain if the specified number of derivatives is not zero.
- Statically sized evaluations throw if the specified number of
  derivatives of passed to the function is not equal to their static
  size.
- Dynamically sized evaluations complain if the number of derivatives
  cannot be determined.

The third variant of `Opm::constant()` works unconditionally. The
`Opm::variable()` helpers are modified analogously.
2019-06-12 11:50:37 +02:00
Kai Bao
0c005595c4 adding createConstantOne and createConstantZero to Evaluations 2019-06-11 09:48:44 +02:00
Tor Harald Sandve
a62ea4b0f1 Add log10 AD function 2019-06-03 11:22:42 +02:00
Kai Bao
0ce7a779da updating genEvalSpecializations.py 2019-03-21 13:16:49 +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
1e7d566a93 clean up the new FastSmallVector class
also, this fixes some potential memory leaks if vectors of different
sizes are assigned and it fixes the assignment-to-self (`x = x`) case.
2019-03-20 12:41:57 +01:00
Kai Bao
a8f5501e15 update genEvalSpecializations.py 2019-03-15 14:16:14 +01:00
Kai Bao
e4d23d201e making DynamicEvaluation using FastSmallVector 2019-03-15 13:38:07 +01:00
Kai Bao
c633e70f81 adding FastSmallVector to be used by DynamicEvaluation 2019-03-15 13:23:33 +01:00
Kai Bao
bbfafad2da various fixes to make DynamicEvaluation work with simulations 2018-11-30 15:34:26 +01:00
Andreas Lauser
de6c6e8cfa Evaluation: update generated code 2018-07-05 12:50:54 +02: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
7b12d493d7 make the "shrubbery" of dense-AD aware of dynamic evaluations
i.e., adapt the math routines.
2018-06-28 17:27:48 +02:00
Andreas Lauser
362965c198 update the generated source files 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
6cdae5f4c2 Evaluation: update the generated code 2017-07-27 18:02:55 +02:00
Andreas Lauser
7050193167 update generated files 2017-06-07 15:20:01 +02: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
Robert Kloefkorn
1a4f382a52 [cleanup] newly created Evaluation files, now with {} in for loops to
make it through the review process.
2017-03-20 14:51:47 +01: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
Andreas Lauser
bf771b09b4 auto-generate and specialize the whole Evaluation class
older compilers (-> GCC < 5) seem to have trouble with inlining here
which leads to sub-optimal performance. since it is not a big problem
to also generate the unspecialized Evaluation class, let's do that
instead. (for hand-written code, this would be a huge
consistency/maintainance problem, though.)
2017-03-17 17:25:49 +01:00
Andreas Lauser
cba7ad9530 specify the type for the data storage via EvaluationOps 2017-03-16 01:05:00 +01:00
Andreas Lauser
b91c9feca9 fix typo: 'devide' -> 'divide' 2017-03-16 00:08:01 +01:00
Andreas Lauser
c170647969 use code generation for producing the specializations if the dense AD Evaluation class 2017-03-16 00:05:52 +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
45da261142 move the '&' of references and the '*' of pointers to the type name
i.e., the new-style is `TypeName& var` instead of
`TypeName &var`. this patch is analogous to part of OPM/ewoms#83.
2017-01-18 17:57:54 +01:00
Andreas Lauser
39c5c94ac7 the new home of Valgrind.hpp is opm-common! 2016-12-14 09:46:21 +01:00
Andreas Lauser
93fe614558 fix some pedantic compiler warnings
this allows the test suite of eWoms to be compiled on clang++ 3.8
using the following warning flags

```
    -Weverything
    -Wno-documentation
    -Wno-documentation-unknown-command
    -Wno-c++98-compat
    -Wno-c++98-compat-pedantic
    -Wno-undef
    -Wno-padded
    -Wno-global-constructors
    -Wno-exit-time-destructors
    -Wno-weak-vtables
    -Wno-float-equal
```

without triggering warnings in opm-material or eWoms.

Note that the test-suite for opm-material does *not* yet pass without
warnings with these flags because with these flags clang likes to
complain about reducing or increasing floating point precision which
results in a formidable nightmare. I will see what I can do about
these warnings in a separate PR.

v4: properly fix the unused parameter warnings for the valgrind client
requests. thanks to [at]atgeirr for finding the issue.
2016-11-09 12:06:36 +01:00
Robert Kloefkorn
fceaafdce1 [performance] re-implementation of Evaluation.hpp that avoid the use of high
level functions and clusters the data together in a CPU friendly way.
2016-11-01 21:57:59 +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
e047e85f54 DenseAD: simplify the min(), max() and abs() functions
note that while this simplifies the source code, the performance of
the binaries should be unaffected.
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
98898cae1d MathToolbox: add isfinite() and isnan() methods
for primitive floating point objects, these correspond to
std::isfinite() and std::isnan() while for evaluations, they trigger
on the evaluation's value or any of its derivatives being non-finite
or NaN. (i.e., for evaluations they should be better called
containsnonfinite(), containsnan().)
2016-10-19 21:46:23 +02:00
Andreas Lauser
1236009d3e DenseAD: special case the base == 0.0 case
if this is not done the generic code produces NaNs. (either by using
the result of ln(0.0) or by means of a division by zero.)

This seems to fix the linearization of flow_ebos for "Model 2".
2016-09-16 00:09:45 +02:00