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
1d06a9be
Commit
1d06a9be
authored
7 years ago
by
Yurov, Dmitry
Browse files
Options
Downloads
Patches
Plain Diff
Untie specular simulation from detector axis
parent
30295d46
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/Simulation/SpecularSimulation.cpp
+16
-7
16 additions, 7 deletions
Core/Simulation/SpecularSimulation.cpp
Core/Simulation/SpecularSimulation.h
+2
-0
2 additions, 0 deletions
Core/Simulation/SpecularSimulation.h
with
18 additions
and
7 deletions
Core/Simulation/SpecularSimulation.cpp
+
16
−
7
View file @
1d06a9be
...
@@ -77,11 +77,8 @@ SimulationResult SpecularSimulation::result() const
...
@@ -77,11 +77,8 @@ SimulationResult SpecularSimulation::result() const
{
{
const
size_t
i_layer
=
0
;
// detector intensity is proportional to reflectivity from top layer
const
size_t
i_layer
=
0
;
// detector intensity is proportional to reflectivity from top layer
validityCheck
(
i_layer
);
validityCheck
(
i_layer
);
const
auto
detector
=
SpecDetector
(
m_instrument
);
auto
data
=
createIntensityData
();
auto
data
=
std
::
unique_ptr
<
OutputData
<
double
>>
(
SpecularConverter
converter
(
m_instrument
.
getBeam
(),
*
m_coordinate_axis
);
detector
->
createDetectorIntensity
(
m_sim_elements
,
m_instrument
.
getBeam
()));
auto
&
axis
=
detector
->
getAxis
(
0
);
SpecularConverter
converter
(
m_instrument
.
getBeam
(),
axis
);
return
SimulationResult
(
*
data
,
converter
);
return
SimulationResult
(
*
data
,
converter
);
}
}
...
@@ -119,7 +116,7 @@ void SpecularSimulation::setBeamParameters(double lambda, const IAxis& alpha_axi
...
@@ -119,7 +116,7 @@ void SpecularSimulation::setBeamParameters(double lambda, const IAxis& alpha_axi
void
SpecularSimulation
::
setBeamParameters
(
double
lambda
,
int
nbins
,
double
alpha_i_min
,
void
SpecularSimulation
::
setBeamParameters
(
double
lambda
,
int
nbins
,
double
alpha_i_min
,
double
alpha_i_max
,
const
IFootprintFactor
*
beam_shape
)
double
alpha_i_max
,
const
IFootprintFactor
*
beam_shape
)
{
{
FixedBinAxis
axis
(
"alpha_i"
,
nbins
,
alpha_i_min
,
alpha_i_max
);
FixedBinAxis
axis
(
"alpha_i"
,
static_cast
<
size_t
>
(
nbins
)
,
alpha_i_min
,
alpha_i_max
);
setBeamParameters
(
lambda
,
axis
,
beam_shape
);
setBeamParameters
(
lambda
,
axis
,
beam_shape
);
}
}
...
@@ -133,7 +130,7 @@ const IAxis* SpecularSimulation::getAlphaAxis() const
...
@@ -133,7 +130,7 @@ const IAxis* SpecularSimulation::getAlphaAxis() const
void
SpecularSimulation
::
initSimulationElementVector
()
void
SpecularSimulation
::
initSimulationElementVector
()
{
{
auto
beam
=
m_instrument
.
getBeam
();
const
auto
&
beam
=
m_instrument
.
getBeam
();
m_sim_elements
=
generateSimulationElements
(
beam
);
m_sim_elements
=
generateSimulationElements
(
beam
);
if
(
!
m_cache
.
empty
())
if
(
!
m_cache
.
empty
())
...
@@ -302,6 +299,18 @@ double SpecularSimulation::alpha_i(size_t index) const
...
@@ -302,6 +299,18 @@ double SpecularSimulation::alpha_i(size_t index) const
return
m_coordinate_axis
->
getBin
(
index
).
getMidPoint
();
return
m_coordinate_axis
->
getBin
(
index
).
getMidPoint
();
}
}
std
::
unique_ptr
<
OutputData
<
double
>>
SpecularSimulation
::
createIntensityData
()
const
{
std
::
unique_ptr
<
OutputData
<
double
>>
result
(
new
OutputData
<
double
>
);
result
->
addAxis
(
*
m_coordinate_axis
);
size_t
i
=
0
;
for
(
auto
iter
=
m_sim_elements
.
begin
();
iter
!=
m_sim_elements
.
end
();
++
iter
,
++
i
)
result
->
operator
[](
i
)
=
iter
->
getIntensity
();
return
result
;
}
namespace
namespace
{
{
const
SpecularDetector1D
*
SpecDetector
(
const
Instrument
&
instrument
)
const
SpecularDetector1D
*
SpecDetector
(
const
Instrument
&
instrument
)
...
...
This diff is collapsed.
Click to expand it.
Core/Simulation/SpecularSimulation.h
+
2
−
0
View file @
1d06a9be
...
@@ -103,6 +103,8 @@ private:
...
@@ -103,6 +103,8 @@ private:
double
alpha_i
(
size_t
index
)
const
;
double
alpha_i
(
size_t
index
)
const
;
std
::
unique_ptr
<
OutputData
<
double
>>
createIntensityData
()
const
;
//! Returns vector of reflection coefficients (\f$R\f$) for all alpha_i angles for given layer index.
//! Returns vector of reflection coefficients (\f$R\f$) for all alpha_i angles for given layer index.
//! Deprecated and will be removed.
//! Deprecated and will be removed.
std
::
vector
<
complex_t
>
getScalarR
(
size_t
i_layer
)
const
;
std
::
vector
<
complex_t
>
getScalarR
(
size_t
i_layer
)
const
;
...
...
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