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
e74c236a
Commit
e74c236a
authored
8 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
Test fixture for MultiLayerTest.h
parent
8c570c8e
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/1/MultiLayerTest.h
+201
-313
201 additions, 313 deletions
Tests/UnitTests/Core/1/MultiLayerTest.h
with
201 additions
and
313 deletions
Tests/UnitTests/Core/1/MultiLayerTest.h
+
201
−
313
View file @
e74c236a
#ifndef M
ULTI
LAYERTEST_H
#define M
ULTI
LAYERTEST_H
#ifndef MLAYERTEST_H
#define MLAYERTEST_H
#include
"MultiLayer.h"
#include
"BornAgainNamespace.h"
...
...
@@ -12,69 +12,63 @@
class
MultiLayerTest
:
public
::
testing
::
Test
{
protected:
MultiLayerTest
(){}
virtual
~
MultiLayerTest
(){}
MultiLayerTest
()
:
air
(
"air"
,
0
,
1.0
)
,
iron
(
"iron"
,
0
,
1.51
)
,
chromium
(
"chromium"
,
0
,
3.68
)
,
stone
(
"stone"
,
0
,
1.6
)
,
topLayer
(
air
,
0
*
Units
::
nanometer
)
,
layer1
(
iron
,
20
*
Units
::
nanometer
)
,
layer2
(
chromium
,
40
*
Units
::
nanometer
)
,
substrate
(
stone
,
0
*
Units
::
nanometer
)
{}
void
set_four
()
{
mLayer
.
addLayer
(
topLayer
);
mLayer
.
addLayer
(
layer1
);
mLayer
.
addLayer
(
layer2
);
mLayer
.
addLayer
(
substrate
);
}
MultiLayer
mLayer
;
const
HomogeneousMaterial
air
,
iron
,
chromium
,
stone
;
Layer
topLayer
,
layer1
,
layer2
,
substrate
;
};
TEST_F
(
MultiLayerTest
,
BasicProperty
)
{
MultiLayer
multi_layer
;
//check default properties
EXPECT_EQ
(
BornAgain
::
MultiLayerType
,
multi_layer
.
getName
());
EXPECT_EQ
(
0.0
,
multi_layer
.
getCrossCorrLength
());
EXPECT_EQ
(
size_t
(
0
),
multi_layer
.
getNumberOfLayers
());
EXPECT_EQ
(
size_t
(
0
),
multi_layer
.
getNumberOfInterfaces
());
EXPECT_EQ
(
BornAgain
::
MultiLayerType
,
mLayer
.
getName
());
EXPECT_EQ
(
0.0
,
mLayer
.
getCrossCorrLength
());
EXPECT_EQ
(
size_t
(
0
),
mLayer
.
getNumberOfLayers
());
EXPECT_EQ
(
size_t
(
0
),
mLayer
.
getNumberOfInterfaces
());
//set parameter
m
ulti_l
ayer
.
setParameterValue
(
BornAgain
::
CrossCorrelationLength
,
-
2.54
);
EXPECT_EQ
(
-
2.54
,
m
ulti_l
ayer
.
getCrossCorrLength
());
m
L
ayer
.
setParameterValue
(
BornAgain
::
CrossCorrelationLength
,
-
2.54
);
EXPECT_EQ
(
-
2.54
,
m
L
ayer
.
getCrossCorrLength
());
// adding layers
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
HomogeneousMaterial
chromium
(
"chromium"
,
0
,
3.68
);
HomogeneousMaterial
stone
(
"stone"
,
0
,
1.6
);
Layer
airLayer
(
air
,
0
*
Units
::
nanometer
);
Layer
ironLayer
(
iron
,
20
*
Units
::
nanometer
);
Layer
chromiumLayer
(
chromium
,
40
*
Units
::
nanometer
);
Layer
stoneLayer
(
stone
,
0
*
Units
::
nanometer
);
multi_layer
.
addLayer
(
airLayer
);
EXPECT_EQ
(
size_t
(
1
),
multi_layer
.
getNumberOfLayers
());
EXPECT_EQ
(
size_t
(
0
),
multi_layer
.
getNumberOfInterfaces
());
multi_layer
.
addLayer
(
ironLayer
);
multi_layer
.
addLayer
(
chromiumLayer
);
multi_layer
.
addLayer
(
stoneLayer
);
EXPECT_EQ
(
size_t
(
4
),
multi_layer
.
getNumberOfLayers
());
EXPECT_EQ
(
size_t
(
3
),
multi_layer
.
getNumberOfInterfaces
());
mLayer
.
addLayer
(
topLayer
);
EXPECT_EQ
(
size_t
(
1
),
mLayer
.
getNumberOfLayers
());
EXPECT_EQ
(
size_t
(
0
),
mLayer
.
getNumberOfInterfaces
());
mLayer
.
addLayer
(
layer1
);
mLayer
.
addLayer
(
layer2
);
mLayer
.
addLayer
(
substrate
);
EXPECT_EQ
(
size_t
(
4
),
mLayer
.
getNumberOfLayers
());
EXPECT_EQ
(
size_t
(
3
),
mLayer
.
getNumberOfInterfaces
());
}
TEST_F
(
MultiLayerTest
,
LayerThicknesses
)
{
MultiLayer
mLayer
;
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
HomogeneousMaterial
chromium
(
"chromium"
,
0
,
3.68
);
HomogeneousMaterial
stone
(
"stone"
,
0
,
1.6
);
Layer
airLayer
(
air
,
0
*
Units
::
nanometer
);
Layer
ironLayer
(
iron
,
20
*
Units
::
nanometer
);
Layer
chromiumLayer
(
chromium
,
40
*
Units
::
nanometer
);
Layer
stoneLayer
(
stone
,
0
*
Units
::
nanometer
);
mLayer
.
addLayer
(
airLayer
);
mLayer
.
addLayer
(
ironLayer
);
mLayer
.
addLayer
(
chromiumLayer
);
mLayer
.
addLayer
(
stoneLayer
);
set_four
();
//check layer thickness
EXPECT_EQ
(
0.0
,
mLayer
.
getLayerThickness
(
0
));
EXPECT_EQ
(
0.0
,
mLayer
.
getLayerThickness
(
0
));
EXPECT_EQ
(
20.0
,
mLayer
.
getLayerThickness
(
1
));
EXPECT_EQ
(
40.0
,
mLayer
.
getLayerThickness
(
2
));
EXPECT_EQ
(
0.0
,
mLayer
.
getLayerThickness
(
3
));
EXPECT_EQ
(
0.0
,
mLayer
.
getLayerThickness
(
3
));
//check bottomZ value
EXPECT_EQ
(
0.0
,
mLayer
.
getLayerBottomZ
(
0
));
EXPECT_EQ
(
0.0
,
mLayer
.
getLayerBottomZ
(
0
));
EXPECT_EQ
(
-
20.0
,
mLayer
.
getLayerBottomZ
(
1
));
EXPECT_EQ
(
-
60.0
,
mLayer
.
getLayerBottomZ
(
2
));
EXPECT_EQ
(
-
60.0
,
mLayer
.
getLayerBottomZ
(
3
));
...
...
@@ -83,7 +77,7 @@ TEST_F(MultiLayerTest, LayerThicknesses)
mLayer
.
setLayerThickness
(
1
,
45.0
);
EXPECT_EQ
(
45.0
,
mLayer
.
getLayerThickness
(
1
));
EXPECT_EQ
(
0.0
,
mLayer
.
getLayerBottomZ
(
0
));
EXPECT_EQ
(
0.0
,
mLayer
.
getLayerBottomZ
(
0
));
EXPECT_EQ
(
-
45.0
,
mLayer
.
getLayerBottomZ
(
1
));
EXPECT_EQ
(
-
85.0
,
mLayer
.
getLayerBottomZ
(
2
));
EXPECT_EQ
(
-
85.0
,
mLayer
.
getLayerBottomZ
(
3
));
...
...
@@ -91,130 +85,95 @@ TEST_F(MultiLayerTest, LayerThicknesses)
TEST_F
(
MultiLayerTest
,
CheckAllLayers
)
{
MultiLayer
mLayer
;
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
HomogeneousMaterial
chromium
(
"chromium"
,
0
,
3.68
);
HomogeneousMaterial
stone
(
"stone"
,
0
,
1.6
);
Layer
airLayer
(
air
,
0
*
Units
::
nanometer
);
Layer
ironLayer
(
iron
,
20
*
Units
::
nanometer
);
Layer
chromiumLayer
(
chromium
,
40
*
Units
::
nanometer
);
Layer
stoneLayer
(
stone
,
0
*
Units
::
nanometer
);
mLayer
.
addLayer
(
airLayer
);
mLayer
.
addLayer
(
ironLayer
);
mLayer
.
addLayer
(
chromiumLayer
);
mLayer
.
addLayer
(
stoneLayer
);
set_four
();
//check individual layer
const
Layer
*
layer
0
=
mLayer
.
getLayer
(
0
);
EXPECT_EQ
(
BornAgain
::
LayerType
,
layer
0
->
getName
());
EXPECT_EQ
(
0
,
layer
0
->
getThickness
());
EXPECT_EQ
(
air
Layer
.
getMaterial
()
->
getName
(),
layer
0
->
getMaterial
()
->
getName
());
const
Layer
*
layer
1
=
mLayer
.
getLayer
(
1
);
EXPECT_EQ
(
BornAgain
::
LayerType
,
layer
1
->
getName
());
EXPECT_EQ
(
20
,
layer
1
->
getThickness
());
EXPECT_EQ
(
ironL
ayer
.
getMaterial
()
->
getName
(),
layer
1
->
getMaterial
()
->
getName
());
const
Layer
*
layer
2
=
mLayer
.
getLayer
(
2
);
EXPECT_EQ
(
BornAgain
::
LayerType
,
layer
2
->
getName
());
EXPECT_EQ
(
40
,
layer
2
->
getThickness
());
EXPECT_EQ
(
chromiumL
ayer
.
getMaterial
()
->
getName
(),
layer
2
->
getMaterial
()
->
getName
());
const
Layer
*
layer
3
=
mLayer
.
getLayer
(
3
);
EXPECT_EQ
(
BornAgain
::
LayerType
,
layer
3
->
getName
());
EXPECT_EQ
(
0
,
layer
3
->
getThickness
());
EXPECT_EQ
(
s
toneLayer
.
getMaterial
()
->
getName
(),
layer
3
->
getMaterial
()
->
getName
());
const
Layer
*
got
0
=
mLayer
.
getLayer
(
0
);
EXPECT_EQ
(
BornAgain
::
LayerType
,
got
0
->
getName
());
EXPECT_EQ
(
0
,
got
0
->
getThickness
());
EXPECT_EQ
(
top
Layer
.
getMaterial
()
->
getName
(),
got
0
->
getMaterial
()
->
getName
());
const
Layer
*
got
1
=
mLayer
.
getLayer
(
1
);
EXPECT_EQ
(
BornAgain
::
LayerType
,
got
1
->
getName
());
EXPECT_EQ
(
20
,
got
1
->
getThickness
());
EXPECT_EQ
(
l
ayer
1
.
getMaterial
()
->
getName
(),
got
1
->
getMaterial
()
->
getName
());
const
Layer
*
got
2
=
mLayer
.
getLayer
(
2
);
EXPECT_EQ
(
BornAgain
::
LayerType
,
got
2
->
getName
());
EXPECT_EQ
(
40
,
got
2
->
getThickness
());
EXPECT_EQ
(
l
ayer
2
.
getMaterial
()
->
getName
(),
got
2
->
getMaterial
()
->
getName
());
const
Layer
*
got
3
=
mLayer
.
getLayer
(
3
);
EXPECT_EQ
(
BornAgain
::
LayerType
,
got
3
->
getName
());
EXPECT_EQ
(
0
,
got
3
->
getThickness
());
EXPECT_EQ
(
s
ubstrate
.
getMaterial
()
->
getName
(),
got
3
->
getMaterial
()
->
getName
());
}
TEST_F
(
MultiLayerTest
,
LayerInterfaces
)
{
MultiLayer
mLayer
;
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
HomogeneousMaterial
chromium
(
"chromium"
,
0
,
3.68
);
HomogeneousMaterial
stone
(
"stone"
,
0
,
1.6
);
Layer
layer0
(
air
,
0
*
Units
::
nanometer
);
Layer
layer1
(
iron
,
20
*
Units
::
nanometer
);
Layer
layer2
(
chromium
,
40
*
Units
::
nanometer
);
Layer
layer3
(
stone
,
0
*
Units
::
nanometer
);
mLayer
.
addLayer
(
layer0
);
mLayer
.
addLayer
(
layer1
);
mLayer
.
addLayer
(
layer2
);
mLayer
.
addLayer
(
layer3
);
set_four
();
//check interfaces
const
LayerInterface
*
interface0
=
mLayer
.
getLayerInterface
(
0
);
const
LayerInterface
*
interface0
=
mLayer
.
getLayerInterface
(
0
);
EXPECT_TRUE
(
nullptr
!=
interface0
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interface0
->
getName
());
EXPECT_EQ
(
nullptr
,
interface0
->
getRoughness
());
EXPECT_EQ
(
layer0
.
getMaterial
()
->
getName
(),
interface0
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interface0
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
topLayer
.
getMaterial
()
->
getName
(),
interface0
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interface0
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
const
LayerInterface
*
interface1
=
mLayer
.
getLayerInterface
(
1
);
const
LayerInterface
*
interface1
=
mLayer
.
getLayerInterface
(
1
);
EXPECT_TRUE
(
nullptr
!=
interface1
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interface1
->
getName
());
EXPECT_EQ
(
nullptr
,
interface1
->
getRoughness
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interface1
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interface1
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interface1
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interface1
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
const
LayerInterface
*
interface2
=
mLayer
.
getLayerInterface
(
2
);
const
LayerInterface
*
interface2
=
mLayer
.
getLayerInterface
(
2
);
EXPECT_TRUE
(
nullptr
!=
interface2
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interface2
->
getName
());
EXPECT_EQ
(
nullptr
,
interface2
->
getRoughness
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interface2
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer3
.
getMaterial
()
->
getName
(),
interface2
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interface2
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
substrate
.
getMaterial
()
->
getName
(),
interface2
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
//bottom interface
const
LayerInterface
*
interfaceBottom
=
mLayer
.
getLayerBottomInterface
(
0
);
const
LayerInterface
*
interfaceBottom
=
mLayer
.
getLayerBottomInterface
(
0
);
EXPECT_TRUE
(
nullptr
!=
interfaceBottom
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interfaceBottom
->
getName
());
EXPECT_EQ
(
nullptr
,
interfaceBottom
->
getRoughness
());
EXPECT_EQ
(
layer0
.
getMaterial
()
->
getName
(),
interfaceBottom
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interfaceBottom
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
topLayer
.
getMaterial
()
->
getName
(),
interfaceBottom
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interfaceBottom
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
//top interface
const
LayerInterface
*
interfaceTop
=
mLayer
.
getLayerTopInterface
(
3
);
const
LayerInterface
*
interfaceTop
=
mLayer
.
getLayerTopInterface
(
3
);
EXPECT_TRUE
(
nullptr
!=
interfaceTop
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interfaceTop
->
getName
());
EXPECT_EQ
(
nullptr
,
interfaceTop
->
getRoughness
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interfaceTop
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer3
.
getMaterial
()
->
getName
(),
interfaceTop
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interfaceTop
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
substrate
.
getMaterial
()
->
getName
(),
interfaceTop
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
//null interface
const
LayerInterface
*
interfaceTopNull
=
mLayer
.
getLayerTopInterface
(
0
);
const
LayerInterface
*
interfaceTopNull
=
mLayer
.
getLayerTopInterface
(
0
);
EXPECT_TRUE
(
nullptr
==
interfaceTopNull
);
const
LayerInterface
*
interfaceBottomNull
=
mLayer
.
getLayerBottomInterface
(
3
);
const
LayerInterface
*
interfaceBottomNull
=
mLayer
.
getLayerBottomInterface
(
3
);
EXPECT_TRUE
(
nullptr
==
interfaceBottomNull
);
}
TEST_F
(
MultiLayerTest
,
Clone
)
{
MultiLayer
mLayer
;
set_four
()
;
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
HomogeneousMaterial
chromium
(
"chromium"
,
0
,
3.68
);
HomogeneousMaterial
stone
(
"stone"
,
0
,
1.6
);
Layer
layer0
(
air
,
0
*
Units
::
nanometer
);
Layer
layer1
(
iron
,
20
*
Units
::
nanometer
);
Layer
layer2
(
chromium
,
40
*
Units
::
nanometer
);
Layer
layer3
(
stone
,
0
*
Units
::
nanometer
);
mLayer
.
addLayer
(
layer0
);
mLayer
.
addLayer
(
layer1
);
mLayer
.
addLayer
(
layer2
);
mLayer
.
addLayer
(
layer3
);
MultiLayer
*
mLayerClone
=
mLayer
.
clone
();
MultiLayer
*
mLayerClone
=
mLayer
.
clone
();
//check properties
EXPECT_EQ
(
BornAgain
::
MultiLayerType
,
mLayerClone
->
getName
());
...
...
@@ -223,10 +182,10 @@ TEST_F(MultiLayerTest, Clone)
EXPECT_EQ
(
size_t
(
3
),
mLayerClone
->
getNumberOfInterfaces
());
//check layer thickness
EXPECT_EQ
(
l
ayer
0
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
0
));
EXPECT_EQ
(
topL
ayer
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
0
));
EXPECT_EQ
(
layer1
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
1
));
EXPECT_EQ
(
layer2
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
2
));
EXPECT_EQ
(
layer3
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
3
));
EXPECT_EQ
(
substrate
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
3
));
//check bottomZ value
EXPECT_EQ
(
mLayer
.
getLayerBottomZ
(
0
),
mLayerClone
->
getLayerBottomZ
(
0
));
...
...
@@ -235,69 +194,69 @@ TEST_F(MultiLayerTest, Clone)
EXPECT_EQ
(
mLayer
.
getLayerBottomZ
(
3
),
mLayerClone
->
getLayerBottomZ
(
3
));
//check individual layer
const
Layer
*
layerCopy0
=
mLayerClone
->
getLayer
(
0
);
EXPECT_EQ
(
l
ayer
0
.
getName
(),
layerCopy0
->
getName
());
EXPECT_EQ
(
l
ayer
0
.
getThickness
(),
layerCopy0
->
getThickness
());
EXPECT_EQ
(
l
ayer
0
.
getMaterial
()
->
getName
(),
layerCopy0
->
getMaterial
()
->
getName
());
const
Layer
*
layerCopy0
=
mLayerClone
->
getLayer
(
0
);
EXPECT_EQ
(
topL
ayer
.
getName
(),
layerCopy0
->
getName
());
EXPECT_EQ
(
topL
ayer
.
getThickness
(),
layerCopy0
->
getThickness
());
EXPECT_EQ
(
topL
ayer
.
getMaterial
()
->
getName
(),
layerCopy0
->
getMaterial
()
->
getName
());
const
Layer
*
layerCopy1
=
mLayerClone
->
getLayer
(
1
);
const
Layer
*
layerCopy1
=
mLayerClone
->
getLayer
(
1
);
EXPECT_EQ
(
layer1
.
getName
(),
layerCopy1
->
getName
());
EXPECT_EQ
(
layer1
.
getThickness
(),
layerCopy1
->
getThickness
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
layerCopy1
->
getMaterial
()
->
getName
());
const
Layer
*
layerCopy2
=
mLayerClone
->
getLayer
(
2
);
const
Layer
*
layerCopy2
=
mLayerClone
->
getLayer
(
2
);
EXPECT_EQ
(
layer2
.
getName
(),
layerCopy2
->
getName
());
EXPECT_EQ
(
layer2
.
getThickness
(),
layerCopy2
->
getThickness
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
layerCopy2
->
getMaterial
()
->
getName
());
const
Layer
*
layerCopy3
=
mLayerClone
->
getLayer
(
3
);
EXPECT_EQ
(
layer3
.
getName
(),
layerCopy3
->
getName
());
EXPECT_EQ
(
layer3
.
getThickness
(),
layerCopy3
->
getThickness
());
EXPECT_EQ
(
layer3
.
getMaterial
()
->
getName
(),
layerCopy3
->
getMaterial
()
->
getName
());
const
Layer
*
layerCopy3
=
mLayerClone
->
getLayer
(
3
);
EXPECT_EQ
(
substrate
.
getName
(),
layerCopy3
->
getName
());
EXPECT_EQ
(
substrate
.
getThickness
(),
layerCopy3
->
getThickness
());
EXPECT_EQ
(
substrate
.
getMaterial
()
->
getName
(),
layerCopy3
->
getMaterial
()
->
getName
());
//check interfaces
const
LayerInterface
*
interface0
=
mLayerClone
->
getLayerInterface
(
0
);
const
LayerInterface
*
interface0
=
mLayerClone
->
getLayerInterface
(
0
);
EXPECT_TRUE
(
nullptr
!=
interface0
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interface0
->
getName
());
EXPECT_EQ
(
nullptr
,
interface0
->
getRoughness
());
EXPECT_EQ
(
l
ayer
0
.
getMaterial
()
->
getName
(),
interface0
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
topL
ayer
.
getMaterial
()
->
getName
(),
interface0
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interface0
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
const
LayerInterface
*
interface1
=
mLayerClone
->
getLayerInterface
(
1
);
const
LayerInterface
*
interface1
=
mLayerClone
->
getLayerInterface
(
1
);
EXPECT_TRUE
(
nullptr
!=
interface1
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interface1
->
getName
());
EXPECT_EQ
(
nullptr
,
interface1
->
getRoughness
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interface1
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interface1
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
const
LayerInterface
*
interface2
=
mLayerClone
->
getLayerInterface
(
2
);
const
LayerInterface
*
interface2
=
mLayerClone
->
getLayerInterface
(
2
);
EXPECT_TRUE
(
nullptr
!=
interface2
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interface2
->
getName
());
EXPECT_EQ
(
nullptr
,
interface2
->
getRoughness
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interface2
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer3
.
getMaterial
()
->
getName
(),
interface2
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
substrate
.
getMaterial
()
->
getName
(),
interface2
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
//top interface
const
LayerInterface
*
interfaceBottom
=
mLayerClone
->
getLayerTopInterface
(
1
);
const
LayerInterface
*
interfaceBottom
=
mLayerClone
->
getLayerTopInterface
(
1
);
EXPECT_TRUE
(
nullptr
!=
interfaceBottom
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interfaceBottom
->
getName
());
EXPECT_EQ
(
nullptr
,
interfaceBottom
->
getRoughness
());
EXPECT_EQ
(
l
ayer
0
.
getMaterial
()
->
getName
(),
interfaceBottom
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
topL
ayer
.
getMaterial
()
->
getName
(),
interfaceBottom
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interfaceBottom
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
//Bottom interface
const
LayerInterface
*
interfaceTop
=
mLayerClone
->
getLayerBottomInterface
(
2
);
const
LayerInterface
*
interfaceTop
=
mLayerClone
->
getLayerBottomInterface
(
2
);
EXPECT_TRUE
(
nullptr
!=
interfaceTop
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interfaceTop
->
getName
());
EXPECT_EQ
(
nullptr
,
interfaceTop
->
getRoughness
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interfaceTop
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer3
.
getMaterial
()
->
getName
(),
interfaceTop
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
substrate
.
getMaterial
()
->
getName
(),
interfaceTop
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
//null interface
const
LayerInterface
*
interfaceTopNull
=
mLayerClone
->
getLayerTopInterface
(
0
);
const
LayerInterface
*
interfaceTopNull
=
mLayerClone
->
getLayerTopInterface
(
0
);
EXPECT_TRUE
(
nullptr
==
interfaceTopNull
);
const
LayerInterface
*
interfaceBottomNull
=
mLayerClone
->
getLayerBottomInterface
(
3
);
const
LayerInterface
*
interfaceBottomNull
=
mLayerClone
->
getLayerBottomInterface
(
3
);
EXPECT_TRUE
(
nullptr
==
interfaceBottomNull
);
delete
mLayerClone
;
...
...
@@ -305,24 +264,9 @@ TEST_F(MultiLayerTest, Clone)
TEST_F
(
MultiLayerTest
,
CloneInvertB
)
{
MultiLayer
mLayer
;
set_four
()
;
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
HomogeneousMaterial
chromium
(
"chromium"
,
0
,
3.68
);
HomogeneousMaterial
stone
(
"stone"
,
0
,
1.6
);
Layer
layer0
(
air
,
0
*
Units
::
nanometer
);
Layer
layer1
(
iron
,
20
*
Units
::
nanometer
);
Layer
layer2
(
chromium
,
40
*
Units
::
nanometer
);
Layer
layer3
(
stone
,
0
*
Units
::
nanometer
);
mLayer
.
addLayer
(
layer0
);
mLayer
.
addLayer
(
layer1
);
mLayer
.
addLayer
(
layer2
);
mLayer
.
addLayer
(
layer3
);
MultiLayer
*
mLayerClone
=
mLayer
.
cloneInvertB
();
MultiLayer
*
mLayerClone
=
mLayer
.
cloneInvertB
();
//check properties
EXPECT_EQ
(
BornAgain
::
MultiLayerType
,
mLayerClone
->
getName
());
...
...
@@ -331,10 +275,10 @@ TEST_F(MultiLayerTest, CloneInvertB)
EXPECT_EQ
(
size_t
(
3
),
mLayerClone
->
getNumberOfInterfaces
());
//check layer thickness
EXPECT_EQ
(
l
ayer
0
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
0
));
EXPECT_EQ
(
topL
ayer
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
0
));
EXPECT_EQ
(
layer1
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
1
));
EXPECT_EQ
(
layer2
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
2
));
EXPECT_EQ
(
layer3
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
3
));
EXPECT_EQ
(
substrate
.
getThickness
(),
mLayerClone
->
getLayerThickness
(
3
));
//check bottomZ value
EXPECT_EQ
(
mLayer
.
getLayerBottomZ
(
0
),
mLayerClone
->
getLayerBottomZ
(
0
));
...
...
@@ -343,69 +287,69 @@ TEST_F(MultiLayerTest, CloneInvertB)
EXPECT_EQ
(
mLayer
.
getLayerBottomZ
(
3
),
mLayerClone
->
getLayerBottomZ
(
3
));
//check individual layer
const
Layer
*
layerCopy0
=
mLayerClone
->
getLayer
(
0
);
EXPECT_EQ
(
l
ayer
0
.
getName
(),
layerCopy0
->
getName
());
EXPECT_EQ
(
l
ayer
0
.
getThickness
(),
layerCopy0
->
getThickness
());
EXPECT_EQ
(
l
ayer
0
.
getMaterial
()
->
getName
(),
layerCopy0
->
getMaterial
()
->
getName
());
const
Layer
*
layerCopy0
=
mLayerClone
->
getLayer
(
0
);
EXPECT_EQ
(
topL
ayer
.
getName
(),
layerCopy0
->
getName
());
EXPECT_EQ
(
topL
ayer
.
getThickness
(),
layerCopy0
->
getThickness
());
EXPECT_EQ
(
topL
ayer
.
getMaterial
()
->
getName
(),
layerCopy0
->
getMaterial
()
->
getName
());
const
Layer
*
layerCopy1
=
mLayerClone
->
getLayer
(
1
);
const
Layer
*
layerCopy1
=
mLayerClone
->
getLayer
(
1
);
EXPECT_EQ
(
layer1
.
getName
(),
layerCopy1
->
getName
());
EXPECT_EQ
(
layer1
.
getThickness
(),
layerCopy1
->
getThickness
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
layerCopy1
->
getMaterial
()
->
getName
());
const
Layer
*
layerCopy2
=
mLayerClone
->
getLayer
(
2
);
const
Layer
*
layerCopy2
=
mLayerClone
->
getLayer
(
2
);
EXPECT_EQ
(
layer2
.
getName
(),
layerCopy2
->
getName
());
EXPECT_EQ
(
layer2
.
getThickness
(),
layerCopy2
->
getThickness
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
layerCopy2
->
getMaterial
()
->
getName
());
const
Layer
*
layerCopy3
=
mLayerClone
->
getLayer
(
3
);
EXPECT_EQ
(
layer3
.
getName
(),
layerCopy3
->
getName
());
EXPECT_EQ
(
layer3
.
getThickness
(),
layerCopy3
->
getThickness
());
EXPECT_EQ
(
layer3
.
getMaterial
()
->
getName
(),
layerCopy3
->
getMaterial
()
->
getName
());
const
Layer
*
layerCopy3
=
mLayerClone
->
getLayer
(
3
);
EXPECT_EQ
(
substrate
.
getName
(),
layerCopy3
->
getName
());
EXPECT_EQ
(
substrate
.
getThickness
(),
layerCopy3
->
getThickness
());
EXPECT_EQ
(
substrate
.
getMaterial
()
->
getName
(),
layerCopy3
->
getMaterial
()
->
getName
());
//check interfaces
const
LayerInterface
*
interface0
=
mLayerClone
->
getLayerInterface
(
0
);
const
LayerInterface
*
interface0
=
mLayerClone
->
getLayerInterface
(
0
);
EXPECT_TRUE
(
nullptr
!=
interface0
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interface0
->
getName
());
EXPECT_EQ
(
nullptr
,
interface0
->
getRoughness
());
EXPECT_EQ
(
l
ayer
0
.
getMaterial
()
->
getName
(),
interface0
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
topL
ayer
.
getMaterial
()
->
getName
(),
interface0
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interface0
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
const
LayerInterface
*
interface1
=
mLayerClone
->
getLayerInterface
(
1
);
const
LayerInterface
*
interface1
=
mLayerClone
->
getLayerInterface
(
1
);
EXPECT_TRUE
(
nullptr
!=
interface1
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interface1
->
getName
());
EXPECT_EQ
(
nullptr
,
interface1
->
getRoughness
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interface1
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interface1
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
const
LayerInterface
*
interface2
=
mLayerClone
->
getLayerInterface
(
2
);
const
LayerInterface
*
interface2
=
mLayerClone
->
getLayerInterface
(
2
);
EXPECT_TRUE
(
nullptr
!=
interface2
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interface2
->
getName
());
EXPECT_EQ
(
nullptr
,
interface2
->
getRoughness
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interface2
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer3
.
getMaterial
()
->
getName
(),
interface2
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
substrate
.
getMaterial
()
->
getName
(),
interface2
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
//top interface
const
LayerInterface
*
interfaceBottom
=
mLayerClone
->
getLayerTopInterface
(
1
);
const
LayerInterface
*
interfaceBottom
=
mLayerClone
->
getLayerTopInterface
(
1
);
EXPECT_TRUE
(
nullptr
!=
interfaceBottom
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interfaceBottom
->
getName
());
EXPECT_EQ
(
nullptr
,
interfaceBottom
->
getRoughness
());
EXPECT_EQ
(
l
ayer
0
.
getMaterial
()
->
getName
(),
interfaceBottom
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
topL
ayer
.
getMaterial
()
->
getName
(),
interfaceBottom
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer1
.
getMaterial
()
->
getName
(),
interfaceBottom
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
//Bottom interface
const
LayerInterface
*
interfaceTop
=
mLayerClone
->
getLayerBottomInterface
(
2
);
const
LayerInterface
*
interfaceTop
=
mLayerClone
->
getLayerBottomInterface
(
2
);
EXPECT_TRUE
(
nullptr
!=
interfaceTop
);
EXPECT_EQ
(
BornAgain
::
LayerInterfaceType
,
interfaceTop
->
getName
());
EXPECT_EQ
(
nullptr
,
interfaceTop
->
getRoughness
());
EXPECT_EQ
(
layer2
.
getMaterial
()
->
getName
(),
interfaceTop
->
getLayerTop
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
layer3
.
getMaterial
()
->
getName
(),
interfaceTop
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
EXPECT_EQ
(
substrate
.
getMaterial
()
->
getName
(),
interfaceTop
->
getLayerBottom
()
->
getMaterial
()
->
getName
());
//null interface
const
LayerInterface
*
interfaceTopNull
=
mLayerClone
->
getLayerTopInterface
(
0
);
const
LayerInterface
*
interfaceTopNull
=
mLayerClone
->
getLayerTopInterface
(
0
);
EXPECT_TRUE
(
nullptr
==
interfaceTopNull
);
const
LayerInterface
*
interfaceBottomNull
=
mLayerClone
->
getLayerBottomInterface
(
3
);
const
LayerInterface
*
interfaceBottomNull
=
mLayerClone
->
getLayerBottomInterface
(
3
);
EXPECT_TRUE
(
nullptr
==
interfaceBottomNull
);
delete
mLayerClone
;
...
...
@@ -413,27 +357,17 @@ TEST_F(MultiLayerTest, CloneInvertB)
TEST_F
(
MultiLayerTest
,
WithRoughness
)
{
MultiLayer
mLayer
;
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
HomogeneousMaterial
stone
(
"stone"
,
0
,
1.6
);
Layer
layer0
(
air
,
0
*
Units
::
nanometer
);
Layer
layer1
(
iron
,
20
*
Units
::
nanometer
);
Layer
layer2
(
stone
,
0
*
Units
::
nanometer
);
//LayerRoughness(double sigma, double hurstParameter, double latteralCorrLength);
LayerRoughness
lr
(
1.1
,
-
7.3
,
0.1
);
mLayer
.
addLayer
(
l
ayer
0
);
mLayer
.
addLayer
(
topL
ayer
);
mLayer
.
addLayerWithTopRoughness
(
layer1
,
lr
);
mLayer
.
addLayer
(
layer2
);
mLayer
.
addLayer
(
substrate
);
const
LayerInterface
*
interface0
=
mLayer
.
getLayerInterface
(
0
);
const
LayerInterface
*
interface1
=
mLayer
.
getLayerInterface
(
1
);
const
LayerInterface
*
interface0
=
mLayer
.
getLayerInterface
(
0
);
const
LayerInterface
*
interface1
=
mLayer
.
getLayerInterface
(
1
);
const
LayerRoughness
*
roughness0
=
interface0
->
getRoughness
();
const
LayerRoughness
*
roughness1
=
interface1
->
getRoughness
();
const
LayerRoughness
*
roughness0
=
interface0
->
getRoughness
();
const
LayerRoughness
*
roughness1
=
interface1
->
getRoughness
();
EXPECT_TRUE
(
roughness0
);
EXPECT_EQ
(
nullptr
,
roughness1
);
...
...
@@ -445,54 +379,36 @@ TEST_F(MultiLayerTest, WithRoughness)
TEST_F
(
MultiLayerTest
,
CloneWithRoughness
)
{
MultiLayer
mLayer
;
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
HomogeneousMaterial
stone
(
"stone"
,
0
,
1.6
);
Layer
layer0
(
air
,
0
*
Units
::
nanometer
);
Layer
layer1
(
iron
,
20
*
Units
::
nanometer
);
Layer
layer2
(
stone
,
0
*
Units
::
nanometer
);
//LayerRoughness(double sigma, double hurstParameter, double latteralCorrLength);
LayerRoughness
lr0
(
-
2.1
,
7.3
,
-
12.1
);
LayerRoughness
lr1
(
1.1
,
-
7.3
,
0.1
);
mLayer
.
addLayer
(
l
ayer
0
);
mLayer
.
addLayer
(
topL
ayer
);
mLayer
.
addLayerWithTopRoughness
(
layer1
,
lr0
);
mLayer
.
addLayerWithTopRoughness
(
layer2
,
lr1
);
mLayer
.
addLayerWithTopRoughness
(
substrate
,
lr1
);
MultiLayer
*
mLayerClone
=
mLayer
.
clone
();
MultiLayer
*
mLayerClone
=
mLayer
.
clone
();
const
LayerInterface
*
interface0
=
mLayerClone
->
getLayerInterface
(
0
);
const
LayerInterface
*
interface1
=
mLayerClone
->
getLayerInterface
(
1
);
const
LayerRoughness
*
roughness0
=
interface0
->
getRoughness
();
const
LayerRoughness
*
roughness1
=
interface1
->
getRoughness
();
const
LayerInterface
*
interface0
=
mLayerClone
->
getLayerInterface
(
0
);
const
LayerInterface
*
interface1
=
mLayerClone
->
getLayerInterface
(
1
);
const
LayerRoughness
*
roughness0
=
interface0
->
getRoughness
();
const
LayerRoughness
*
roughness1
=
interface1
->
getRoughness
();
EXPECT_TRUE
(
roughness0
);
EXPECT_TRUE
(
roughness1
);
EXPECT_EQ
(
-
2.1
,
roughness0
->
getSigma
());
EXPECT_EQ
(
7.3
,
roughness0
->
getHurstParameter
());
EXPECT_EQ
(
-
2.1
,
roughness0
->
getSigma
());
EXPECT_EQ
(
7.3
,
roughness0
->
getHurstParameter
());
EXPECT_EQ
(
-
12.1
,
roughness0
->
getLatteralCorrLength
());
EXPECT_EQ
(
1.1
,
roughness1
->
getSigma
());
EXPECT_EQ
(
-
7.3
,
roughness1
->
getHurstParameter
());
EXPECT_EQ
(
0.1
,
roughness1
->
getLatteralCorrLength
());
EXPECT_EQ
(
1.1
,
roughness1
->
getSigma
());
EXPECT_EQ
(
-
7.3
,
roughness1
->
getHurstParameter
());
EXPECT_EQ
(
0.1
,
roughness1
->
getLatteralCorrLength
());
delete
mLayerClone
;
}
TEST_F
(
MultiLayerTest
,
CloneInvertBWithRoughness
)
{
MultiLayer
mLayer
;
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
HomogeneousMaterial
stone
(
"stone"
,
0
,
1.6
);
Layer
layer0
(
air
,
0
*
Units
::
nanometer
);
Layer
layer1
(
iron
,
20
*
Units
::
nanometer
);
Layer
layer2
(
stone
,
5
*
Units
::
nanometer
);
...
...
@@ -500,47 +416,40 @@ TEST_F(MultiLayerTest, CloneInvertBWithRoughness)
LayerRoughness
lr0
(
-
2.1
,
7.3
,
-
12.1
);
LayerRoughness
lr1
(
1.1
,
-
7.3
,
0.1
);
mLayer
.
addLayer
(
l
ayer
0
);
mLayer
.
addLayer
(
topL
ayer
);
mLayer
.
addLayerWithTopRoughness
(
layer1
,
lr0
);
mLayer
.
addLayerWithTopRoughness
(
layer2
,
lr1
);
MultiLayer
*
mLayerClone
=
mLayer
.
cloneInvertB
();
MultiLayer
*
mLayerClone
=
mLayer
.
cloneInvertB
();
const
LayerInterface
*
interface0
=
mLayerClone
->
getLayerInterface
(
0
);
const
LayerInterface
*
interface1
=
mLayerClone
->
getLayerInterface
(
1
);
const
LayerRoughness
*
roughness0
=
interface0
->
getRoughness
();
const
LayerRoughness
*
roughness1
=
interface1
->
getRoughness
();
const
LayerInterface
*
interface0
=
mLayerClone
->
getLayerInterface
(
0
);
const
LayerInterface
*
interface1
=
mLayerClone
->
getLayerInterface
(
1
);
const
LayerRoughness
*
roughness0
=
interface0
->
getRoughness
();
const
LayerRoughness
*
roughness1
=
interface1
->
getRoughness
();
EXPECT_EQ
(
-
2.1
,
roughness0
->
getSigma
());
EXPECT_EQ
(
7.3
,
roughness0
->
getHurstParameter
());
EXPECT_EQ
(
-
2.1
,
roughness0
->
getSigma
());
EXPECT_EQ
(
7.3
,
roughness0
->
getHurstParameter
());
EXPECT_EQ
(
-
12.1
,
roughness0
->
getLatteralCorrLength
());
EXPECT_EQ
(
1.1
,
roughness1
->
getSigma
());
EXPECT_EQ
(
-
7.3
,
roughness1
->
getHurstParameter
());
EXPECT_EQ
(
0.1
,
roughness1
->
getLatteralCorrLength
());
EXPECT_EQ
(
1.1
,
roughness1
->
getSigma
());
EXPECT_EQ
(
-
7.3
,
roughness1
->
getHurstParameter
());
EXPECT_EQ
(
0.1
,
roughness1
->
getLatteralCorrLength
());
delete
mLayerClone
;
}
TEST_F
(
MultiLayerTest
,
WithMagneticMaterial
)
{
MultiLayer
mLayer
;
kvector_t
magnetic_field
(
0.0
,
0.0
,
0.0
);
HomogeneousMagneticMaterial
magMaterial0
(
"MagMat0"
,
6e-4
,
2e-8
,
magnetic_field
);
HomogeneousMagneticMaterial
magMaterial1
(
"MagMat1"
,
-
5.6
,
10
,
magnetic_field
);
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
HomogeneousMaterial
stone
(
"stone"
,
0
,
1.6
);
Layer
layer0
(
air
,
0
*
Units
::
nanometer
);
Layer
layer1
(
iron
,
20
*
Units
::
nanometer
);
Layer
layer2
(
stone
,
30
*
Units
::
nanometer
);
Layer
layer3
(
magMaterial0
,
20
*
Units
::
nanometer
);
Layer
layer4
(
magMaterial1
,
0
*
Units
::
nanometer
);
mLayer
.
addLayer
(
l
ayer
0
);
mLayer
.
addLayer
(
topL
ayer
);
mLayer
.
addLayer
(
layer1
);
mLayer
.
addLayer
(
layer2
);
EXPECT_FALSE
(
mLayer
.
containsMagneticMaterial
());
...
...
@@ -552,43 +461,33 @@ TEST_F(MultiLayerTest, WithMagneticMaterial)
TEST_F
(
MultiLayerTest
,
CloneWithMagneticMaterial
)
{
MultiLayer
mLayer
;
kvector_t
magnetic_field
(
1.1
,
2.1
,
-
5.1
);
HomogeneousMagneticMaterial
magMaterial0
(
"MagMat0"
,
6e-4
,
2e-8
,
magnetic_field
);
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
Layer
layer0
(
air
,
0
*
Units
::
nanometer
);
Layer
layer1
(
iron
,
20
*
Units
::
nanometer
);
Layer
layer2
(
magMaterial0
,
20
*
Units
::
nanometer
);
mLayer
.
addLayer
(
l
ayer
0
);
mLayer
.
addLayer
(
topL
ayer
);
mLayer
.
addLayer
(
layer1
);
mLayer
.
addLayer
(
layer2
);
MultiLayer
*
mLayerClone
=
mLayer
.
clone
();
MultiLayer
*
mLayerClone
=
mLayer
.
clone
();
EXPECT_TRUE
(
mLayerClone
->
containsMagneticMaterial
());
delete
mLayerClone
;
}
TEST_F
(
MultiLayerTest
,
CloneInvertBMagneticMaterial
)
{
MultiLayer
mLayer
;
kvector_t
magnetic_field
(
0.0
,
0.0
,
0.0
);
HomogeneousMagneticMaterial
magMaterial0
(
"MagMat0"
,
6e-4
,
2e-8
,
magnetic_field
);
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
Layer
layer0
(
air
,
0
*
Units
::
nanometer
);
Layer
layer1
(
iron
,
20
*
Units
::
nanometer
);
Layer
layer2
(
magMaterial0
,
20
*
Units
::
nanometer
);
mLayer
.
addLayer
(
l
ayer
0
);
mLayer
.
addLayer
(
topL
ayer
);
mLayer
.
addLayer
(
layer1
);
mLayer
.
addLayer
(
layer2
);
MultiLayer
*
mLayerClone
=
mLayer
.
cloneInvertB
();
MultiLayer
*
mLayerClone
=
mLayer
.
cloneInvertB
();
EXPECT_TRUE
(
mLayerClone
->
containsMagneticMaterial
());
delete
mLayerClone
;
}
...
...
@@ -596,22 +495,16 @@ TEST_F(MultiLayerTest, CloneInvertBMagneticMaterial)
TEST_F
(
MultiLayerTest
,
MultiLayerCompositeTest
)
{
MultiLayer
mLayer
;
kvector_t
magnetic_field
(
0.0
,
0.0
,
0.0
);
HomogeneousMagneticMaterial
magMaterial0
(
"MagMat0"
,
6e-4
,
2e-8
,
magnetic_field
);
HomogeneousMagneticMaterial
magMaterial1
(
"MagMat1"
,
-
5.6
,
10
,
magnetic_field
);
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
HomogeneousMaterial
iron
(
"iron"
,
0
,
1.51
);
HomogeneousMaterial
stone
(
"stone"
,
0
,
1.6
);
Layer
layer0
(
air
,
0
*
Units
::
nanometer
);
Layer
layer1
(
iron
,
10
*
Units
::
nanometer
);
Layer
layer2
(
magMaterial0
,
20
*
Units
::
nanometer
);
Layer
layer3
(
magMaterial1
,
30
*
Units
::
nanometer
);
Layer
layer4
(
stone
,
40
*
Units
::
nanometer
);
mLayer
.
addLayer
(
l
ayer
0
);
mLayer
.
addLayer
(
topL
ayer
);
mLayer
.
addLayer
(
layer1
);
mLayer
.
addLayer
(
layer2
);
mLayer
.
addLayer
(
layer3
);
...
...
@@ -645,44 +538,39 @@ TEST_F(MultiLayerTest, MultiLayerCompositeTest)
}
}
/*
index_0
----------------- 0.0
index_1
----------------- -10.0
index_2
----------------- -30.0
index_3
----------------- -60.0
index_4
*/
TEST_F
(
MultiLayerTest
,
MultiLayerZtoIndex
)
{
MultiLayer
multilayer
;
HomogeneousMaterial
air
(
"air"
,
0
,
1.0
);
MultiLayer
mLayer
;
Layer
layer0
(
air
,
0
*
Units
::
nanometer
);
// index_0
// ----------------- 0.0
// index_1
// ----------------- -10.0
// index_2
// ----------------- -30.0
// index_3
// ----------------- -60.0
// index_4
Layer
layer1
(
air
,
10
*
Units
::
nanometer
);
Layer
layer2
(
air
,
20
*
Units
::
nanometer
);
Layer
layer3
(
air
,
30
*
Units
::
nanometer
);
Layer
layer4
(
air
,
0
*
Units
::
nanometer
);
m
ultil
ayer
.
addLayer
(
l
ayer
0
);
m
ultil
ayer
.
addLayer
(
layer1
);
m
ultil
ayer
.
addLayer
(
layer2
);
m
ultil
ayer
.
addLayer
(
layer3
);
m
ultil
ayer
.
addLayer
(
layer4
);
EXPECT_EQ
(
size_t
(
0
),
m
ultil
ayer
.
zToLayerIndex
(
1.0
));
EXPECT_EQ
(
size_t
(
0
),
m
ultil
ayer
.
zToLayerIndex
(
0.0
));
EXPECT_EQ
(
size_t
(
1
),
m
ultil
ayer
.
zToLayerIndex
(
-
1.0
));
EXPECT_EQ
(
size_t
(
1
),
m
ultil
ayer
.
zToLayerIndex
(
-
9.0
));
EXPECT_EQ
(
size_t
(
1
),
m
ultil
ayer
.
zToLayerIndex
(
-
10.0
));
EXPECT_EQ
(
size_t
(
2
),
m
ultil
ayer
.
zToLayerIndex
(
-
11.0
));
EXPECT_EQ
(
size_t
(
2
),
m
ultil
ayer
.
zToLayerIndex
(
-
30.0
));
EXPECT_EQ
(
size_t
(
3
),
m
ultil
ayer
.
zToLayerIndex
(
-
31.0
));
EXPECT_EQ
(
size_t
(
3
),
m
ultil
ayer
.
zToLayerIndex
(
-
60.0
));
EXPECT_EQ
(
size_t
(
4
),
m
ultil
ayer
.
zToLayerIndex
(
-
61.0
));
m
L
ayer
.
addLayer
(
topL
ayer
);
m
L
ayer
.
addLayer
(
layer1
);
m
L
ayer
.
addLayer
(
layer2
);
m
L
ayer
.
addLayer
(
layer3
);
m
L
ayer
.
addLayer
(
layer4
);
EXPECT_EQ
(
size_t
(
0
),
m
L
ayer
.
zToLayerIndex
(
1.0
));
EXPECT_EQ
(
size_t
(
0
),
m
L
ayer
.
zToLayerIndex
(
0.0
));
EXPECT_EQ
(
size_t
(
1
),
m
L
ayer
.
zToLayerIndex
(
-
1.0
));
EXPECT_EQ
(
size_t
(
1
),
m
L
ayer
.
zToLayerIndex
(
-
9.0
));
EXPECT_EQ
(
size_t
(
1
),
m
L
ayer
.
zToLayerIndex
(
-
10.0
));
EXPECT_EQ
(
size_t
(
2
),
m
L
ayer
.
zToLayerIndex
(
-
11.0
));
EXPECT_EQ
(
size_t
(
2
),
m
L
ayer
.
zToLayerIndex
(
-
30.0
));
EXPECT_EQ
(
size_t
(
3
),
m
L
ayer
.
zToLayerIndex
(
-
31.0
));
EXPECT_EQ
(
size_t
(
3
),
m
L
ayer
.
zToLayerIndex
(
-
60.0
));
EXPECT_EQ
(
size_t
(
4
),
m
L
ayer
.
zToLayerIndex
(
-
61.0
));
}
#endif
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