45 #include "GlobiPack_TestLagrPolyMeritFunc1D.hpp"
59 using Teuchos::outArg;
65 using GlobiPack::computeValue;
68 template<
class Scalar>
69 inline Scalar sqr(
const Scalar &x) {
return x*x; }
78 "tol", &g_tol,
"Floating point tolerance" );
97 template<
class Scalar>
98 Scalar phi_quad1(
const Scalar &alpha)
100 return as<Scalar>(0.5)*sqr(alpha-as<Scalar>(2.0)) + as<Scalar>(2.0);
103 template<
class Scalar>
104 Scalar Dphi_quad1(
const Scalar &alpha)
106 return alpha-as<Scalar>(2.0);
114 ECHO(Array<Scalar> alphaPoints = tuple<Scalar>(0.0, 2.0, 4.0));
115 ECHO(Array<Scalar> phiPoints = tuple<Scalar>(4.0, 2.0, 4.0));
116 ECHO(TestLagrPolyMeritFunc1D<Scalar> meritFunc(alphaPoints, phiPoints));
119 Array<Scalar> alphaTestPoints = tuple<Scalar>(0.0, 1.0, 2.0, 3.0, 4.0);
120 for (
int test_i = 0; test_i < as<int>(alphaTestPoints.size()); ++test_i) {
121 out <<
"\ntest_i="<<test_i<<
"\n\n";
123 ECHO(
const Scalar alpha = alphaTestPoints[test_i]);
124 out <<
"alpha="<<alpha<<
"\n";
125 ECHO(Scalar phi = as<Scalar>(-1.0));
126 ECHO(Scalar Dphi = as<Scalar>(-1.0));
127 ECHO(meritFunc.eval(alpha, outArg(phi), outArg(Dphi)));
TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(Teuchos_Conditions, NumberConditionSerialization, T)
static magnitudeType eps()
static CommandLineProcessor & getCLP()
void setOption(const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL)
TypeTo as(const TypeFrom &t)
#define TEST_FLOATING_EQUALITY(v1, v2, tol)
TEST_ASSERT(castedDep1->getValuesAndValidators().size()==2)
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_REAL_SCALAR_TYPES(TEST_GROUP, TEST_NAME)
Lagrange Polynomial Merit Function used in testing.