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
cac460c7
Commit
cac460c7
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
+ Bin1D::clipped_or_nil
parent
2a79d610
No related branches found
No related tags found
1 merge request
!1620
core simplifications, especially detector iterators
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Base/Axis/Bin.cpp
+10
-0
10 additions, 0 deletions
Base/Axis/Bin.cpp
Base/Axis/Bin.h
+4
-0
4 additions, 0 deletions
Base/Axis/Bin.h
with
14 additions
and
0 deletions
Base/Axis/Bin.cpp
+
10
−
0
View file @
cac460c7
...
...
@@ -36,3 +36,13 @@ Bin1D::Bin1D(double lower, double upper)
{
ASSERT
(
m_lower
<=
m_upper
);
}
std
::
optional
<
Bin1D
>
Bin1D
::
clipped_or_nil
(
double
lower
,
double
upper
)
const
{
ASSERT
(
lower
<=
upper
);
if
(
upper
<
m_lower
||
m_upper
<
lower
)
return
{};
if
(
lower
<=
m_lower
&&
m_upper
<=
upper
)
return
*
this
;
return
Bin1D
(
std
::
max
(
lower
,
m_lower
),
std
::
min
(
upper
,
m_upper
));
}
This diff is collapsed.
Click to expand it.
Base/Axis/Bin.h
+
4
−
0
View file @
cac460c7
...
...
@@ -15,6 +15,8 @@
#ifndef BORNAGAIN_BASE_AXIS_BIN_H
#define BORNAGAIN_BASE_AXIS_BIN_H
#include
<optional>
//! An real-valued interval.
class
Bin1D
{
...
...
@@ -30,6 +32,8 @@ public:
bool
operator
==
(
const
Bin1D
&
other
)
const
=
default
;
std
::
optional
<
Bin1D
>
clipped_or_nil
(
double
lower
,
double
upper
)
const
;
private
:
Bin1D
(
double
lower
,
double
upper
);
...
...
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