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
64a2ada1
Commit
64a2ada1
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
IDet: don't use rank
parent
80eea154
No related branches found
No related tags found
1 merge request
!1400
Detectors: take advantage of fixed rank
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Device/Detector/IDetector.cpp
+5
-23
5 additions, 23 deletions
Device/Detector/IDetector.cpp
Device/Detector/RectangularDetector.cpp
+0
-2
0 additions, 2 deletions
Device/Detector/RectangularDetector.cpp
Device/Detector/SphericalDetector.cpp
+0
-2
0 additions, 2 deletions
Device/Detector/SphericalDetector.cpp
with
5 additions
and
27 deletions
Device/Detector/IDetector.cpp
+
5
−
23
View file @
64a2ada1
...
@@ -77,16 +77,15 @@ void IDetector::clear()
...
@@ -77,16 +77,15 @@ void IDetector::clear()
const
IAxis
&
IDetector
::
axis
(
size_t
index
)
const
const
IAxis
&
IDetector
::
axis
(
size_t
index
)
const
{
{
ASSERT
(
index
<
rank
()
);
ASSERT
(
index
<
2
);
return
*
m_axes
[
index
];
return
*
m_axes
[
index
];
}
}
size_t
IDetector
::
axisBinIndex
(
size_t
index
,
size_t
selected_axis
)
const
size_t
IDetector
::
axisBinIndex
(
size_t
index
,
size_t
selected_axis
)
const
{
{
const
size_t
dim
=
rank
();
size_t
remainder
(
index
);
size_t
remainder
(
index
);
size_t
i_axis
=
dim
;
size_t
i_axis
=
2
;
for
(
size_t
i
=
0
;
i
<
dim
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
2
;
++
i
)
{
--
i_axis
;
--
i_axis
;
if
(
selected_axis
==
i_axis
)
if
(
selected_axis
==
i_axis
)
return
remainder
%
m_axes
[
i_axis
]
->
size
();
return
remainder
%
m_axes
[
i_axis
]
->
size
();
...
@@ -109,11 +108,8 @@ size_t IDetector::sizeOfExplicitRegionOfInterest() const
...
@@ -109,11 +108,8 @@ size_t IDetector::sizeOfExplicitRegionOfInterest() const
size_t
IDetector
::
totalSize
()
const
size_t
IDetector
::
totalSize
()
const
{
{
const
size_t
dim
=
rank
();
if
(
dim
==
0
)
return
0
;
size_t
result
=
1
;
size_t
result
=
1
;
for
(
size_t
i_axis
=
0
;
i_axis
<
dim
;
++
i_axis
)
for
(
size_t
i_axis
=
0
;
i_axis
<
2
;
++
i_axis
)
result
*=
m_axes
[
i_axis
]
->
size
();
result
*=
m_axes
[
i_axis
]
->
size
();
return
result
;
return
result
;
}
}
...
@@ -181,11 +177,8 @@ void IDetector::applyDetectorResolution(Datafield* intensity_map) const
...
@@ -181,11 +177,8 @@ void IDetector::applyDetectorResolution(Datafield* intensity_map) const
Datafield
IDetector
::
createDetectorMap
()
const
Datafield
IDetector
::
createDetectorMap
()
const
{
{
const
size_t
dim
=
rank
();
ASSERT
(
dim
!=
0
);
std
::
vector
<
const
IAxis
*>
axes
;
std
::
vector
<
const
IAxis
*>
axes
;
for
(
size_t
iAxis
=
0
;
iAxis
<
dim
;
++
iAxis
)
{
for
(
size_t
iAxis
=
0
;
iAxis
<
2
;
++
iAxis
)
{
IAxis
*
tmp
=
axis
(
iAxis
).
clone
();
IAxis
*
tmp
=
axis
(
iAxis
).
clone
();
tmp
->
clip
(
regionOfInterestBounds
(
iAxis
));
tmp
->
clip
(
regionOfInterestBounds
(
iAxis
));
axes
.
emplace_back
(
tmp
);
axes
.
emplace_back
(
tmp
);
...
@@ -208,18 +201,12 @@ std::vector<const INode*> IDetector::nodeChildren() const
...
@@ -208,18 +201,12 @@ std::vector<const INode*> IDetector::nodeChildren() const
void
IDetector
::
iterateOverRegionOfInterest
(
std
::
function
<
void
(
const_iterator
)
>
func
)
const
void
IDetector
::
iterateOverRegionOfInterest
(
std
::
function
<
void
(
const_iterator
)
>
func
)
const
{
{
if
(
this
->
rank
()
==
0
)
return
;
for
(
auto
it
=
beginRegionOfInterestPoints
();
it
!=
endRegionOfInterestPoints
();
++
it
)
for
(
auto
it
=
beginRegionOfInterestPoints
();
it
!=
endRegionOfInterestPoints
();
++
it
)
func
(
it
);
func
(
it
);
}
}
void
IDetector
::
iterateOverNonMaskedPoints
(
std
::
function
<
void
(
const_iterator
)
>
func
)
const
void
IDetector
::
iterateOverNonMaskedPoints
(
std
::
function
<
void
(
const_iterator
)
>
func
)
const
{
{
if
(
this
->
rank
()
==
0
)
return
;
for
(
auto
it
=
beginNonMaskedPoints
();
it
!=
endNonMaskedPoints
();
++
it
)
for
(
auto
it
=
beginNonMaskedPoints
();
it
!=
endNonMaskedPoints
();
++
it
)
func
(
it
);
func
(
it
);
}
}
...
@@ -290,8 +277,6 @@ IDetector::RoiOfAxis::RoiOfAxis(const IAxis& axis, double _lower, double _upper)
...
@@ -290,8 +277,6 @@ IDetector::RoiOfAxis::RoiOfAxis(const IAxis& axis, double _lower, double _upper)
void
IDetector
::
setRegionOfInterest
(
double
xlow
,
double
ylow
,
double
xup
,
double
yup
)
void
IDetector
::
setRegionOfInterest
(
double
xlow
,
double
ylow
,
double
xup
,
double
yup
)
{
{
ASSERT
(
rank
()
==
2
);
m_explicitROI
.
clear
();
m_explicitROI
.
clear
();
m_explicitROI
.
emplace_back
(
axis
(
0
),
xlow
,
xup
);
m_explicitROI
.
emplace_back
(
axis
(
0
),
xlow
,
xup
);
m_explicitROI
.
emplace_back
(
axis
(
1
),
ylow
,
yup
);
m_explicitROI
.
emplace_back
(
axis
(
1
),
ylow
,
yup
);
...
@@ -313,8 +298,6 @@ void IDetector::addMask(const IShape2D& shape, bool mask_value)
...
@@ -313,8 +298,6 @@ void IDetector::addMask(const IShape2D& shape, bool mask_value)
void
IDetector
::
maskAll
()
void
IDetector
::
maskAll
()
{
{
if
(
rank
()
!=
2
)
return
;
addMask
(
InfinitePlane
(),
true
);
addMask
(
InfinitePlane
(),
true
);
}
}
...
@@ -325,6 +308,5 @@ const DetectorMask* IDetector::detectorMask() const
...
@@ -325,6 +308,5 @@ const DetectorMask* IDetector::detectorMask() const
size_t
IDetector
::
getGlobalIndex
(
size_t
x
,
size_t
y
)
const
size_t
IDetector
::
getGlobalIndex
(
size_t
x
,
size_t
y
)
const
{
{
ASSERT
(
rank
()
==
2
);
return
x
*
axis
(
1
).
size
()
+
y
;
return
x
*
axis
(
1
).
size
()
+
y
;
}
}
This diff is collapsed.
Click to expand it.
Device/Detector/RectangularDetector.cpp
+
0
−
2
View file @
64a2ada1
...
@@ -182,8 +182,6 @@ const IPixel* RectangularDetector::createPixel(size_t index) const
...
@@ -182,8 +182,6 @@ const IPixel* RectangularDetector::createPixel(size_t index) const
// ISSUE #396. cover by test. currently insensitive to change in k_spec.
// ISSUE #396. cover by test. currently insensitive to change in k_spec.
size_t
RectangularDetector
::
indexOfSpecular
(
const
Beam
&
beam
)
const
size_t
RectangularDetector
::
indexOfSpecular
(
const
Beam
&
beam
)
const
{
{
if
(
rank
()
!=
2
)
return
totalSize
();
const
R3
k_spec
=
beam
.
k_reflected
();
const
R3
k_spec
=
beam
.
k_reflected
();
const
R3
normal_unit
=
m_normal_to_detector
.
unit
();
const
R3
normal_unit
=
m_normal_to_detector
.
unit
();
const
double
kd
=
k_spec
.
dot
(
normal_unit
);
const
double
kd
=
k_spec
.
dot
(
normal_unit
);
...
...
This diff is collapsed.
Click to expand it.
Device/Detector/SphericalDetector.cpp
+
0
−
2
View file @
64a2ada1
...
@@ -63,8 +63,6 @@ IPixel* SphericalDetector::createPixel(size_t index) const
...
@@ -63,8 +63,6 @@ IPixel* SphericalDetector::createPixel(size_t index) const
size_t
SphericalDetector
::
indexOfSpecular
(
const
Beam
&
beam
)
const
size_t
SphericalDetector
::
indexOfSpecular
(
const
Beam
&
beam
)
const
{
{
if
(
rank
()
!=
2
)
return
totalSize
();
double
alpha
=
beam
.
alpha_i
();
double
alpha
=
beam
.
alpha_i
();
double
phi
=
beam
.
phi_i
();
double
phi
=
beam
.
phi_i
();
const
IAxis
&
phi_axis
=
axis
(
0
);
const
IAxis
&
phi_axis
=
axis
(
0
);
...
...
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