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
62f35659
Commit
62f35659
authored
7 years ago
by
Yurov, Dmitry
Browse files
Options
Downloads
Patches
Plain Diff
Enabled IDetector in SimulationArea
Redmine: #1895
parent
901cc842
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Core/Instrument/IDetector2D.cpp
+2
-5
2 additions, 5 deletions
Core/Instrument/IDetector2D.cpp
Core/Instrument/SimulationArea.cpp
+13
-11
13 additions, 11 deletions
Core/Instrument/SimulationArea.cpp
Core/Instrument/SimulationArea.h
+6
-5
6 additions, 5 deletions
Core/Instrument/SimulationArea.h
with
21 additions
and
21 deletions
Core/Instrument/IDetector2D.cpp
+
2
−
5
View file @
62f35659
...
...
@@ -147,13 +147,10 @@ SimulationElement IDetector2D::getSimulationElement(size_t index, const Beam &be
size_t
IDetector2D
::
numberOfSimulationElements
()
const
{
size_t
result
(
0
);
try
{
if
(
this
->
dimension
()
!=
0
)
{
SimulationArea
area
(
this
);
for
(
SimulationArea
::
iterator
it
=
area
.
begin
();
it
!=
area
.
end
();
++
it
)
for
(
SimulationArea
::
iterator
it
=
area
.
begin
();
it
!=
area
.
end
();
++
it
)
++
result
;
}
catch
(
Exceptions
::
RuntimeErrorException
e
)
{
(
void
)
e
;
// do nothing, just return zero
}
return
result
;
}
...
...
This diff is collapsed.
Click to expand it.
Core/Instrument/SimulationArea.cpp
+
13
−
11
View file @
62f35659
...
...
@@ -14,25 +14,26 @@
// ************************************************************************** //
#include
"SimulationArea.h"
#include
"IDetector
2D
.h"
#include
"IDetector.h"
#include
"Exceptions.h"
#include
"DetectorMask.h"
#include
"Rectangle.h"
#include
"IntensityDataFunctions.h"
#include
"BornAgainNamespace.h"
#include
"RegionOfInterest.h"
#include
<sstream>
SimulationArea
::
SimulationArea
(
const
IDetector
2D
*
detector
)
SimulationArea
::
SimulationArea
(
const
IDetector
*
detector
)
:
m_detector
(
detector
)
,
m_max_index
(
0
)
{
if
(
m_detector
==
nullptr
)
throw
Exceptions
::
R
untime
E
rror
Exception
(
"SimulationArea::SimulationArea: nullpointer passed"
" as detector"
);
if
(
m_detector
==
nullptr
)
throw
std
::
r
untime
_e
rror
(
"SimulationArea::SimulationArea: null
pointer passed"
" as detector"
);
if
(
m_detector
->
dimension
()
!=
2
)
throw
Exceptions
::
R
untime
E
rror
Exception
(
"SimulationArea::SimulationArea: detector
is not two-
dimensional"
);
if
(
m_detector
->
dimension
()
==
0
)
throw
std
::
r
untime
_e
rror
(
"SimulationArea::SimulationArea: detector
of unspecified
dimensional
ity
"
);
if
(
m_detector
->
regionOfInterest
())
m_max_index
=
m_detector
->
regionOfInterest
()
->
roiSize
();
...
...
@@ -56,10 +57,11 @@ bool SimulationArea::isMasked(size_t index) const
std
::
ostringstream
message
;
message
<<
"SimulationArea::isActive: index "
<<
index
<<
" is out of range, "
<<
"total size = "
<<
totalSize
();
throw
Exceptions
::
R
untime
E
rror
Exception
(
message
.
str
());
throw
std
::
r
untime
_e
rror
(
message
.
str
());
}
return
m_detector
->
detectorMask
()
->
isMasked
(
detectorIndex
(
index
));
return
(
m_detector
->
detectorMask
()
&&
m_detector
->
detectorMask
()
->
isMasked
(
detectorIndex
(
index
)));
}
size_t
SimulationArea
::
roiIndex
(
size_t
index
)
const
...
...
@@ -77,7 +79,7 @@ size_t SimulationArea::detectorIndex(size_t index) const
// --------------------------------------------------------------------------------------
SimulationRoiArea
::
SimulationRoiArea
(
const
IDetector
2D
*
detector
)
SimulationRoiArea
::
SimulationRoiArea
(
const
IDetector
*
detector
)
:
SimulationArea
(
detector
)
{}
...
...
This diff is collapsed.
Click to expand it.
Core/Instrument/SimulationArea.h
+
6
−
5
View file @
62f35659
...
...
@@ -18,7 +18,8 @@
#include
"WinDllMacros.h"
#include
"SimulationAreaIterator.h"
class
IDetector2D
;
class
IDetector
;
//! Holds iteration logic over active detector channels in the presence of masked areas
//! and RegionOfInterest defined.
...
...
@@ -28,13 +29,13 @@ class BA_CORE_API_ SimulationArea
{
public:
using
iterator
=
SimulationAreaIterator
;
explicit
SimulationArea
(
const
IDetector
2D
*
detector
);
explicit
SimulationArea
(
const
IDetector
*
detector
);
virtual
~
SimulationArea
()
{}
SimulationAreaIterator
begin
();
SimulationAreaIterator
end
();
//! returns tru
s
if given iterator index correspond to masked detector channel
//! returns tru
e
if given iterator index correspond to masked detector channel
virtual
bool
isMasked
(
size_t
index
)
const
;
size_t
totalSize
()
const
;
...
...
@@ -46,7 +47,7 @@ public:
size_t
detectorIndex
(
size_t
index
)
const
;
protected
:
const
IDetector
2D
*
m_detector
;
const
IDetector
*
m_detector
;
size_t
m_max_index
;
};
...
...
@@ -63,7 +64,7 @@ inline size_t SimulationArea::totalSize() const
class
BA_CORE_API_
SimulationRoiArea
:
public
SimulationArea
{
public:
explicit
SimulationRoiArea
(
const
IDetector
2D
*
detector
);
explicit
SimulationRoiArea
(
const
IDetector
*
detector
);
virtual
bool
isMasked
(
size_t
)
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