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
a332bede
Commit
a332bede
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
ZLimits inherits from Span
parent
3f221c11
No related branches found
No related tags found
1 merge request
!1174
IFormFactor and children: replace BottomZ, TopZ by spanZ
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Resample/Slice/ZLimits.cpp
+1
-13
1 addition, 13 deletions
Resample/Slice/ZLimits.cpp
Resample/Slice/ZLimits.h
+14
-18
14 additions, 18 deletions
Resample/Slice/ZLimits.h
with
15 additions
and
31 deletions
Resample/Slice/ZLimits.cpp
+
1
−
13
View file @
a332bede
...
...
@@ -17,21 +17,9 @@
#include
<algorithm>
#include
<cmath>
ZLimits
::
ZLimits
(
double
_min
,
double
_max
)
:
m_zmin
(
_min
)
,
m_zmax
(
_max
)
{
ASSERT
(
_min
<
_max
);
}
ZLimits
::
ZLimits
()
:
ZLimits
(
-
inf
,
inf
)
{
}
bool
ZLimits
::
isFinite
()
const
{
return
!
std
::
isinf
(
m_zmin
)
&&
!
std
::
isinf
(
m_zmax
);
return
!
std
::
isinf
(
zBottom
()
)
&&
!
std
::
isinf
(
zTop
()
);
}
// TODO sep22: rm all the following if they remain UNUSED
...
...
This diff is collapsed.
Click to expand it.
Resample/Slice/ZLimits.h
+
14
−
18
View file @
a332bede
...
...
@@ -20,6 +20,7 @@
#ifndef BORNAGAIN_RESAMPLE_SLICE_ZLIMITS_H
#define BORNAGAIN_RESAMPLE_SLICE_ZLIMITS_H
#include
"Base/Types/Span.h"
#include
<cmath>
#include
<iostream>
#include
<limits>
...
...
@@ -29,31 +30,26 @@
//!
//! @ingroup intern
class
ZLimits
{
class
ZLimits
:
public
Span
{
public:
ZLimits
();
ZLimits
(
double
_min
,
double
_max
);
bool
isFinite
()
const
;
double
zBottom
()
const
{
return
m_zmin
;
}
double
zTop
()
const
{
return
m_zmax
;
}
double
zTopOr0
()
const
{
return
std
::
isfinite
(
m_zmax
)
?
m_zmax
:
0
;
}
double
thicknessOr0
()
const
{
return
isFinite
()
?
m_zmax
-
m_zmin
:
0
;
}
static
constexpr
double
inf
=
std
::
numeric_limits
<
double
>::
infinity
();
bool
contains
(
double
z
)
const
{
return
m_zmin
<=
z
&&
z
<=
m_zmax
;
}
ZLimits
()
:
Span
(
-
inf
,
inf
)
{
}
ZLimits
(
double
_min
,
double
_max
)
:
Span
(
_min
,
_max
)
{
}
std
::
pair
<
double
,
double
>
pair
()
const
{
return
{
m_zmin
,
m_zmax
};
}
bool
isFinite
()
const
;
static
constexpr
double
inf
=
std
::
numeric_limits
<
double
>::
infinity
();
double
zTopOr0
()
const
{
return
std
::
isfinite
(
zTop
())
?
zTop
()
:
0
;
}
double
thicknessOr0
()
const
{
return
isFinite
()
?
zTop
()
-
zBottom
()
:
0
;
}
//! Returns the union of two ZLimits (the minimal interval that contains both input intervals).
static
ZLimits
unite
(
const
ZLimits
&
left
,
const
ZLimits
&
right
);
private
:
// members are not const because we need the implicit copy assignement operator
double
m_zmin
;
double
m_zmax
;
};
bool
operator
==
(
const
ZLimits
&
left
,
const
ZLimits
&
right
);
...
...
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