Skip to content
Snippets Groups Projects
Commit 06b4d739 authored by Ganeva, Marina's avatar Ganeva, Marina
Browse files

Function GetDifference is implemented.

parent 7066fa8c
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "Units.h" #include "Units.h"
#include "Types.h" #include "Types.h"
#include "SimulationRegistry.h" #include "SimulationRegistry.h"
#include "OutputDataFunctions.h"
using namespace FunctionalTests; using namespace FunctionalTests;
...@@ -45,18 +46,10 @@ int MesoCrystal1::analyseResults() ...@@ -45,18 +46,10 @@ int MesoCrystal1::analyseResults()
const double threshold(1e-10); const double threshold(1e-10);
// calculating average relative difference // calculating average relative difference
*m_result -= *m_reference; double diff = OutputDataFunctions::GetDifference(*m_result,*m_reference);
*m_result /= *m_reference;
double diff(0);
for(OutputData<double>::const_iterator it=m_result->begin();
it!=m_result->end(); ++it) {
diff+= std::fabs(*it);
}
diff /= m_result->getAllocatedSize();
bool status_ok(true); bool status_ok(true);
if( diff > threshold || std::isnan(diff)) status_ok=false; if( diff > threshold ) status_ok=false;
std::cout << " diff " << diff << std::endl; std::cout << " diff " << diff << std::endl;
std::cout << m_name << " " << m_description << " " << std::cout << m_name << " " << m_description << " " <<
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "Units.h" #include "Units.h"
#include "Types.h" #include "Types.h"
#include "SimulationRegistry.h" #include "SimulationRegistry.h"
#include "OutputDataFunctions.h"
using namespace FunctionalTests; using namespace FunctionalTests;
...@@ -42,18 +43,10 @@ int PolarizedDWBAZeroMag::analyseResults() ...@@ -42,18 +43,10 @@ int PolarizedDWBAZeroMag::analyseResults()
const double threshold(1e-10); const double threshold(1e-10);
// calculating average relative difference // calculating average relative difference
*m_result -= *m_reference; double diff = OutputDataFunctions::GetDifference(*m_result,*m_reference);
*m_result /= *m_reference;
double diff(0);
for(OutputData<double>::const_iterator it=m_result->begin();
it!=m_result->end(); ++it) {
diff+= std::fabs(*it);
}
diff /= m_result->getAllocatedSize();
bool status_ok(true); bool status_ok(true);
if( diff > threshold || std::isnan(diff)) status_ok=false; if( diff > threshold ) status_ok=false;
std::cout << " diff " << diff << std::endl; std::cout << " diff " << diff << std::endl;
std::cout << m_name << " " << m_description << " " << std::cout << m_name << " " << m_description << " " <<
......
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