Skip to content
Snippets Groups Projects
Commit be098628 authored by Ansgar Burchardt's avatar Ansgar Burchardt Committed by Oliver Sander
Browse files

test local() and global() outside the reference element

parent 895d647f
No related branches found
No related tags found
No related merge requests found
......@@ -220,6 +220,23 @@ static bool testNonLinearGeometry()
}
}
/* Test global() outside reference element */
{
Vector local; local[0] = -1; local[1] = 0;
Vector global; global[0] = -2; global[1] = 0;
const Vector global2(geometry.global(local));
if (global2 != global2) {
std::cerr << "global failed outside reference element: returned NaN: "
<< global2 << std::endl;
pass = false;
}
if ((global - global2).two_norm() > epsilon) {
std::cerr << "global failed outside reference element: got " << global2
<< ", but expected " << global << std::endl;
pass = false;
}
}
/* Test local() */
for (std::size_t c = 0; c < corners.size(); ++c) {
const Vector& local(reference.position(c, dim));
......@@ -236,6 +253,23 @@ static bool testNonLinearGeometry()
}
}
/* Test local() outside reference element */
{
Vector global; global[0] = -2; global[1] = 0;
Vector local; local[0] = -1; local[1] = 0;
const Vector local2(geometry.local(global));
if (local2 != local2) {
std::cerr << "local failed outside reference element: returned NaN: "
<< local2 << std::endl;
pass = false;
}
if ((local - local2).two_norm() > epsilon) {
std::cerr << "local failed outside reference element: got " << local2
<< ", but expected " << local << std::endl;
pass = false;
}
}
std::cout << (pass ? "passed" : "failed") << std::endl;
return pass;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment