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
9750930e
Commit
9750930e
authored
4 years ago
by
Beerwerth, Randolf
Browse files
Options
Downloads
Patches
Plain Diff
code beautification
parent
1875c54b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/UnitTests/Core/Legacy/SpecularMagneticConsistencyTest.cpp
+17
-15
17 additions, 15 deletions
...UnitTests/Core/Legacy/SpecularMagneticConsistencyTest.cpp
with
17 additions
and
15 deletions
Tests/UnitTests/Core/Legacy/SpecularMagneticConsistencyTest.cpp
+
17
−
15
View file @
9750930e
#include
"Base/Const/Units.h"
#include
"Core/Legacy/SpecularMagneticStrategy_v2.h"
#include
"Sample/Material/MaterialFactoryFuncs.h"
#include
"Sample/Multilayer/MultiLayer.h"
#include
"Sample/Multilayer/Layer.h"
#include
"Sample/Multilayer/MultiLayer.h"
#include
"Sample/Processed/ProcessedSample.h"
#include
"Sample/RT/SimulationOptions.h"
#include
"Sample/Slice/KzComputation.h"
#include
"Sample/Specular/SpecularMagneticTanhStrategy.h"
#include
"Tests/GTestWrapper/google_test.h"
class
SpecularMagneticConsistencyTest
:
public
::
testing
::
Test
{
class
SpecularMagneticConsistencyTest
:
public
::
testing
::
Test
{
protected:
auto
static
constexpr
eps
=
1.e-10
;
std
::
unique_ptr
<
ProcessedSample
>
sample_1
();
template
<
typename
Strategy1
,
typename
Strategy2
>
void
testcase
(
const
std
::
vector
<
Slice
>
&
slices
,
double
k
);
template
<
typename
Strategy1
,
typename
Strategy2
>
void
testcase
(
const
std
::
vector
<
Slice
>&
slices
,
double
k
);
};
std
::
unique_ptr
<
ProcessedSample
>
SpecularMagneticConsistencyTest
::
sample_1
()
{
std
::
unique_ptr
<
ProcessedSample
>
SpecularMagneticConsistencyTest
::
sample_1
()
{
MultiLayer
multi_layer_scalar
;
Material
substr_material_scalar
=
HomogeneousMaterial
(
"Substrate"
,
7e-6
,
2e-8
);
Material
layer_material
=
HomogeneousMaterial
(
"Layer"
,
3e-6
,
1e-8
,
kvector_t
{
1.e7
,
0
,
1.e7
});
Material
layer_material
=
HomogeneousMaterial
(
"Layer"
,
3e-6
,
1e-8
,
kvector_t
{
1.e7
,
0
,
1.e7
});
Layer
vacuum_layer
(
HomogeneousMaterial
(
"Vacuum"
,
0.0
,
0.0
));
Layer
substr_layer_scalar
(
substr_material_scalar
);
...
...
@@ -40,21 +40,23 @@ SpecularMagneticConsistencyTest::sample_1() {
return
sample_scalar
;
}
template
<
typename
Strategy1
,
typename
Strategy2
>
void
SpecularMagneticConsistencyTest
::
testcase
(
const
std
::
vector
<
Slice
>
&
slices
,
double
k
){
template
<
typename
Strategy1
,
typename
Strategy2
>
void
SpecularMagneticConsistencyTest
::
testcase
(
const
std
::
vector
<
Slice
>&
slices
,
double
k
)
{
const
auto
kz
=
kvector_t
{
0.
,
0.
,
k
};
const
auto
coeffs1
=
std
::
make_unique
<
Strategy1
>
()
->
Execute
(
slices
,
KzComputation
::
computeKzFromRefIndices
(
slices
,
kz
));
slices
,
KzComputation
::
computeKzFromRefIndices
(
slices
,
kz
));
const
auto
coeffs2
=
std
::
make_unique
<
Strategy2
>
()
->
Execute
(
slices
,
KzComputation
::
computeKzFromRefIndices
(
slices
,
kz
));
slices
,
KzComputation
::
computeKzFromRefIndices
(
slices
,
kz
));
for
(
size_t
i
=
0
;
i
<
coeffs1
.
size
();
++
i
){
for
(
size_t
i
=
0
;
i
<
coeffs1
.
size
();
++
i
)
{
EXPECT_NEAR_MATRIXCOEFF
(
coeffs1
[
i
],
coeffs2
[
i
],
eps
);
}
}
TEST_F
(
SpecularMagneticConsistencyTest
,
z_direction
){
TEST_F
(
SpecularMagneticConsistencyTest
,
z_direction
)
{
using
Strategy1
=
SpecularMagneticTanhStrategy
;
using
Strategy2
=
SpecularMagneticStrategy_v2
;
...
...
@@ -63,7 +65,7 @@ TEST_F(SpecularMagneticConsistencyTest, z_direction){
const
std
::
vector
<
double
>
kzs
=
{
1.e-9
,
1.e-5
,
0.1
,
2.0
,
10.0
};
for
(
const
auto
&
k
:
kzs
){
for
(
const
auto
&
k
:
kzs
)
{
testcase
<
Strategy1
,
Strategy2
>
(
slices
,
k
);
testcase
<
Strategy1
,
Strategy2
>
(
slices
,
-
k
);
}
...
...
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