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
fd56ae8f
Commit
fd56ae8f
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
handle intensity outside DpElement
parent
ef07c834
No related branches found
No related tags found
1 merge request
!1552
Depth probe computation without computation file and without element class
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sim/Simulation/DepthprobeSimulation.cpp
+12
-27
12 additions, 27 deletions
Sim/Simulation/DepthprobeSimulation.cpp
with
12 additions
and
27 deletions
Sim/Simulation/DepthprobeSimulation.cpp
+
12
−
27
View file @
fd56ae8f
...
@@ -89,37 +89,21 @@ public:
...
@@ -89,37 +89,21 @@ public:
,
m_wavelength
(
wavelength
)
,
m_wavelength
(
wavelength
)
,
m_alpha_i
(
alpha_i
)
,
m_alpha_i
(
alpha_i
)
,
m_z_positions
(
z_positions
)
,
m_z_positions
(
z_positions
)
{
ASSERT
(
z_positions
);
m_intensities
.
resize
(
z_positions
->
size
(),
0.0
);
}
double
wavelength
()
const
{
return
m_wavelength
;
}
double
alphaI
()
const
{
return
m_alpha_i
;
}
R3
getKi
()
const
{
return
vecOfLambdaAlphaPhi
(
m_wavelength
,
m_alpha_i
);
}
template
<
typename
T
>
void
setIntensities
(
T
&&
intensities
)
{
{
static_assert
(
ASSERT
(
z_positions
);
std
::
is_assignable
<
std
::
valarray
<
double
>
,
typename
std
::
decay
<
T
>::
type
>::
value
,
"Error in DepthprobeElement::setIntensities: wrong type of input data."
);
m_intensities
=
std
::
forward
<
T
>
(
intensities
);
}
}
const
std
::
valarray
<
double
>&
getIntensities
()
const
{
return
m_intensities
;
}
double
wavelength
()
const
{
return
m_wavelength
;
}
double
alphaI
()
const
{
return
m_alpha_i
;
}
R3
getKi
()
const
{
return
vecOfLambdaAlphaPhi
(
m_wavelength
,
m_alpha_i
);
}
void
setZPositions
(
const
IAxis
*
z_positions
)
{
m_z_positions
=
z_positions
;
}
void
setZPositions
(
const
IAxis
*
z_positions
)
{
m_z_positions
=
z_positions
;
}
const
IAxis
*
getZPositions
()
const
{
return
m_z_positions
;
}
const
IAxis
*
getZPositions
()
const
{
return
m_z_positions
;
}
private
:
private
:
const
double
m_wavelength
;
const
double
m_wavelength
;
const
double
m_alpha_i
;
//!< incident angle of the beam
const
double
m_alpha_i
;
//!< incident angle of the beam
std
::
valarray
<
double
>
m_intensities
;
//!< simulated intensity for the set of z positions
const
IAxis
*
m_z_positions
;
//!< positions (lower z corresponds to a greater depth)
const
IAxis
*
m_z_positions
;
//!< positions (lower z corresponds to a greater depth)
};
};
//<<<<<<<
//<<<<<<<
...
@@ -127,14 +111,15 @@ private:
...
@@ -127,14 +111,15 @@ private:
void
DepthprobeSimulation
::
runComputation
(
const
ReSample
&
re_sample
,
size_t
i
,
double
weight
)
void
DepthprobeSimulation
::
runComputation
(
const
ReSample
&
re_sample
,
size_t
i
,
double
weight
)
{
{
const
double
result_angle
=
m_scan
->
coordinateAxis
()
->
bin
(
i
).
center
()
+
m_scan
->
alphaOffset
();
const
double
result_angle
=
m_scan
->
coordinateAxis
()
->
bin
(
i
).
center
()
+
m_scan
->
alphaOffset
();
const
size_t
n_z
=
m_z_axis
->
size
();
std
::
valarray
<
double
>
intensities
;
//!< simulated intensity for the set of z positions
intensities
.
resize
(
n_z
,
0.0
);
DepthprobeElement
ele
(
m_scan
->
wavelength
(),
-
result_angle
,
m_z_axis
.
get
());
DepthprobeElement
ele
(
m_scan
->
wavelength
(),
-
result_angle
,
m_z_axis
.
get
());
if
(
0
<
result_angle
&&
result_angle
<
M_PI_2
)
{
if
(
0
<
result_angle
&&
result_angle
<
M_PI_2
)
{
const
IAxis
&
z_positions
=
*
ele
.
getZPositions
();
const
IAxis
&
z_positions
=
*
ele
.
getZPositions
();
const
size_t
n_z
=
z_positions
.
size
();
const
size_t
n_layers
=
re_sample
.
numberOfSlices
();
const
size_t
n_layers
=
re_sample
.
numberOfSlices
();
size_t
start_z_ind
=
n_z
;
size_t
start_z_ind
=
n_z
;
std
::
valarray
<
double
>
intensities
(
0.0
,
n_z
);
const
Fluxes
fluxes
=
re_sample
.
fluxesIn
(
ele
.
getKi
());
const
Fluxes
fluxes
=
re_sample
.
fluxesIn
(
ele
.
getKi
());
...
@@ -163,7 +148,6 @@ void DepthprobeSimulation::runComputation(const ReSample& re_sample, size_t i, d
...
@@ -163,7 +148,6 @@ void DepthprobeSimulation::runComputation(const ReSample& re_sample, size_t i, d
}
}
start_z_ind
=
ip1_z
;
start_z_ind
=
ip1_z
;
}
}
ele
.
setIntensities
(
std
::
move
(
intensities
));
}
}
progress
().
incrementDone
(
1
);
progress
().
incrementDone
(
1
);
...
@@ -172,7 +156,8 @@ void DepthprobeSimulation::runComputation(const ReSample& re_sample, size_t i, d
...
@@ -172,7 +156,8 @@ void DepthprobeSimulation::runComputation(const ReSample& re_sample, size_t i, d
double
intensity_factor
=
m_scan
->
intensity
();
double
intensity_factor
=
m_scan
->
intensity
();
if
(
footprint
!=
nullptr
)
if
(
footprint
!=
nullptr
)
intensity_factor
*=
footprint
->
calculate
(
alpha_i
);
intensity_factor
*=
footprint
->
calculate
(
alpha_i
);
ele
.
setIntensities
(
ele
.
getIntensities
()
*
intensity_factor
);
for
(
double
&
v
:
intensities
)
v
*=
intensity_factor
;
if
(
background
())
if
(
background
())
throw
std
::
runtime_error
(
throw
std
::
runtime_error
(
...
@@ -180,7 +165,7 @@ void DepthprobeSimulation::runComputation(const ReSample& re_sample, size_t i, d
...
@@ -180,7 +165,7 @@ void DepthprobeSimulation::runComputation(const ReSample& re_sample, size_t i, d
const
size_t
N1
=
m_z_axis
->
size
();
const
size_t
N1
=
m_z_axis
->
size
();
for
(
size_t
j
=
0
;
j
<
N1
;
++
j
)
for
(
size_t
j
=
0
;
j
<
N1
;
++
j
)
m_cache
[
i
*
N1
+
j
]
+=
ele
.
getI
ntensities
()
[
j
]
*
weight
;
m_cache
[
i
*
N1
+
j
]
+=
i
ntensities
[
j
]
*
weight
;
}
}
//... Overridden getters:
//... Overridden getters:
...
...
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