clean up the licensing preable of source files
this patch removes the in-file lists in favor of a global list of in the COPYING file. this is done because (a) maintaining a list of authors at the beginning of each source file is a major pain in the a**, (b) for this reason, the list of authors was not accurate in about 85% of all cases where more than one person was involved and (c) this list is not legally binding in any way (the copyright is at the person who authored a given change; if these lists had any legal relevance, one could "aquire" the copyright of the module by forking it and replacing the lists...)
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2015 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2014 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2015 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2015 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2015 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2011-2013 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2011-2013 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2011-2013 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2015 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2011-2013 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2011-2013 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*****************************************************************************
|
||||
* Copyright (C) 2010-2012 by Andreas Lauser *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*****************************************************************************/
|
||||
/*
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
@@ -29,23 +31,17 @@
|
||||
----------- snip -----------
|
||||
./test_spline > spline.csv
|
||||
gnuplot
|
||||
|
||||
gnuplot> plot "spline.csv" using 1:2 w l ti "Curve", \
|
||||
"spline.csv" using 1:3 w l ti "Derivative", \
|
||||
"spline.csv" using 1:4 w p ti "Monotonical"
|
||||
----------- snap -----------
|
||||
|
||||
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <array>
|
||||
#include <opm/material/common/Spline.hpp>
|
||||
|
||||
#define GCC_VERSION (__GNUC__ * 10000 \
|
||||
+ __GNUC_MINOR__ * 100 \
|
||||
+ __GNUC_PATCHLEVEL__)
|
||||
|
||||
template <class Spline>
|
||||
void testCommon(const Spline &sp,
|
||||
const double *x,
|
||||
@@ -53,77 +49,62 @@ void testCommon(const Spline &sp,
|
||||
{
|
||||
static double eps = 1e-10;
|
||||
static double epsFD = 1e-7;
|
||||
|
||||
size_t n = sp.numSamples();
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
// sure that we hit all sampling points
|
||||
double y0 = (i>0)?sp.eval(x[i]-eps):y[0];
|
||||
double y1 = sp.eval(x[i]);
|
||||
double y2 = (i<n-1)?sp.eval(x[i]+eps):y[n-1];
|
||||
|
||||
if (std::abs(y0 - y[i]) > 100*eps || std::abs(y2 - y[i]) > 100*eps)
|
||||
OPM_THROW(std::runtime_error,
|
||||
"Spline seems to be discontinuous at sampling point " << i << "!");
|
||||
if (std::abs(y1 - y[i]) > eps)
|
||||
OPM_THROW(std::runtime_error,
|
||||
"Spline does not capture sampling point " << i << "!");
|
||||
|
||||
// make sure the derivative is continuous (assuming that the
|
||||
// second derivative is smaller than 1000)
|
||||
double d1 = sp.evalDerivative(x[i]);
|
||||
double d0 = (i>0)?sp.evalDerivative(x[i]-eps):d1;
|
||||
double d2 = (i<n-1)?sp.evalDerivative(x[i]+eps):d1;
|
||||
|
||||
if (std::abs(d1 - d0) > 1000*eps || std::abs(d2 - d0) > 1000*eps)
|
||||
OPM_THROW(std::runtime_error,
|
||||
"Spline seems to exhibit a discontinuous derivative at sampling point " << i << "!");
|
||||
}
|
||||
|
||||
// make sure the derivatives are consistent with the curve
|
||||
size_t np = 3*n;
|
||||
for (size_t i = 0; i < np; ++i) {
|
||||
double xMin = sp.xAt(0);
|
||||
double xMax = sp.xAt(sp.numSamples() - 1);
|
||||
double xval = xMin + (xMax - xMin)*i/np;
|
||||
|
||||
// first derivative
|
||||
double y1 = sp.eval(xval+epsFD);
|
||||
double y0 = sp.eval(xval);
|
||||
|
||||
double mFD = (y1 - y0)/epsFD;
|
||||
double m = sp.evalDerivative(xval);
|
||||
|
||||
if (std::abs( mFD - m ) > 1000*epsFD)
|
||||
OPM_THROW(std::runtime_error,
|
||||
"Derivative of spline seems to be inconsistent with cuve"
|
||||
" (" << mFD << " - " << m << " = " << mFD - m << ")!");
|
||||
|
||||
// second derivative
|
||||
y1 = sp.evalDerivative(xval+epsFD);
|
||||
y0 = sp.evalDerivative(xval);
|
||||
|
||||
mFD = (y1 - y0)/epsFD;
|
||||
m = sp.evalSecondDerivative(xval);
|
||||
|
||||
if (std::abs( mFD - m ) > 1000*epsFD)
|
||||
OPM_THROW(std::runtime_error,
|
||||
"Second derivative of spline seems to be inconsistent with cuve"
|
||||
" (" << mFD << " - " << m << " = " << mFD - m << ")!");
|
||||
|
||||
// Third derivative
|
||||
y1 = sp.evalSecondDerivative(xval+epsFD);
|
||||
y0 = sp.evalSecondDerivative(xval);
|
||||
|
||||
mFD = (y1 - y0)/epsFD;
|
||||
m = sp.evalThirdDerivative(xval);
|
||||
|
||||
if (std::abs( mFD - m ) > 1000*epsFD)
|
||||
OPM_THROW(std::runtime_error,
|
||||
"Third derivative of spline seems to be inconsistent with cuve"
|
||||
" (" << mFD << " - " << m << " = " << mFD - m << ")!");
|
||||
}
|
||||
}
|
||||
|
||||
template <class Spline>
|
||||
void testFull(const Spline &sp,
|
||||
const double *x,
|
||||
@@ -133,10 +114,8 @@ void testFull(const Spline &sp,
|
||||
{
|
||||
// test the common properties of splines
|
||||
testCommon(sp, x, y);
|
||||
|
||||
static double eps = 1e-5;
|
||||
size_t n = sp.numSamples();
|
||||
|
||||
// make sure the derivative at both end points is correct
|
||||
double d0 = sp.evalDerivative(x[0]);
|
||||
double d1 = sp.evalDerivative(x[n-1]);
|
||||
@@ -149,7 +128,6 @@ void testFull(const Spline &sp,
|
||||
"Invalid derivative at end of interval: is "
|
||||
<< d1 << " ought to be " << m1);
|
||||
}
|
||||
|
||||
template <class Spline>
|
||||
void testNatural(const Spline &sp,
|
||||
const double *x,
|
||||
@@ -157,28 +135,22 @@ void testNatural(const Spline &sp,
|
||||
{
|
||||
// test the common properties of splines
|
||||
testCommon(sp, x, y);
|
||||
|
||||
static double eps = 1e-5;
|
||||
size_t n = sp.numSamples();
|
||||
|
||||
// make sure the second derivatives at both end points are 0
|
||||
double d0 = sp.evalDerivative(x[0]);
|
||||
double d1 = sp.evalDerivative(x[0] + eps);
|
||||
|
||||
double d2 = sp.evalDerivative(x[n-1] - eps);
|
||||
double d3 = sp.evalDerivative(x[n-1]);
|
||||
|
||||
if (std::abs(d1 - d0)/eps > 1000*eps)
|
||||
OPM_THROW(std::runtime_error,
|
||||
"Invalid second derivative at beginning of interval: is "
|
||||
<< (d1 - d0)/eps << " ought to be 0");
|
||||
|
||||
if (std::abs(d3 - d2)/eps > 1000*eps)
|
||||
OPM_THROW(std::runtime_error,
|
||||
"Invalid second derivative at end of interval: is "
|
||||
<< (d3 - d2)/eps << " ought to be 0");
|
||||
}
|
||||
|
||||
template <class Spline>
|
||||
void testMonotonic(const Spline &sp,
|
||||
const double *x,
|
||||
@@ -186,9 +158,7 @@ void testMonotonic(const Spline &sp,
|
||||
{
|
||||
// test the common properties of splines
|
||||
testCommon(sp, x, y);
|
||||
|
||||
size_t n = sp.numSamples();
|
||||
|
||||
for (size_t i = 0; i < n - 1; ++ i) {
|
||||
// make sure that the spline is monotonic for each interval
|
||||
// between sampling points
|
||||
@@ -196,7 +166,6 @@ void testMonotonic(const Spline &sp,
|
||||
OPM_THROW(std::runtime_error,
|
||||
"Spline says it is not monotonic in interval "
|
||||
<< i << " where it should be");
|
||||
|
||||
// test the intersection methods
|
||||
double d = (y[i] + y[i+1])/2;
|
||||
double interX = sp.template intersectInterval<double>(x[i], x[i+1],
|
||||
@@ -207,7 +176,6 @@ void testMonotonic(const Spline &sp,
|
||||
"Spline::intersectInterval() seems to be broken: "
|
||||
<< sp.eval(interX) << " - " << d << " = " << sp.eval(interX) - d << "!");
|
||||
}
|
||||
|
||||
// make sure the spline says to be monotonic on the (extrapolated)
|
||||
// left and right sides
|
||||
if (!sp.monotonic(x[0] - 1.0, (x[0] + x[1])/2, /*extrapolate=*/true))
|
||||
@@ -216,7 +184,6 @@ void testMonotonic(const Spline &sp,
|
||||
if (!sp.monotonic((x[n - 2]+ x[n - 1])/2, x[n-1] + 1.0, /*extrapolate=*/true))
|
||||
OPM_THROW(std::runtime_error,
|
||||
"Spline says it is not monotonic on right side where it should be");
|
||||
|
||||
for (size_t i = 0; i < n - 2; ++ i) {
|
||||
// make sure that the spline says that it is non-monotonic for
|
||||
// if extrema are within the queried interval
|
||||
@@ -226,10 +193,8 @@ void testMonotonic(const Spline &sp,
|
||||
<< i << " where it should not be");
|
||||
}
|
||||
}
|
||||
|
||||
// function prototype to prevent some compilers producing a warning
|
||||
void testAll();
|
||||
|
||||
void testAll()
|
||||
{
|
||||
double x[] = { 0, 5, 7.5, 8.75, 9.375 };
|
||||
@@ -244,8 +209,6 @@ void testAll()
|
||||
{x[3], y[3]},
|
||||
{x[4], y[4]},
|
||||
};
|
||||
|
||||
|
||||
#if GCC_VERSION >= 40500
|
||||
std::initializer_list<const std::pair<double, double> > pointsInitList =
|
||||
{
|
||||
@@ -256,7 +219,6 @@ void testAll()
|
||||
{x[4], y[4]},
|
||||
};
|
||||
#endif
|
||||
|
||||
std::vector<double> xVec;
|
||||
std::vector<double> yVec;
|
||||
std::vector<double*> pointVec;
|
||||
@@ -265,20 +227,16 @@ void testAll()
|
||||
yVec.push_back(y[i]);
|
||||
pointVec.push_back(points[i]);
|
||||
}
|
||||
|
||||
/////////
|
||||
// test spline with two sampling points
|
||||
/////////
|
||||
|
||||
// full spline
|
||||
{ Opm::Spline<double> sp(x[0], x[1], y[0], y[1], m0, m1); sp.set(x[0],x[1],y[0],y[1],m0, m1); testFull(sp, x, y, m0, m1); };
|
||||
{ Opm::Spline<double> sp(2, x, y, m0, m1); sp.setXYArrays(2, x, y, m0, m1); testFull(sp, x, y, m0, m1); };
|
||||
{ Opm::Spline<double> sp(static_cast<size_t>(2), points, m0, m1); sp.setArrayOfPoints(2, points, m0, m1); testFull(sp, x, y, m0, m1); };
|
||||
|
||||
/////////
|
||||
// test variable length splines
|
||||
/////////
|
||||
|
||||
// full spline
|
||||
{ Opm::Spline<double> sp(5, x, y, m0, m1); sp.setXYArrays(5,x,y,m0, m1); testFull(sp, x, y, m0, m1); };
|
||||
{ Opm::Spline<double> sp(xVec, yVec, m0, m1); sp.setXYContainers(xVec,yVec,m0, m1); testFull(sp, x, y, m0, m1); };
|
||||
@@ -287,7 +245,6 @@ void testAll()
|
||||
#if GCC_VERSION >= 40500
|
||||
{ Opm::Spline<double> sp; sp.setContainerOfTuples(pointsInitList,m0, m1); testFull(sp, x, y, m0, m1); };
|
||||
#endif
|
||||
|
||||
// natural spline
|
||||
{ Opm::Spline<double> sp(5, x, y); sp.setXYArrays(5,x,y); testNatural(sp, x, y); };
|
||||
{ Opm::Spline<double> sp(xVec, yVec); sp.setXYContainers(xVec,yVec); testNatural(sp, x, y); };
|
||||
@@ -297,30 +254,24 @@ void testAll()
|
||||
{ Opm::Spline<double> sp; sp.setContainerOfTuples(pointsInitList); testNatural(sp, x, y); };
|
||||
#endif
|
||||
}
|
||||
|
||||
// function prototype to prevent some compilers producing a warning
|
||||
void plot();
|
||||
|
||||
void plot()
|
||||
{
|
||||
const int numSamples = 5;
|
||||
const int n = numSamples - 1;
|
||||
typedef std::array<double, numSamples> FV;
|
||||
|
||||
double x_[] = { 0, 5, 7.5, 8.75, 10 };
|
||||
double y_[] = { 10, 0, 10, 0, 10 };
|
||||
double m1 = 10;
|
||||
double m2 = -10;
|
||||
FV &xs = *reinterpret_cast<FV*>(x_);
|
||||
FV &ys = *reinterpret_cast<FV*>(y_);
|
||||
|
||||
Opm::Spline<double> spFull(xs, ys, m1, m2);
|
||||
Opm::Spline<double> spNatural(xs, ys);
|
||||
Opm::Spline<double> spPeriodic(xs, ys, /*type=*/Opm::Spline<double>::Periodic);
|
||||
Opm::Spline<double> spMonotonic(xs, ys, /*type=*/Opm::Spline<double>::Monotonic);
|
||||
|
||||
testMonotonic(spMonotonic, x_, y_);
|
||||
|
||||
spFull.printCSV(x_[0] - 1.00001,
|
||||
x_[n] + 1.00001,
|
||||
1000);
|
||||
@@ -329,28 +280,23 @@ void plot()
|
||||
x_[n] + 1.00001,
|
||||
1000);
|
||||
std::cout << "\n";
|
||||
|
||||
spPeriodic.printCSV(x_[0] - 1.00001,
|
||||
x_[n] + 1.00001,
|
||||
1000);
|
||||
std::cout << "\n";
|
||||
|
||||
spMonotonic.printCSV(x_[0] - 1.00001,
|
||||
x_[n] + 1.00001,
|
||||
1000);
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
try {
|
||||
testAll();
|
||||
|
||||
plot();
|
||||
}
|
||||
catch (const std::exception &e) {
|
||||
std::cout << "Caught OPM exception: " << e.what() << "\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
// vi: set et ts=4 sw=4 sts=4:
|
||||
/*
|
||||
Copyright (C) 2010-2013 by Andreas Lauser
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
@@ -17,6 +15,10 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Consult the COPYING file in the top-level source directory of this
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
/*!
|
||||
* \file
|
||||
|
||||
Reference in New Issue
Block a user