Skip to content
Snippets Groups Projects
Commit b8a5e16f authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Add a 3D test

parent baf27431
No related branches found
No related tags found
No related merge requests found
......@@ -253,6 +253,47 @@ void testHorribleFunctionLogarithmic() {
assert(std::abs(ret1 - ret3) < 1e-5);
}
void testSampleFunction3D() {
int const dim = 3;
typedef Dune::SampleFunctional<dim> Functional;
Functional::SmallMatrix A;
A[0][0] = 3;
A[0][1] = 1.5;
A[1][0] = 1.5;
A[1][1] = 4;
A[1][2] = 1.5;
A[2][1] = 1.5;
A[2][2] = 5;
Functional::SmallVector b;
b[0] = 1;
b[1] = 2;
b[2] = 3;
Dune::SampleFunction f;
Functional J(A, b, Dune::MyNonlinearity<dim>(f));
Functional::SmallVector start = b;
start *= 17;
double const ret1 = functionTester(J, start, 9);
// Something random
start[0] = 279;
start[1] = -96;
start[2] = -15;
double const ret2 = functionTester(J, start, 15);
assert(std::abs(ret1 - ret2) < 1e-5);
start[0] = 0;
start[1] = 0;
start[2] = 0;
double const ret3 = functionTester(J, start, 5);
assert(std::abs(ret1 - ret3) < 1e-5);
}
int main() {
try {
testSampleFunction();
......@@ -264,6 +305,8 @@ int main() {
testHorribleFunction();
std::cout << std::endl << std::endl << std::endl;
testHorribleFunctionLogarithmic();
std::cout << std::endl << std::endl << std::endl;
testSampleFunction3D();
return 0;
}
catch (Dune::Exception &e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment