Skip to content
Snippets Groups Projects
Commit 9ba69882 authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Fix cosseratenergytest

* Do not test with configurations that result in zero-area elements
  (because the energy is inf in these cases).
* Test for the relative energy difference, rather than the absolute one,
  because the energy values can get very large.
parent 40f3bbe5
No related branches found
No related tags found
No related merge requests found
Pipeline #2892 failed
......@@ -197,10 +197,7 @@ void testEnergy(const GridType* grid, const std::vector<TargetSpace>& coefficien
double energy = assembler.energy(localView,
rotatedCoefficients);
assert(std::fabs(energy-referenceEnergy) < 1e-4);
//std::cout << "energy: " << energy << std::endl;
assert(std::fabs(energy-referenceEnergy)/std::fabs(energy) < 1e-4);
}
......@@ -234,6 +231,16 @@ void testFrameInvariance()
for (int i=0; i<numIndices; i++, ++index) {
// Discard all configurations that deform the element to zero area
bool identicalPoints = false;
for (int j=0; j<domainDim+1; j++)
for (int k=0; k<domainDim+1; k++)
if (j!=k and (testPoints[index[j]].r - testPoints[index[k]].r).two_norm() < 1e-5)
identicalPoints = true;
if (identicalPoints)
continue;
for (int j=0; j<domainDim+1; j++)
coefficients[j] = testPoints[index[j]];
......
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