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
e84d7225
Commit
e84d7225
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
IAxis + sanity checks
parent
2d0320f2
No related branches found
No related tags found
1 merge request
!1621
Scale (IAxis) now without children
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Base/Axis/DiscreteAxis.cpp
+0
-20
0 additions, 20 deletions
Base/Axis/DiscreteAxis.cpp
Base/Axis/DiscreteAxis.h
+0
-1
0 additions, 1 deletion
Base/Axis/DiscreteAxis.h
Base/Axis/IAxis.cpp
+5
-1
5 additions, 1 deletion
Base/Axis/IAxis.cpp
with
5 additions
and
22 deletions
Base/Axis/DiscreteAxis.cpp
+
0
−
20
View file @
e84d7225
...
...
@@ -39,7 +39,6 @@ DiscreteAxis::DiscreteAxis(const std::string& name, const std::vector<double>& p
{
ASSERT
(
size
()
==
points
.
size
());
ASSERT
(
size
()
==
m_coordinates
.
size
());
sanityCheck
();
}
DiscreteAxis
::
DiscreteAxis
(
const
std
::
string
&
name
,
size_t
n
,
double
first
,
double
last
)
...
...
@@ -57,25 +56,6 @@ void DiscreteAxis::checkIndex(size_t index) const
throw
std
::
runtime_error
(
message
);
}
void
DiscreteAxis
::
sanityCheck
()
const
{
if
(
m_coordinates
.
size
()
<
1
)
throw
std
::
runtime_error
(
"Error in DiscreteAxis::DiscreteAxis: the size of passed coordinate array is "
"less than minimum acceptable value"
);
const
auto
begin
=
m_coordinates
.
begin
();
const
auto
end
=
m_coordinates
.
end
();
if
(
!
std
::
is_sorted
(
begin
,
end
))
throw
std
::
runtime_error
(
"Error in DiscreteAxis::DiscreteAxis: passed coordinates are "
"not sorted in ascending order"
);
if
(
std
::
adjacent_find
(
begin
,
end
)
!=
end
)
throw
std
::
runtime_error
(
"Error in DiscreteAxis::DiscreteAxis: passed coordinate vector "
"contains repeating values"
);
}
IAxis
*
newDiscreteAxis
(
const
std
::
string
&
name
,
const
std
::
vector
<
double
>&
points
)
{
return
new
IAxis
(
name
,
centers2bins
(
points
));
...
...
This diff is collapsed.
Click to expand it.
Base/Axis/DiscreteAxis.h
+
0
−
1
View file @
e84d7225
...
...
@@ -26,7 +26,6 @@ public:
private:
void
checkIndex
(
size_t
index
)
const
;
void
sanityCheck
()
const
;
std
::
vector
<
double
>
m_coordinates
;
};
...
...
This diff is collapsed.
Click to expand it.
Base/Axis/IAxis.cpp
+
5
−
1
View file @
e84d7225
...
...
@@ -13,7 +13,6 @@
// ************************************************************************************************
#include
"Base/Axis/IAxis.h"
#include
"Base/Util/Algorithms.h"
#include
"Base/Util/Assert.h"
#include
<iomanip>
...
...
@@ -21,6 +20,11 @@ IAxis::IAxis(std::string name, const std::vector<Bin1D>& bins)
:
m_name
(
name
)
,
m_bins
(
bins
)
{
ASSERT
(
size
()
>
0
);
for
(
size_t
i
=
0
;
i
<
size
()
-
1
;
++
i
)
{
ASSERT
(
bin
(
i
).
upperBound
()
<=
bin
(
i
+
1
).
lowerBound
());
// bins must not overlap
ASSERT
(
bin
(
i
)
!=
bin
(
i
+
1
));
// no duplicate bins
}
}
size_t
IAxis
::
size
()
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