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
ef9d652f
Commit
ef9d652f
authored
5 years ago
by
Beerwerth, Randolf
Browse files
Options
Downloads
Patches
Plain Diff
Move code from namespace into SpecularScalarStrategy
parent
85b5658c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Core/Multilayer/SpecularScalarStrategy.cpp
+11
-23
11 additions, 23 deletions
Core/Multilayer/SpecularScalarStrategy.cpp
Core/Multilayer/SpecularScalarStrategy.h
+18
-0
18 additions, 0 deletions
Core/Multilayer/SpecularScalarStrategy.h
with
29 additions
and
23 deletions
Core/Multilayer/SpecularScalarStrategy.cpp
+
11
−
23
View file @
ef9d652f
...
...
@@ -25,17 +25,6 @@
namespace
{
Eigen
::
Vector2cd
transition
(
complex_t
kzi
,
complex_t
kzi1
,
double
sigma
,
double
thickness
,
const
Eigen
::
Vector2cd
&
t_r1
);
std
::
vector
<
ScalarRTCoefficients
>
computeTR
(
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kz
);
void
setZeroBelow
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
size_t
current_layer
);
bool
calculateUpFromLayer
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kz
,
size_t
layer_index
);
size_t
bisectRTcomputation
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kz
,
const
size_t
lgood
,
const
size_t
lbad
,
const
size_t
l
);
const
LayerRoughness
*
GetBottomRoughness
(
const
std
::
vector
<
Slice
>&
slices
,
const
size_t
slice_index
);
...
...
@@ -62,10 +51,8 @@ SpecularScalarStrategy::Execute(const std::vector<Slice>& slices, const std::vec
return
result
;
}
namespace
{
Eigen
::
Vector2cd
transition
(
complex_t
kzi
,
complex_t
kzi1
,
double
sigma
,
double
thickness
,
const
Eigen
::
Vector2cd
&
t_r1
)
Eigen
::
Vector2cd
SpecularScalarStrategy
::
transition
(
complex_t
kzi
,
complex_t
kzi1
,
double
sigma
,
double
thickness
,
const
Eigen
::
Vector2cd
&
t_r1
)
const
{
complex_t
roughness
=
1
;
if
(
sigma
>
0.0
)
{
...
...
@@ -86,8 +73,8 @@ Eigen::Vector2cd transition(complex_t kzi, complex_t kzi1, double sigma, double
return
result
;
}
std
::
vector
<
ScalarRTCoefficients
>
computeTR
(
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kz
)
std
::
vector
<
ScalarRTCoefficients
>
SpecularScalarStrategy
::
computeTR
(
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kz
)
const
{
const
size_t
N
=
slices
.
size
();
std
::
vector
<
ScalarRTCoefficients
>
coeff
(
N
);
...
...
@@ -136,7 +123,7 @@ std::vector<ScalarRTCoefficients> computeTR(const std::vector<Slice>& slices,
return
coeff
;
}
void
setZeroBelow
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
size_t
current_layer
)
void
SpecularScalarStrategy
::
setZeroBelow
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
size_t
current_layer
)
{
size_t
N
=
coeff
.
size
();
for
(
size_t
i
=
current_layer
+
1
;
i
<
N
;
++
i
)
{
...
...
@@ -144,9 +131,9 @@ void setZeroBelow(std::vector<ScalarRTCoefficients>& coeff, size_t current_layer
}
}
bool
calculateUpFromLayer
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
bool
SpecularScalarStrategy
::
calculateUpFromLayer
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kz
,
size_t
slice_index
)
size_t
slice_index
)
const
{
coeff
[
slice_index
+
1
].
t_r
(
0
)
=
1.0
;
coeff
[
slice_index
+
1
].
t_r
(
1
)
=
0.0
;
...
...
@@ -166,9 +153,9 @@ bool calculateUpFromLayer(std::vector<ScalarRTCoefficients>& coeff,
//! Recursive bisection to determine the number of the deepest layer where RT computation
//! can be started without running into overflow.
//! Computes coeff, and returns largest possible start layer index.
size_t
bisectRTcomputation
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
size_t
SpecularScalarStrategy
::
bisectRTcomputation
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kz
,
const
size_t
lgood
,
const
size_t
lbad
,
const
size_t
l
)
const
size_t
lgood
,
const
size_t
lbad
,
const
size_t
l
)
const
{
if
(
calculateUpFromLayer
(
coeff
,
slices
,
kz
,
l
))
{
// success => highest valid l must be in l..lbad-1
...
...
@@ -187,10 +174,11 @@ size_t bisectRTcomputation(std::vector<ScalarRTCoefficients>& coeff,
}
}
namespace
{
const
LayerRoughness
*
GetBottomRoughness
(
const
std
::
vector
<
Slice
>&
slices
,
const
size_t
slice_index
)
{
if
(
slice_index
+
1
<
slices
.
size
())
return
slices
[
slice_index
+
1
].
topRoughness
();
return
nullptr
;
}
}
// unnamed namespace
}
This diff is collapsed.
Click to expand it.
Core/Multilayer/SpecularScalarStrategy.h
+
18
−
0
View file @
ef9d652f
...
...
@@ -42,6 +42,24 @@ public:
//! Roughness is modelled by tanh profile [see e.g. Phys. Rev. B, vol. 47 (8), p. 4385 (1993)].
virtual
ISpecularStrategy
::
coeffs_t
Execute
(
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kz
)
const
override
;
private:
virtual
Eigen
::
Vector2cd
transition
(
complex_t
kzi
,
complex_t
kzi1
,
double
sigma
,
double
thickness
,
const
Eigen
::
Vector2cd
&
t_r1
)
const
;
std
::
vector
<
ScalarRTCoefficients
>
computeTR
(
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kz
)
const
;
static
void
setZeroBelow
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
size_t
current_layer
);
bool
calculateUpFromLayer
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kz
,
size_t
slice_index
)
const
;
size_t
bisectRTcomputation
(
std
::
vector
<
ScalarRTCoefficients
>&
coeff
,
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kz
,
const
size_t
lgood
,
const
size_t
lbad
,
const
size_t
l
)
const
;
};
#endif // SPECULARSCALARSTRATEGY_H
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