Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
90aa11b8
Commit
90aa11b8
authored
3 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
mv check for data=0 to DataUtils
parent
514f4999
No related branches found
No related tags found
1 merge request
!559
extend check for data=0 to more tests
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Device/Data/DataUtils.cpp
+7
-0
7 additions, 0 deletions
Device/Data/DataUtils.cpp
Tests/Functional/Core/Std/Check.cpp
+0
-7
0 additions, 7 deletions
Tests/Functional/Core/Std/Check.cpp
with
7 additions
and
7 deletions
Device/Data/DataUtils.cpp
+
7
−
0
View file @
90aa11b8
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include
"Base/Math/FourierTransform.h"
#include
"Base/Math/FourierTransform.h"
#include
"Base/Math/Numeric.h"
#include
"Base/Math/Numeric.h"
#include
"Device/Data/ArrayUtils.h"
#include
"Device/Data/ArrayUtils.h"
#include
"Device/Histo/IHistogram.h"
#include
<iostream>
#include
<iostream>
namespace
{
namespace
{
...
@@ -51,6 +52,12 @@ double DataUtils::Data::relativeDataDifference(const OutputData<double>& dat,
...
@@ -51,6 +52,12 @@ double DataUtils::Data::relativeDataDifference(const OutputData<double>& dat,
bool
DataUtils
::
Data
::
checkRelativeDifference
(
const
OutputData
<
double
>&
dat
,
bool
DataUtils
::
Data
::
checkRelativeDifference
(
const
OutputData
<
double
>&
dat
,
const
OutputData
<
double
>&
ref
,
const
double
threshold
)
const
OutputData
<
double
>&
ref
,
const
double
threshold
)
{
{
const
std
::
unique_ptr
<
const
IHistogram
>
histo
(
IHistogram
::
createHistogram
(
dat
));
if
(
histo
->
getMinimum
()
==
0
&&
histo
->
getMaximum
()
==
0
)
{
std
::
cerr
<<
"FAILED: simulated data set is empty"
<<
std
::
endl
;
return
false
;
}
const
double
diff
=
relativeDataDifference
(
dat
,
ref
);
const
double
diff
=
relativeDataDifference
(
dat
,
ref
);
if
(
diff
>
threshold
)
{
if
(
diff
>
threshold
)
{
std
::
cerr
<<
"FAILED: relative deviation of dat from ref is "
<<
diff
std
::
cerr
<<
"FAILED: relative deviation of dat from ref is "
<<
diff
...
...
This diff is collapsed.
Click to expand it.
Tests/Functional/Core/Std/Check.cpp
+
0
−
7
View file @
90aa11b8
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
#include
"Base/Util/FileSystemUtils.h"
#include
"Base/Util/FileSystemUtils.h"
#include
"Core/Simulation/ISimulation.h"
#include
"Core/Simulation/ISimulation.h"
#include
"Device/Data/DataUtils.h"
#include
"Device/Data/DataUtils.h"
#include
"Device/Histo/IHistogram.h"
#include
"Device/Histo/IntensityDataIOFactory.h"
#include
"Device/Histo/IntensityDataIOFactory.h"
#include
"Device/Histo/SimulationResult.h"
#include
"Device/Histo/SimulationResult.h"
#include
<iostream>
#include
<iostream>
...
@@ -30,12 +29,6 @@ bool checkSimulation(const std::string& name, const ISimulation& direct_simulati
...
@@ -30,12 +29,6 @@ bool checkSimulation(const std::string& name, const ISimulation& direct_simulati
// Run simulation directly.
// Run simulation directly.
const
std
::
unique_ptr
<
OutputData
<
double
>>
result_data
=
direct_simulation
.
result
().
data
();
const
std
::
unique_ptr
<
OutputData
<
double
>>
result_data
=
direct_simulation
.
result
().
data
();
const
std
::
unique_ptr
<
const
IHistogram
>
histo
(
IHistogram
::
createHistogram
(
*
result_data
));
if
(
histo
->
getMinimum
()
==
0
&&
histo
->
getMaximum
()
==
0
)
{
std
::
cerr
<<
"FAILED: simulated data set is empty
\n
"
;
return
false
;
}
std
::
unique_ptr
<
OutputData
<
double
>>
reference
;
std
::
unique_ptr
<
OutputData
<
double
>>
reference
;
// Load reference if available.
// Load reference if available.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment