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.)
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
#include <opm/common/ErrorMacros.hpp>
|
#include <opm/common/ErrorMacros.hpp>
|
||||||
#include <opm/common/Exceptions.hpp>
|
#include <opm/common/Exceptions.hpp>
|
||||||
#include <opm/material/common/Unused.hpp>
|
#include <opm/material/common/Unused.hpp>
|
||||||
#include <opm/material/localad/Math.hpp>
|
#include <opm/material/densead/Math.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
#define OPM_IMMISCIBLE_FLASH_HPP
|
#define OPM_IMMISCIBLE_FLASH_HPP
|
||||||
|
|
||||||
#include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
|
#include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
|
||||||
#include <opm/material/localad/Evaluation.hpp>
|
#include <opm/material/densead/Evaluation.hpp>
|
||||||
#include <opm/material/localad/Math.hpp>
|
#include <opm/material/densead/Math.hpp>
|
||||||
#include <opm/material/common/MathToolbox.hpp>
|
#include <opm/material/common/MathToolbox.hpp>
|
||||||
#include <opm/material/common/Valgrind.hpp>
|
#include <opm/material/common/Valgrind.hpp>
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ public:
|
|||||||
typedef Dune::FieldMatrix<InputEval, numEq, numEq> Matrix;
|
typedef Dune::FieldMatrix<InputEval, numEq, numEq> Matrix;
|
||||||
typedef Dune::FieldVector<InputEval, numEq> Vector;
|
typedef Dune::FieldVector<InputEval, numEq> Vector;
|
||||||
|
|
||||||
typedef Opm::LocalAd::Evaluation<InputEval, numEq> FlashEval;
|
typedef Opm::DenseAd::Evaluation<InputEval, numEq> FlashEval;
|
||||||
typedef Dune::FieldVector<FlashEval, numEq> FlashDefectVector;
|
typedef Dune::FieldVector<FlashEval, numEq> FlashDefectVector;
|
||||||
typedef Opm::ImmiscibleFluidState<FlashEval, FluidSystem> FlashFluidState;
|
typedef Opm::ImmiscibleFluidState<FlashEval, FluidSystem> FlashFluidState;
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
#include <opm/material/fluidmatrixinteractions/NullMaterial.hpp>
|
#include <opm/material/fluidmatrixinteractions/NullMaterial.hpp>
|
||||||
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
|
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
|
||||||
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
|
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
|
||||||
#include <opm/material/localad/Evaluation.hpp>
|
#include <opm/material/densead/Evaluation.hpp>
|
||||||
#include <opm/material/localad/Math.hpp>
|
#include <opm/material/densead/Math.hpp>
|
||||||
#include <opm/material/common/MathToolbox.hpp>
|
#include <opm/material/common/MathToolbox.hpp>
|
||||||
#include <opm/material/common/Valgrind.hpp>
|
#include <opm/material/common/Valgrind.hpp>
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ public:
|
|||||||
typedef Dune::FieldMatrix<InputEval, numEq, numEq> Matrix;
|
typedef Dune::FieldMatrix<InputEval, numEq, numEq> Matrix;
|
||||||
typedef Dune::FieldVector<InputEval, numEq> Vector;
|
typedef Dune::FieldVector<InputEval, numEq> Vector;
|
||||||
|
|
||||||
typedef Opm::LocalAd::Evaluation</*Scalar=*/InputEval,
|
typedef Opm::DenseAd::Evaluation</*Scalar=*/InputEval,
|
||||||
/*numDerivs=*/numEq> FlashEval;
|
/*numDerivs=*/numEq> FlashEval;
|
||||||
|
|
||||||
typedef Dune::FieldVector<FlashEval, numEq> FlashDefectVector;
|
typedef Dune::FieldVector<FlashEval, numEq> FlashDefectVector;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
namespace LocalAd {
|
namespace DenseAd {
|
||||||
/*!
|
/*!
|
||||||
* \brief Represents a function evaluation and its derivatives w.r.t. a fixed set of
|
* \brief Represents a function evaluation and its derivatives w.r.t. a fixed set of
|
||||||
* variables.
|
* variables.
|
||||||
@@ -425,7 +425,7 @@ std::ostream& operator<<(std::ostream& os, const Evaluation<ValueType, numVars>&
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace LocalAd
|
} // namespace DenseAd
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|
||||||
// In Dune 2.3, the Evaluation.hpp header must be included before the fmatrix.hh
|
// In Dune 2.3, the Evaluation.hpp header must be included before the fmatrix.hh
|
||||||
@@ -453,15 +453,15 @@ std::ostream& operator<<(std::ostream& os, const Evaluation<ValueType, numVars>&
|
|||||||
#if !(DUNE_VERSION_NEWER(DUNE_COMMON, 2,4))
|
#if !(DUNE_VERSION_NEWER(DUNE_COMMON, 2,4))
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
namespace LocalAd {
|
namespace DenseAd {
|
||||||
template <class ValueType, int numVars>
|
template <class ValueType, int numVars>
|
||||||
Evaluation<ValueType, numVars> abs(const Evaluation<ValueType, numVars>&);
|
Evaluation<ValueType, numVars> abs(const Evaluation<ValueType, numVars>&);
|
||||||
}}
|
}}
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
template <class ValueType, int numVars>
|
template <class ValueType, int numVars>
|
||||||
const Opm::LocalAd::Evaluation<ValueType, numVars> abs(const Opm::LocalAd::Evaluation<ValueType, numVars>& x)
|
const Opm::DenseAd::Evaluation<ValueType, numVars> abs(const Opm::DenseAd::Evaluation<ValueType, numVars>& x)
|
||||||
{ return Opm::LocalAd::abs(x); }
|
{ return Opm::DenseAd::abs(x); }
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
@@ -479,10 +479,10 @@ const Opm::LocalAd::Evaluation<ValueType, numVars> abs(const Opm::LocalAd::Evalu
|
|||||||
|
|
||||||
namespace Dune {
|
namespace Dune {
|
||||||
template <class ValueType, int numVars>
|
template <class ValueType, int numVars>
|
||||||
struct FieldTraits<Opm::LocalAd::Evaluation<ValueType, numVars> >
|
struct FieldTraits<Opm::DenseAd::Evaluation<ValueType, numVars> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Opm::LocalAd::Evaluation<ValueType, numVars> field_type;
|
typedef Opm::DenseAd::Evaluation<ValueType, numVars> field_type;
|
||||||
// setting real_type to field_type here potentially leads to slightly worse
|
// setting real_type to field_type here potentially leads to slightly worse
|
||||||
// performance, but at least it makes things compile.
|
// performance, but at least it makes things compile.
|
||||||
typedef field_type real_type;
|
typedef field_type real_type;
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
#include <opm/material/common/MathToolbox.hpp>
|
#include <opm/material/common/MathToolbox.hpp>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
namespace LocalAd {
|
namespace DenseAd {
|
||||||
// provide some algebraic functions
|
// provide some algebraic functions
|
||||||
template <class ValueType, int numVars>
|
template <class ValueType, int numVars>
|
||||||
Evaluation<ValueType, numVars> abs(const Evaluation<ValueType, numVars>& x)
|
Evaluation<ValueType, numVars> abs(const Evaluation<ValueType, numVars>& x)
|
||||||
@@ -408,19 +408,19 @@ Evaluation<ValueType, numVars> log(const Evaluation<ValueType, numVars>& x)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace LocalAd
|
} // namespace DenseAd
|
||||||
|
|
||||||
// a kind of traits class for the automatic differentiation case. (The toolbox for the
|
// a kind of traits class for the automatic differentiation case. (The toolbox for the
|
||||||
// scalar case is provided by the MathToolbox.hpp header file.)
|
// scalar case is provided by the MathToolbox.hpp header file.)
|
||||||
template <class ValueT, int numVars>
|
template <class ValueT, int numVars>
|
||||||
struct MathToolbox<Opm::LocalAd::Evaluation<ValueT, numVars> >
|
struct MathToolbox<Opm::DenseAd::Evaluation<ValueT, numVars> >
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
typedef ValueT ValueType;
|
typedef ValueT ValueType;
|
||||||
typedef Opm::MathToolbox<ValueType> InnerToolbox;
|
typedef Opm::MathToolbox<ValueType> InnerToolbox;
|
||||||
typedef typename InnerToolbox::Scalar Scalar;
|
typedef typename InnerToolbox::Scalar Scalar;
|
||||||
typedef Opm::LocalAd::Evaluation<ValueType, numVars> Evaluation;
|
typedef Opm::DenseAd::Evaluation<ValueType, numVars> Evaluation;
|
||||||
|
|
||||||
static ValueType value(const Evaluation& eval)
|
static ValueType value(const Evaluation& eval)
|
||||||
{ return eval.value; }
|
{ return eval.value; }
|
||||||
@@ -472,55 +472,55 @@ public:
|
|||||||
// arithmetic functions
|
// arithmetic functions
|
||||||
template <class Arg1Eval, class Arg2Eval>
|
template <class Arg1Eval, class Arg2Eval>
|
||||||
static Evaluation max(const Arg1Eval& arg1, const Arg2Eval& arg2)
|
static Evaluation max(const Arg1Eval& arg1, const Arg2Eval& arg2)
|
||||||
{ return Opm::LocalAd::max(arg1, arg2); }
|
{ return Opm::DenseAd::max(arg1, arg2); }
|
||||||
|
|
||||||
template <class Arg1Eval, class Arg2Eval>
|
template <class Arg1Eval, class Arg2Eval>
|
||||||
static Evaluation min(const Arg1Eval& arg1, const Arg2Eval& arg2)
|
static Evaluation min(const Arg1Eval& arg1, const Arg2Eval& arg2)
|
||||||
{ return Opm::LocalAd::min(arg1, arg2); }
|
{ return Opm::DenseAd::min(arg1, arg2); }
|
||||||
|
|
||||||
static Evaluation abs(const Evaluation& arg)
|
static Evaluation abs(const Evaluation& arg)
|
||||||
{ return Opm::LocalAd::abs(arg); }
|
{ return Opm::DenseAd::abs(arg); }
|
||||||
|
|
||||||
static Evaluation tan(const Evaluation& arg)
|
static Evaluation tan(const Evaluation& arg)
|
||||||
{ return Opm::LocalAd::tan(arg); }
|
{ return Opm::DenseAd::tan(arg); }
|
||||||
|
|
||||||
static Evaluation atan(const Evaluation& arg)
|
static Evaluation atan(const Evaluation& arg)
|
||||||
{ return Opm::LocalAd::atan(arg); }
|
{ return Opm::DenseAd::atan(arg); }
|
||||||
|
|
||||||
static Evaluation atan2(const Evaluation& arg1, const Evaluation& arg2)
|
static Evaluation atan2(const Evaluation& arg1, const Evaluation& arg2)
|
||||||
{ return Opm::LocalAd::atan2(arg1, arg2); }
|
{ return Opm::DenseAd::atan2(arg1, arg2); }
|
||||||
|
|
||||||
static Evaluation sin(const Evaluation& arg)
|
static Evaluation sin(const Evaluation& arg)
|
||||||
{ return Opm::LocalAd::sin(arg); }
|
{ return Opm::DenseAd::sin(arg); }
|
||||||
|
|
||||||
static Evaluation asin(const Evaluation& arg)
|
static Evaluation asin(const Evaluation& arg)
|
||||||
{ return Opm::LocalAd::asin(arg); }
|
{ return Opm::DenseAd::asin(arg); }
|
||||||
|
|
||||||
static Evaluation cos(const Evaluation& arg)
|
static Evaluation cos(const Evaluation& arg)
|
||||||
{ return Opm::LocalAd::cos(arg); }
|
{ return Opm::DenseAd::cos(arg); }
|
||||||
|
|
||||||
static Evaluation acos(const Evaluation& arg)
|
static Evaluation acos(const Evaluation& arg)
|
||||||
{ return Opm::LocalAd::acos(arg); }
|
{ return Opm::DenseAd::acos(arg); }
|
||||||
|
|
||||||
static Evaluation sqrt(const Evaluation& arg)
|
static Evaluation sqrt(const Evaluation& arg)
|
||||||
{ return Opm::LocalAd::sqrt(arg); }
|
{ return Opm::DenseAd::sqrt(arg); }
|
||||||
|
|
||||||
static Evaluation exp(const Evaluation& arg)
|
static Evaluation exp(const Evaluation& arg)
|
||||||
{ return Opm::LocalAd::exp(arg); }
|
{ return Opm::DenseAd::exp(arg); }
|
||||||
|
|
||||||
static Evaluation log(const Evaluation& arg)
|
static Evaluation log(const Evaluation& arg)
|
||||||
{ return Opm::LocalAd::log(arg); }
|
{ return Opm::DenseAd::log(arg); }
|
||||||
|
|
||||||
template <class RhsValueType>
|
template <class RhsValueType>
|
||||||
static Evaluation pow(const Evaluation& arg1, const RhsValueType& arg2)
|
static Evaluation pow(const Evaluation& arg1, const RhsValueType& arg2)
|
||||||
{ return Opm::LocalAd::pow(arg1, arg2); }
|
{ return Opm::DenseAd::pow(arg1, arg2); }
|
||||||
|
|
||||||
template <class RhsValueType>
|
template <class RhsValueType>
|
||||||
static Evaluation pow(const RhsValueType& arg1, const Evaluation& arg2)
|
static Evaluation pow(const RhsValueType& arg1, const Evaluation& arg2)
|
||||||
{ return Opm::LocalAd::pow(arg1, arg2); }
|
{ return Opm::DenseAd::pow(arg1, arg2); }
|
||||||
|
|
||||||
static Evaluation pow(const Evaluation& arg1, const Evaluation& arg2)
|
static Evaluation pow(const Evaluation& arg1, const Evaluation& arg2)
|
||||||
{ return Opm::LocalAd::pow(arg1, arg2); }
|
{ return Opm::DenseAd::pow(arg1, arg2); }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <opm/material/localad/Evaluation.hpp>
|
#include <opm/material/densead/Evaluation.hpp>
|
||||||
#include <opm/material/localad/Math.hpp>
|
#include <opm/material/densead/Math.hpp>
|
||||||
|
|
||||||
#include "checkComponent.hpp"
|
#include "checkComponent.hpp"
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ void testAllComponents()
|
|||||||
template <class Scalar>
|
template <class Scalar>
|
||||||
inline void testAll()
|
inline void testAll()
|
||||||
{
|
{
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, 3> Evaluation;
|
typedef Opm::DenseAd::Evaluation<Scalar, 3> Evaluation;
|
||||||
|
|
||||||
// ensure that all components are API-compliant
|
// ensure that all components are API-compliant
|
||||||
testAllComponents<Scalar, Scalar>();
|
testAllComponents<Scalar, Scalar>();
|
||||||
|
|||||||
@@ -34,8 +34,8 @@
|
|||||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <opm/material/localad/Evaluation.hpp>
|
#include <opm/material/densead/Evaluation.hpp>
|
||||||
#include <opm/material/localad/Math.hpp>
|
#include <opm/material/densead/Math.hpp>
|
||||||
|
|
||||||
#include <opm/material/common/Unused.hpp>
|
#include <opm/material/common/Unused.hpp>
|
||||||
|
|
||||||
@@ -55,9 +55,9 @@ static const int numVars = 3;
|
|||||||
template <class Scalar>
|
template <class Scalar>
|
||||||
void testOperators(const Scalar tolerance)
|
void testOperators(const Scalar tolerance)
|
||||||
{
|
{
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, numVars> Eval;
|
typedef Opm::DenseAd::Evaluation<Scalar, numVars> Eval;
|
||||||
|
|
||||||
// test the constructors of the Opm::LocalAd::Evaluation class
|
// test the constructors of the Opm::DenseAd::Evaluation class
|
||||||
const Scalar c = 1.234;
|
const Scalar c = 1.234;
|
||||||
const Scalar x = 4.567;
|
const Scalar x = 4.567;
|
||||||
const Scalar y = 8.910;
|
const Scalar y = 8.910;
|
||||||
@@ -231,7 +231,7 @@ void testOperators(const Scalar tolerance)
|
|||||||
template <class Scalar, class AdFn, class ClassicFn>
|
template <class Scalar, class AdFn, class ClassicFn>
|
||||||
void test1DFunction(AdFn* adFn, ClassicFn* classicFn, Scalar xMin = 1e-6, Scalar xMax = 1000)
|
void test1DFunction(AdFn* adFn, ClassicFn* classicFn, Scalar xMin = 1e-6, Scalar xMax = 1000)
|
||||||
{
|
{
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, numVars> Eval;
|
typedef Opm::DenseAd::Evaluation<Scalar, numVars> Eval;
|
||||||
|
|
||||||
int n = 100*1000;
|
int n = 100*1000;
|
||||||
for (int i = 0; i < n; ++ i) {
|
for (int i = 0; i < n; ++ i) {
|
||||||
@@ -266,7 +266,7 @@ template <class Scalar,
|
|||||||
class ClassicFn>
|
class ClassicFn>
|
||||||
void test2DFunction1(AdFn* adFn, ClassicFn* classicFn, Scalar xMin, Scalar xMax, Scalar y)
|
void test2DFunction1(AdFn* adFn, ClassicFn* classicFn, Scalar xMin, Scalar xMax, Scalar y)
|
||||||
{
|
{
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, numVars> Eval;
|
typedef Opm::DenseAd::Evaluation<Scalar, numVars> Eval;
|
||||||
|
|
||||||
int n = 100*1000;
|
int n = 100*1000;
|
||||||
for (int i = 0; i < n; ++ i) {
|
for (int i = 0; i < n; ++ i) {
|
||||||
@@ -303,7 +303,7 @@ template <class Scalar,
|
|||||||
class ClassicFn>
|
class ClassicFn>
|
||||||
void test2DFunction2(AdFn* adFn, ClassicFn* classicFn, Scalar x, Scalar yMin, Scalar yMax)
|
void test2DFunction2(AdFn* adFn, ClassicFn* classicFn, Scalar x, Scalar yMin, Scalar yMax)
|
||||||
{
|
{
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, numVars> Eval;
|
typedef Opm::DenseAd::Evaluation<Scalar, numVars> Eval;
|
||||||
|
|
||||||
int n = 100*1000;
|
int n = 100*1000;
|
||||||
for (int i = 0; i < n; ++ i) {
|
for (int i = 0; i < n; ++ i) {
|
||||||
@@ -338,7 +338,7 @@ void test2DFunction2(AdFn* adFn, ClassicFn* classicFn, Scalar x, Scalar yMin, Sc
|
|||||||
template <class Scalar>
|
template <class Scalar>
|
||||||
void testPowBase(Scalar baseMin = 1e-2, Scalar baseMax = 100)
|
void testPowBase(Scalar baseMin = 1e-2, Scalar baseMax = 100)
|
||||||
{
|
{
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, numVars> Eval;
|
typedef Opm::DenseAd::Evaluation<Scalar, numVars> Eval;
|
||||||
typedef Opm::MathToolbox<Eval> EvalToolbox;
|
typedef Opm::MathToolbox<Eval> EvalToolbox;
|
||||||
|
|
||||||
Scalar exp = 1.234;
|
Scalar exp = 1.234;
|
||||||
@@ -380,7 +380,7 @@ void testPowBase(Scalar baseMin = 1e-2, Scalar baseMax = 100)
|
|||||||
template <class Scalar>
|
template <class Scalar>
|
||||||
void testPowExp(Scalar expMin = -100, Scalar expMax = 100)
|
void testPowExp(Scalar expMin = -100, Scalar expMax = 100)
|
||||||
{
|
{
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, numVars> Eval;
|
typedef Opm::DenseAd::Evaluation<Scalar, numVars> Eval;
|
||||||
typedef Opm::MathToolbox<Eval> EvalToolbox;
|
typedef Opm::MathToolbox<Eval> EvalToolbox;
|
||||||
|
|
||||||
Scalar base = 1.234;
|
Scalar base = 1.234;
|
||||||
@@ -422,7 +422,7 @@ void testPowExp(Scalar expMin = -100, Scalar expMax = 100)
|
|||||||
template <class Scalar>
|
template <class Scalar>
|
||||||
void testAtan2()
|
void testAtan2()
|
||||||
{
|
{
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, numVars> Eval;
|
typedef Opm::DenseAd::Evaluation<Scalar, numVars> Eval;
|
||||||
|
|
||||||
int n = 1000;
|
int n = 1000;
|
||||||
Scalar maxVal = 10.0;
|
Scalar maxVal = 10.0;
|
||||||
@@ -484,30 +484,30 @@ inline void testAll()
|
|||||||
// the following is commented out because it is supposed to produce a compiler
|
// the following is commented out because it is supposed to produce a compiler
|
||||||
// error. This is the case since the function does not calculate the derivatives
|
// error. This is the case since the function does not calculate the derivatives
|
||||||
// w.r.t. Pressure but they have been requested...
|
// w.r.t. Pressure but they have been requested...
|
||||||
//const auto& result2 = Opm::LocalAd::sqrt(TemperatureEval::createVariable<Pressure>(4.0));
|
//const auto& result2 = Opm::DenseAd::sqrt(TemperatureEval::createVariable<Pressure>(4.0));
|
||||||
|
|
||||||
std::cout << "testing operators and constructors\n";
|
std::cout << "testing operators and constructors\n";
|
||||||
const Scalar eps = std::numeric_limits<Scalar>::epsilon()*1e3;
|
const Scalar eps = std::numeric_limits<Scalar>::epsilon()*1e3;
|
||||||
testOperators<Scalar>(eps);
|
testOperators<Scalar>(eps);
|
||||||
|
|
||||||
std::cout << "testing min()\n";
|
std::cout << "testing min()\n";
|
||||||
test2DFunction1<Scalar>(Opm::LocalAd::min<Scalar, numVars>,
|
test2DFunction1<Scalar>(Opm::DenseAd::min<Scalar, numVars>,
|
||||||
myScalarMin,
|
myScalarMin,
|
||||||
-1000, 1000,
|
-1000, 1000,
|
||||||
/*p=*/1.234);
|
/*p=*/1.234);
|
||||||
|
|
||||||
test2DFunction2<Scalar>(Opm::LocalAd::min<Scalar, numVars>,
|
test2DFunction2<Scalar>(Opm::DenseAd::min<Scalar, numVars>,
|
||||||
myScalarMin,
|
myScalarMin,
|
||||||
/*T=*/1.234,
|
/*T=*/1.234,
|
||||||
-1000, 1000);
|
-1000, 1000);
|
||||||
|
|
||||||
std::cout << "testing max()\n";
|
std::cout << "testing max()\n";
|
||||||
test2DFunction1<Scalar>(Opm::LocalAd::max<Scalar, numVars>,
|
test2DFunction1<Scalar>(Opm::DenseAd::max<Scalar, numVars>,
|
||||||
myScalarMax,
|
myScalarMax,
|
||||||
-1000, 1000,
|
-1000, 1000,
|
||||||
/*p=*/1.234);
|
/*p=*/1.234);
|
||||||
|
|
||||||
test2DFunction2<Scalar>(Opm::LocalAd::max<Scalar, numVars>,
|
test2DFunction2<Scalar>(Opm::DenseAd::max<Scalar, numVars>,
|
||||||
myScalarMax,
|
myScalarMax,
|
||||||
/*T=*/1.234,
|
/*T=*/1.234,
|
||||||
-1000, 1000);
|
-1000, 1000);
|
||||||
@@ -517,40 +517,40 @@ inline void testAll()
|
|||||||
testPowExp<Scalar>();
|
testPowExp<Scalar>();
|
||||||
|
|
||||||
std::cout << "testing abs()\n";
|
std::cout << "testing abs()\n";
|
||||||
test1DFunction<Scalar>(Opm::LocalAd::abs<Scalar, numVars>,
|
test1DFunction<Scalar>(Opm::DenseAd::abs<Scalar, numVars>,
|
||||||
static_cast<Scalar (*)(Scalar)>(std::abs));
|
static_cast<Scalar (*)(Scalar)>(std::abs));
|
||||||
|
|
||||||
std::cout << "testing sqrt()\n";
|
std::cout << "testing sqrt()\n";
|
||||||
test1DFunction<Scalar>(Opm::LocalAd::sqrt<Scalar, numVars>,
|
test1DFunction<Scalar>(Opm::DenseAd::sqrt<Scalar, numVars>,
|
||||||
static_cast<Scalar (*)(Scalar)>(std::sqrt));
|
static_cast<Scalar (*)(Scalar)>(std::sqrt));
|
||||||
|
|
||||||
std::cout << "testing sin()\n";
|
std::cout << "testing sin()\n";
|
||||||
test1DFunction<Scalar>(Opm::LocalAd::sin<Scalar, numVars>,
|
test1DFunction<Scalar>(Opm::DenseAd::sin<Scalar, numVars>,
|
||||||
static_cast<Scalar (*)(Scalar)>(std::sin),
|
static_cast<Scalar (*)(Scalar)>(std::sin),
|
||||||
0, 2*M_PI);
|
0, 2*M_PI);
|
||||||
|
|
||||||
std::cout << "testing asin()\n";
|
std::cout << "testing asin()\n";
|
||||||
test1DFunction<Scalar>(Opm::LocalAd::asin<Scalar, numVars>,
|
test1DFunction<Scalar>(Opm::DenseAd::asin<Scalar, numVars>,
|
||||||
static_cast<Scalar (*)(Scalar)>(std::asin),
|
static_cast<Scalar (*)(Scalar)>(std::asin),
|
||||||
-1.0, 1.0);
|
-1.0, 1.0);
|
||||||
|
|
||||||
std::cout << "testing cos()\n";
|
std::cout << "testing cos()\n";
|
||||||
test1DFunction<Scalar>(Opm::LocalAd::cos<Scalar, numVars>,
|
test1DFunction<Scalar>(Opm::DenseAd::cos<Scalar, numVars>,
|
||||||
static_cast<Scalar (*)(Scalar)>(std::cos),
|
static_cast<Scalar (*)(Scalar)>(std::cos),
|
||||||
0, 2*M_PI);
|
0, 2*M_PI);
|
||||||
|
|
||||||
std::cout << "testing acos()\n";
|
std::cout << "testing acos()\n";
|
||||||
test1DFunction<Scalar>(Opm::LocalAd::acos<Scalar, numVars>,
|
test1DFunction<Scalar>(Opm::DenseAd::acos<Scalar, numVars>,
|
||||||
static_cast<Scalar (*)(Scalar)>(std::acos),
|
static_cast<Scalar (*)(Scalar)>(std::acos),
|
||||||
-1.0, 1.0);
|
-1.0, 1.0);
|
||||||
|
|
||||||
std::cout << "testing tan()\n";
|
std::cout << "testing tan()\n";
|
||||||
test1DFunction<Scalar>(Opm::LocalAd::tan<Scalar, numVars>,
|
test1DFunction<Scalar>(Opm::DenseAd::tan<Scalar, numVars>,
|
||||||
static_cast<Scalar (*)(Scalar)>(std::tan),
|
static_cast<Scalar (*)(Scalar)>(std::tan),
|
||||||
-M_PI / 2 * 0.95, M_PI / 2 * 0.95);
|
-M_PI / 2 * 0.95, M_PI / 2 * 0.95);
|
||||||
|
|
||||||
std::cout << "testing atan()\n";
|
std::cout << "testing atan()\n";
|
||||||
test1DFunction<Scalar>(Opm::LocalAd::atan<Scalar, numVars>,
|
test1DFunction<Scalar>(Opm::DenseAd::atan<Scalar, numVars>,
|
||||||
static_cast<Scalar (*)(Scalar)>(std::atan),
|
static_cast<Scalar (*)(Scalar)>(std::atan),
|
||||||
-10*1000.0, 10*1000.0);
|
-10*1000.0, 10*1000.0);
|
||||||
|
|
||||||
@@ -558,12 +558,12 @@ inline void testAll()
|
|||||||
testAtan2<Scalar>();
|
testAtan2<Scalar>();
|
||||||
|
|
||||||
std::cout << "testing exp()\n";
|
std::cout << "testing exp()\n";
|
||||||
test1DFunction<Scalar>(Opm::LocalAd::exp<Scalar, numVars>,
|
test1DFunction<Scalar>(Opm::DenseAd::exp<Scalar, numVars>,
|
||||||
static_cast<Scalar (*)(Scalar)>(std::exp),
|
static_cast<Scalar (*)(Scalar)>(std::exp),
|
||||||
-100, 100);
|
-100, 100);
|
||||||
|
|
||||||
std::cout << "testing log()\n";
|
std::cout << "testing log()\n";
|
||||||
test1DFunction<Scalar>(Opm::LocalAd::log<Scalar, numVars>,
|
test1DFunction<Scalar>(Opm::DenseAd::log<Scalar, numVars>,
|
||||||
static_cast<Scalar (*)(Scalar)>(std::log),
|
static_cast<Scalar (*)(Scalar)>(std::log),
|
||||||
1e-6, 1e9);
|
1e-6, 1e9);
|
||||||
}
|
}
|
||||||
@@ -44,8 +44,8 @@
|
|||||||
#include <opm/material/fluidsystems/blackoilpvt/OilPvtMultiplexer.hpp>
|
#include <opm/material/fluidsystems/blackoilpvt/OilPvtMultiplexer.hpp>
|
||||||
#include <opm/material/fluidsystems/blackoilpvt/WaterPvtMultiplexer.hpp>
|
#include <opm/material/fluidsystems/blackoilpvt/WaterPvtMultiplexer.hpp>
|
||||||
|
|
||||||
#include <opm/material/localad/Evaluation.hpp>
|
#include <opm/material/densead/Evaluation.hpp>
|
||||||
#include <opm/material/localad/Math.hpp>
|
#include <opm/material/densead/Math.hpp>
|
||||||
|
|
||||||
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@ inline void testAll()
|
|||||||
oilPvt.initFromDeck(deck, eclState);
|
oilPvt.initFromDeck(deck, eclState);
|
||||||
waterPvt.initFromDeck(deck, eclState);
|
waterPvt.initFromDeck(deck, eclState);
|
||||||
|
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, 1> FooEval;
|
typedef Opm::DenseAd::Evaluation<Scalar, 1> FooEval;
|
||||||
ensurePvtApi<Scalar>(oilPvt, gasPvt, waterPvt);
|
ensurePvtApi<Scalar>(oilPvt, gasPvt, waterPvt);
|
||||||
ensurePvtApi<FooEval>(oilPvt, gasPvt, waterPvt);
|
ensurePvtApi<FooEval>(oilPvt, gasPvt, waterPvt);
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
// include the local AD framwork
|
// include the local AD framwork
|
||||||
#include <opm/material/localad/Math.hpp>
|
#include <opm/material/densead/Math.hpp>
|
||||||
|
|
||||||
// include all capillary pressure laws
|
// include all capillary pressure laws
|
||||||
#include <opm/material/fluidmatrixinteractions/BrooksCorey.hpp>
|
#include <opm/material/fluidmatrixinteractions/BrooksCorey.hpp>
|
||||||
@@ -280,7 +280,7 @@ inline void testAll()
|
|||||||
ThreePFluidSystem::oilPhaseIdx,
|
ThreePFluidSystem::oilPhaseIdx,
|
||||||
ThreePFluidSystem::gasPhaseIdx> ThreePhaseTraits;
|
ThreePFluidSystem::gasPhaseIdx> ThreePhaseTraits;
|
||||||
|
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, 3> Evaluation;
|
typedef Opm::DenseAd::Evaluation<Scalar, 3> Evaluation;
|
||||||
typedef Opm::ImmiscibleFluidState<Evaluation, TwoPFluidSystem> TwoPhaseFluidState;
|
typedef Opm::ImmiscibleFluidState<Evaluation, TwoPFluidSystem> TwoPhaseFluidState;
|
||||||
typedef Opm::ImmiscibleFluidState<Evaluation, ThreePFluidSystem> ThreePhaseFluidState;
|
typedef Opm::ImmiscibleFluidState<Evaluation, ThreePFluidSystem> ThreePhaseFluidState;
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <opm/material/checkFluidSystem.hpp>
|
#include <opm/material/checkFluidSystem.hpp>
|
||||||
#include <opm/material/localad/Evaluation.hpp>
|
#include <opm/material/densead/Evaluation.hpp>
|
||||||
#include <opm/material/localad/Math.hpp>
|
#include <opm/material/densead/Math.hpp>
|
||||||
|
|
||||||
// include all fluid systems in opm-material
|
// include all fluid systems in opm-material
|
||||||
#include <opm/material/fluidsystems/SinglePhaseFluidSystem.hpp>
|
#include <opm/material/fluidsystems/SinglePhaseFluidSystem.hpp>
|
||||||
@@ -236,7 +236,7 @@ void testAllFluidSystems()
|
|||||||
typedef Opm::FluidSystems::BlackOil<Scalar> FluidSystem;
|
typedef Opm::FluidSystems::BlackOil<Scalar> FluidSystem;
|
||||||
if (false) checkFluidSystem<Scalar, FluidSystem, FluidStateEval, LhsEval>();
|
if (false) checkFluidSystem<Scalar, FluidSystem, FluidStateEval, LhsEval>();
|
||||||
|
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, 1> BlackoilDummyEval;
|
typedef Opm::DenseAd::Evaluation<Scalar, 1> BlackoilDummyEval;
|
||||||
ensureBlackoilApi<Scalar, FluidSystem>();
|
ensureBlackoilApi<Scalar, FluidSystem>();
|
||||||
ensureBlackoilApi<BlackoilDummyEval, FluidSystem>();
|
ensureBlackoilApi<BlackoilDummyEval, FluidSystem>();
|
||||||
}
|
}
|
||||||
@@ -309,7 +309,7 @@ void testAllFluidSystems()
|
|||||||
template <class Scalar>
|
template <class Scalar>
|
||||||
inline void testAll()
|
inline void testAll()
|
||||||
{
|
{
|
||||||
typedef Opm::LocalAd::Evaluation<Scalar, 3> Evaluation;
|
typedef Opm::DenseAd::Evaluation<Scalar, 3> Evaluation;
|
||||||
|
|
||||||
// ensure that all fluid states are API-compliant
|
// ensure that all fluid states are API-compliant
|
||||||
testAllFluidStates<Scalar>();
|
testAllFluidStates<Scalar>();
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <opm/material/localad/Evaluation.hpp>
|
#include <opm/material/densead/Evaluation.hpp>
|
||||||
#include <opm/material/constraintsolvers/MiscibleMultiPhaseComposition.hpp>
|
#include <opm/material/constraintsolvers/MiscibleMultiPhaseComposition.hpp>
|
||||||
#include <opm/material/constraintsolvers/ComputeFromReferencePhase.hpp>
|
#include <opm/material/constraintsolvers/ComputeFromReferencePhase.hpp>
|
||||||
#include <opm/material/constraintsolvers/ImmiscibleFlash.hpp>
|
#include <opm/material/constraintsolvers/ImmiscibleFlash.hpp>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <opm/material/localad/Evaluation.hpp>
|
#include <opm/material/densead/Evaluation.hpp>
|
||||||
#include <opm/material/constraintsolvers/ComputeFromReferencePhase.hpp>
|
#include <opm/material/constraintsolvers/ComputeFromReferencePhase.hpp>
|
||||||
#include <opm/material/constraintsolvers/NcpFlash.hpp>
|
#include <opm/material/constraintsolvers/NcpFlash.hpp>
|
||||||
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
|
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
|
||||||
|
|||||||
Reference in New Issue
Block a user