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
408ad5ab
Commit
408ad5ab
authored
7 years ago
by
Yurov, Dmitry
Browse files
Options
Downloads
Patches
Plain Diff
createDetectorIntensity for SpecularSimulationElement (code doubling)
parent
65d2ba1d
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/Instrument/SpecularDetector1D.cpp
+39
-0
39 additions, 0 deletions
Core/Instrument/SpecularDetector1D.cpp
Core/Instrument/SpecularDetector1D.h
+9
-0
9 additions, 0 deletions
Core/Instrument/SpecularDetector1D.h
with
48 additions
and
0 deletions
Core/Instrument/SpecularDetector1D.cpp
+
39
−
0
View file @
408ad5ab
...
...
@@ -15,6 +15,7 @@
#include
"Beam.h"
#include
"DetectorElement.h"
#include
"IPixel.h"
#include
"OutputData.h"
#include
"SimulationArea.h"
#include
"SimulationElement.h"
#include
"SpecularDetector1D.h"
...
...
@@ -143,6 +144,33 @@ std::vector<DetectorElement> SpecularDetector1D::createDetectorElements(const Be
return
result
;
}
OutputData
<
double
>*
SpecularDetector1D
::
createDetectorIntensity
(
const
std
::
vector
<
SpecularSimulationElement
>&
elements
,
const
Beam
&
beam
,
AxesUnits
units_type
)
const
{
std
::
unique_ptr
<
OutputData
<
double
>>
detectorMap
(
createDetectorMap
(
beam
,
units_type
));
if
(
!
detectorMap
)
throw
std
::
runtime_error
(
"Instrument::createDetectorIntensity:"
"can't create detector map."
);
if
(
detectorResolution
())
{
if
(
units_type
!=
AxesUnits
::
DEFAULT
)
{
std
::
unique_ptr
<
OutputData
<
double
>>
defaultMap
(
createDetectorMap
(
beam
,
AxesUnits
::
DEFAULT
));
setDataToDetectorMap
(
*
defaultMap
,
elements
);
applyDetectorResolution
(
defaultMap
.
get
());
detectorMap
->
setRawDataVector
(
defaultMap
->
getRawDataVector
());
}
else
{
setDataToDetectorMap
(
*
detectorMap
,
elements
);
applyDetectorResolution
(
detectorMap
.
get
());
}
}
else
{
setDataToDetectorMap
(
*
detectorMap
,
elements
);
}
return
detectorMap
.
release
();
}
std
::
string
SpecularDetector1D
::
axisName
(
size_t
index
)
const
{
if
(
index
==
0
)
{
...
...
@@ -165,3 +193,14 @@ void SpecularDetector1D::calculateAxisRange(size_t axis_index, const Beam& beam,
IDetector
::
calculateAxisRange
(
axis_index
,
beam
,
units
,
amin
,
amax
);
}
}
void
SpecularDetector1D
::
setDataToDetectorMap
(
OutputData
<
double
>&
detectorMap
,
const
std
::
vector
<
SpecularSimulationElement
>&
elements
)
const
{
if
(
elements
.
empty
())
return
;
SimulationArea
area
(
this
);
for
(
SimulationArea
::
iterator
it
=
area
.
begin
();
it
!=
area
.
end
();
++
it
)
detectorMap
[
it
.
roiIndex
()]
=
elements
[
it
.
elementIndex
()].
getIntensity
();
}
This diff is collapsed.
Click to expand it.
Core/Instrument/SpecularDetector1D.h
+
9
−
0
View file @
408ad5ab
...
...
@@ -45,6 +45,12 @@ public:
std
::
vector
<
DetectorElement
>
createDetectorElements
(
const
Beam
&
beam
)
override
;
#endif // SWIG
using
IDetector
::
createDetectorIntensity
;
//! Returns new intensity map with detector resolution applied and axes in requested units
OutputData
<
double
>*
createDetectorIntensity
(
const
std
::
vector
<
SpecularSimulationElement
>&
elements
,
const
Beam
&
beam
,
AxesUnits
units_type
)
const
;
//! Returns region of interest if exists.
const
RegionOfInterest
*
regionOfInterest
()
const
override
{
return
nullptr
;
}
...
...
@@ -67,6 +73,9 @@ protected:
double
&
amin
,
double
&
amax
)
const
override
;
private
:
void
setDataToDetectorMap
(
OutputData
<
double
>&
detectorMap
,
const
std
::
vector
<
SpecularSimulationElement
>&
elements
)
const
;
double
alphaI
(
size_t
index
)
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