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
5f506f19
Commit
5f506f19
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
sort SpecSim.cpp
parent
59f5169c
No related branches found
No related tags found
1 merge request
!1270
Sort members in simulation classes; privatize some.
Pipeline
#85674
failed
2 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sim/Simulation/SpecularSimulation.cpp
+33
-29
33 additions, 29 deletions
Sim/Simulation/SpecularSimulation.cpp
with
33 additions
and
29 deletions
Sim/Simulation/SpecularSimulation.cpp
+
33
−
29
View file @
5f506f19
...
@@ -38,23 +38,13 @@ SpecularSimulation::SpecularSimulation(const ISpecularScan& scan, const MultiLay
...
@@ -38,23 +38,13 @@ SpecularSimulation::SpecularSimulation(const ISpecularScan& scan, const MultiLay
SpecularSimulation
::~
SpecularSimulation
()
=
default
;
SpecularSimulation
::~
SpecularSimulation
()
=
default
;
size_t
SpecularSimulation
::
numberOfElements
()
const
{
return
m_scan
->
numberOfElements
();
}
SimulationResult
SpecularSimulation
::
packResult
()
const
{
ASSERT
(
!
m_eles
.
empty
());
Datafield
data
({
m_scan
->
coordinateAxis
()
->
clone
()},
m_scan
->
createIntensities
(
m_eles
));
return
{
data
,
simCoordSystem
()};
}
const
ICoordSystem
*
SpecularSimulation
::
simCoordSystem
()
const
const
ICoordSystem
*
SpecularSimulation
::
simCoordSystem
()
const
{
{
return
m_scan
->
scanCoordSystem
();
return
m_scan
->
scanCoordSystem
();
}
}
//... Overridden executors:
void
SpecularSimulation
::
initElementVector
()
void
SpecularSimulation
::
initElementVector
()
{
{
m_eles
=
m_scan
->
generateElements
();
m_eles
=
m_scan
->
generateElements
();
...
@@ -73,33 +63,21 @@ std::unique_ptr<IComputation> SpecularSimulation::createComputation(const ReSamp
...
@@ -73,33 +63,21 @@ std::unique_ptr<IComputation> SpecularSimulation::createComputation(const ReSamp
begin
+
static_cast
<
long
>
(
n_elements
));
begin
+
static_cast
<
long
>
(
n_elements
));
}
}
void
SpecularSimulation
::
validateParametrization
(
const
ParameterDistribution
&
par_distr
)
const
void
SpecularSimulation
::
normalize
(
size_t
start
,
size_t
n_elements
)
{
const
bool
zero_mean
=
par_distr
.
getDistribution
()
->
mean
()
==
0.0
;
if
(
zero_mean
)
return
;
/* TODO come back to this after refactoring of distribution handling
if (par_distr.whichParameter() == ParameterDistribution::BeamInclinationAngle)
throw std::runtime_error("Error in SpecularSimulation: parameter distribution of "
"beam inclination angle should have zero mean.");
*/
}
void
SpecularSimulation
::
normalize
(
size_t
start_ind
,
size_t
n_elements
)
{
{
std
::
vector
<
double
>
footprints
=
m_scan
->
footprint
(
start
_ind
,
n_elements
);
std
::
vector
<
double
>
footprints
=
m_scan
->
footprint
(
start
,
n_elements
);
for
(
size_t
i
=
start
_ind
,
k
=
0
;
i
<
start
_ind
+
n_elements
;
++
i
,
++
k
)
{
for
(
size_t
i
=
start
,
k
=
0
;
i
<
start
+
n_elements
;
++
i
,
++
k
)
{
auto
&
element
=
m_eles
[
i
];
auto
&
element
=
m_eles
[
i
];
element
.
setIntensity
(
element
.
intensity
()
*
footprints
[
k
]);
element
.
setIntensity
(
element
.
intensity
()
*
footprints
[
k
]);
}
}
}
}
void
SpecularSimulation
::
addBackgroundIntensity
(
size_t
start
_ind
,
size_t
n_elements
)
void
SpecularSimulation
::
addBackgroundIntensity
(
size_t
start
,
size_t
n_elements
)
{
{
if
(
!
background
())
if
(
!
background
())
return
;
return
;
for
(
size_t
i
=
start
_ind
,
stop_point
=
start
_ind
+
n_elements
;
i
<
stop_point
;
++
i
)
{
for
(
size_t
i
=
start
,
stop_point
=
start
+
n_elements
;
i
<
stop_point
;
++
i
)
{
auto
&
element
=
m_eles
[
i
];
auto
&
element
=
m_eles
[
i
];
element
.
setIntensity
(
background
()
->
addBackground
(
element
.
intensity
()));
element
.
setIntensity
(
background
()
->
addBackground
(
element
.
intensity
()));
}
}
...
@@ -121,7 +99,33 @@ void SpecularSimulation::moveDataFromCache()
...
@@ -121,7 +99,33 @@ void SpecularSimulation::moveDataFromCache()
m_cache
.
shrink_to_fit
();
m_cache
.
shrink_to_fit
();
}
}
//... Overridden getters:
bool
SpecularSimulation
::
force_polarized
()
const
bool
SpecularSimulation
::
force_polarized
()
const
{
{
return
m_scan
->
polarized
();
return
m_scan
->
polarized
();
}
}
size_t
SpecularSimulation
::
numberOfElements
()
const
{
return
m_scan
->
numberOfElements
();
}
SimulationResult
SpecularSimulation
::
packResult
()
const
{
ASSERT
(
!
m_eles
.
empty
());
Datafield
data
({
m_scan
->
coordinateAxis
()
->
clone
()},
m_scan
->
createIntensities
(
m_eles
));
return
{
data
,
simCoordSystem
()};
}
void
SpecularSimulation
::
validateParametrization
(
const
ParameterDistribution
&
par_distr
)
const
{
const
bool
zero_mean
=
par_distr
.
getDistribution
()
->
mean
()
==
0.0
;
if
(
zero_mean
)
return
;
/* TODO come back to this after refactoring of distribution handling
if (par_distr.whichParameter() == ParameterDistribution::BeamInclinationAngle)
throw std::runtime_error("Error in SpecularSimulation: parameter distribution of "
"beam inclination angle should have zero mean.");
*/
}
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