IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Air Shower Physics
corsika
Commits
6cd70b66
Commit
6cd70b66
authored
2 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
const-correctness of Path
parent
03502fe8
No related branches found
No related tags found
1 merge request
!464
Fix radio test
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
corsika/detail/framework/geometry/Path.inl
+22
-14
22 additions, 14 deletions
corsika/detail/framework/geometry/Path.inl
corsika/framework/geometry/Path.hpp
+14
-6
14 additions, 6 deletions
corsika/framework/geometry/Path.hpp
with
36 additions
and
20 deletions
corsika/detail/framework/geometry/Path.inl
+
22
−
14
View file @
6cd70b66
...
...
@@ -9,7 +9,9 @@
#pragma once
#include
<deque>
#include
<corsika/framework/geometry/Point.hpp>
#include
<corsika/framework/core/PhysicalUnits.hpp>
namespace
corsika
{
...
...
@@ -37,30 +39,36 @@ namespace corsika {
}
inline
void
Path
::
removeFromEnd
()
{
auto
lastpoint_
=
points_
.
back
();
points_
.
pop_back
();
int
dequesize_
=
points_
.
size
();
if
(
dequesize_
==
0
||
dequesize_
==
1
)
{
int
const
dequesize
=
points_
.
size
();
if
(
dequesize
==
0
)
{
length_
=
LengthType
::
zero
();
}
else
if
(
dequesize_
==
2
)
{
length_
=
(
points_
.
back
()
-
points_
.
front
()).
getNorm
();
}
else
{
length_
-=
(
lastpoint_
-
points_
.
back
()).
getNorm
();
return
;
}
if
(
dequesize
==
1
)
{
length_
=
LengthType
::
zero
();
return
;
}
length_
-=
distance
(
points_
.
back
(),
points_
[
dequesize
-
2
]);
points_
.
pop_back
();
}
inline
LengthType
Path
::
getLength
()
const
{
return
length_
;
}
inline
Point
Path
::
getStart
()
const
{
return
points_
.
front
();
}
inline
Point
const
&
Path
::
getStart
()
const
{
return
points_
.
front
();
}
inline
Point
Path
::
getEnd
()
const
{
return
points_
.
back
();
}
inline
Point
const
&
Path
::
getEnd
()
const
{
return
points_
.
back
();
}
inline
Point
Path
::
getPoint
(
std
::
size_t
const
index
)
const
{
return
points_
.
at
(
index
);
}
inline
Point
const
&
Path
::
getPoint
(
std
::
size_t
const
index
)
const
{
return
points_
.
at
(
index
);
}
inline
auto
Path
::
begin
()
{
return
points_
.
begin
();
}
inline
Path
::
iterator
Path
::
begin
()
{
return
points_
.
begin
();
}
inline
Path
::
const_iterator
Path
::
begin
()
const
{
return
points_
.
cbegin
();
}
inline
auto
Path
::
end
()
{
return
points_
.
end
();
}
inline
Path
::
iterator
Path
::
end
()
{
return
points_
.
end
();
}
inline
Path
::
const_iterator
Path
::
end
()
const
{
return
points_
.
cend
();
}
inline
int
Path
::
getNSegments
()
const
{
return
points_
.
size
()
-
1
;
}
}
// namespace corsika
\ No newline at end of file
}
// namespace corsika
This diff is collapsed.
Click to expand it.
corsika/framework/geometry/Path.hpp
+
14
−
6
View file @
6cd70b66
...
...
@@ -9,6 +9,8 @@
#pragma once
#include
<deque>
#include
<corsika/framework/core/PhysicalUnits.hpp>
#include
<corsika/framework/geometry/Point.hpp>
namespace
corsika
{
...
...
@@ -20,6 +22,10 @@ namespace corsika {
class
Path
{
std
::
deque
<
Point
>
points_
;
///< The points that make up this path.
LengthType
length_
=
LengthType
::
zero
();
///< The length of the path.
using
iterator
=
std
::
deque
<
Point
>::
iterator
;
using
const_iterator
=
std
::
deque
<
Point
>::
const_iterator
;
public:
/**
* Create a Path with a given starting Point.
...
...
@@ -49,27 +55,29 @@ namespace corsika {
/**
* Get the starting point of the path.
*/
inline
Point
getStart
()
const
;
inline
Point
const
&
getStart
()
const
;
/**
* Get the end point of the path.
*/
inline
Point
getEnd
()
const
;
inline
Point
const
&
getEnd
()
const
;
/**
* Get a specific point of the path.
*/
inline
Point
getPoint
(
std
::
size_t
const
index
)
const
;
inline
Point
const
&
getPoint
(
std
::
size_t
index
)
const
;
/**
* Return an iterator to the start of the Path.
*/
inline
auto
begin
();
inline
const_iterator
begin
()
const
;
inline
iterator
begin
();
/**
* Return an iterator to the end of the Path.
*/
inline
auto
end
();
inline
const_iterator
end
()
const
;
inline
iterator
end
();
/**
* Get the number of steps in the path.
...
...
@@ -82,4 +90,4 @@ namespace corsika {
}
// namespace corsika
#include
<corsika/detail/framework/geometry/Path.inl>
\ No newline at end of file
#include
<corsika/detail/framework/geometry/Path.inl>
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