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
b41b6550
Commit
b41b6550
authored
11 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Patches
Plain Diff
New ComplexBessel applicaiton test
parent
b6000bff
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
App/inc/TestBessel.h
+57
-0
57 additions, 0 deletions
App/inc/TestBessel.h
App/src/ApplicationTestFactory.cpp
+6
-0
6 additions, 0 deletions
App/src/ApplicationTestFactory.cpp
App/src/TestBessel.cpp
+55
-0
55 additions, 0 deletions
App/src/TestBessel.cpp
with
118 additions
and
0 deletions
App/inc/TestBessel.h
0 → 100644
+
57
−
0
View file @
b41b6550
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file App/inc/TestBessel.h
//! @brief Defines class TestBessel.
//
//! Homepage: apps.jcns.fz-juelich.de/BornAgain
//! License: GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2013
//! @authors Scientific Computing Group at MLZ Garching
//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
//
// ************************************************************************** //
#ifndef TESTBESSEL_H
#define TESTBESSEL_H
#include
"IApplicationTest.h"
#include
"Numeric.h"
class
TestBessel
:
public
IApplicationTest
{
public:
class
Data
{
public:
Data
()
:
x
(
0
),
b1
(
0
),
b2
(
0
)
{}
double
x
;
double
b1
;
double
b2
;
};
TestBessel
(){}
~
TestBessel
(){}
virtual
void
execute
();
void
run_benchmark
();
// (x1-x2)/x2
double
rel_diff
(
double
x1
,
double
x2
)
{
double
ratio
(
0
);
double
diff
=
x1
-
x2
;
if
(
std
::
abs
(
diff
)
<=
Numeric
::
double_epsilon
&&
std
::
abs
(
x2
)
<=
Numeric
::
double_epsilon
)
{
ratio
=
0.0
;
}
else
if
(
std
::
abs
(
x2
)
<=
Numeric
::
double_epsilon
)
{
ratio
=
diff
/
Numeric
::
double_epsilon
;
}
else
{
ratio
=
diff
/
x2
;
}
return
ratio
;
}
};
#endif // TESTBESSEL_H
This diff is collapsed.
Click to expand it.
App/src/ApplicationTestFactory.cpp
+
6
−
0
View file @
b41b6550
...
...
@@ -46,6 +46,7 @@
#include
"TestFunctionalTests.h"
#include
"TestRipple2.h"
#include
"TestRipple1.h"
#include
"TestBessel.h"
#include
"TBenchmark.h"
...
...
@@ -279,6 +280,11 @@ void RegisterApplicationTests(ApplicationTestFactory *p_test_factory)
IFactoryCreateFunction
<
TestRipple1
,
IApplicationTest
>
,
"test the new ripple1 formfactor"
);
p_test_factory
->
registerItem
(
"bessel"
,
IFactoryCreateFunction
<
TestBessel
,
IApplicationTest
>
,
"test complex bessel functions"
);
}
This diff is collapsed.
Click to expand it.
App/src/TestBessel.cpp
0 → 100644
+
55
−
0
View file @
b41b6550
#include
"TestBessel.h"
#include
"MathFunctions.h"
#include
"TCanvas.h"
#include
"TH2D.h"
#include
"TBenchmark.h"
#include
"TMath.h"
#include
<iostream>
void
TestBessel
::
execute
()
{
std
::
cout
<<
"TestBessel::execute() -> Hello World"
<<
std
::
endl
;
double
xmin
(
0.0
),
xmax
(
20.0
);
int
nx
(
201
);
double
dx
=
(
xmax
-
xmin
)
/
(
nx
-
1
);
std
::
cout
<<
"dx: "
<<
dx
<<
std
::
endl
;
std
::
vector
<
Data
>
buff
;
buff
.
resize
(
nx
);
for
(
int
i
=
0
;
i
<
nx
;
++
i
)
{
double
x
=
xmin
+
dx
*
i
;
buff
[
i
].
x
=
x
;
buff
[
i
].
b1
=
TMath
::
BesselJ1
(
x
);
buff
[
i
].
b2
=
MathFunctions
::
Bessel_J1
(
x
);
std
::
cout
<<
i
<<
" "
<<
x
<<
" "
<<
buff
[
i
].
b1
<<
std
::
endl
;
}
TCanvas
*
c1
=
new
TCanvas
(
"c1"
,
"c1"
,
1024
,
768
);
TH1D
*
h2
=
new
TH1D
(
"h2"
,
"h2"
,
nx
,
xmin
-
dx
/
2.
,
xmax
+
dx
/
2.
);
for
(
int
i
=
0
;
i
<
nx
;
++
i
)
{
h2
->
Fill
(
buff
[
i
].
x
,
rel_diff
(
buff
[
i
].
b1
,
buff
[
i
].
b2
));
}
c1
->
Divide
(
2
,
2
);
c1
->
cd
(
1
);
h2
->
Draw
();
}
void
TestBessel
::
run_benchmark
()
{
}
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