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
Merge requests
!9
Resolve "Implement simple "homogenous" atmosphere model."
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Implement simple "homogenous" atmosphere model."
41-implement-simple-homogenous-atmosphere-model
into
master
Overview
3
Commits
14
Pipelines
0
Changes
1
Merged
Maximilian Reininghaus
requested to merge
41-implement-simple-homogenous-atmosphere-model
into
master
6 years ago
Overview
3
Commits
14
Pipelines
0
Changes
1
Expand
Closes
#41 (closed)
Edited
6 years ago
by
Maximilian Reininghaus
0
0
Merge request reports
Viewing commit
4cccc878
Prev
Next
Show latest version
1 file
+
57
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
4cccc878
added environment tree
· 4cccc878
Maximilian Reininghaus
authored
6 years ago
Environment/BaseEnvironment.h
0 → 100644
+
57
−
0
Options
#ifndef _include_EnvironmentBase_h
#define _include_EnvironmentBase_h
#include
<vector>
#include
<memory>
#include
<algorithm>
#include
<corsika/geometry/Sphere.h>
#include
<corsika/geometry/Point.h>
namespace
corsika
::
environment
{
class
BaseEnvironment
{
std
::
vector
<
std
::
unique_ptr
<
BaseEnvironment
>>
childNodes
,
excludedOverlapNodes
;
corsika
::
geometry
::
Sphere
shape
;
public:
bool
ShapeContains
(
corsika
::
geometry
::
Point
const
&
p
)
const
{
return
shape
.
Contains
(
p
);
}
BaseEnvironment
*
GetContainingNode
(
corsika
::
geometry
::
Point
const
&
p
)
const
{
if
(
!
shape
.
Contains
(
p
))
{
return
nullptr
;
}
auto
const
predicate
=
[
&
]
(
auto
const
&
s
)
{
return
bool
(
s
->
GetContainingNode
(
p
));};
auto
const
childFountIt
=
std
::
find_if
(
childNodes
.
cbegin
(),
childNodes
.
cend
(),
predicate
);
if
(
childFoundIt
==
childNodes
.
cend
())
{
if
(
auto
const
excludedIt
=
std
::
find_if
(
excludedOverlapNodes
.
cbegin
(),
excludedOverlapNodes
.
cend
(),
predicate
);
excluded
==
excludedOverlapNodes
.
cend
())
{
return
*
this
;
}
else
{
return
excludedIt
;
}
}
return
(
*
childFoundIt
)
->
GetContainingNode
(
p
);
}
/**
* Get mass density at given point \a p. It is the caller's responsibility
* to call this method from the appropriate node in whose domain \a p is located.
*/
virtual
MassDensityType
GetDensity
(
corsika
::
geometry
::
Point
const
&
p
)
=
0
;
virtual
std
::
pair
<
corsika
::
particles
::
Code
const
*
,
corsika
::
particles
::
Code
const
*>
GetTargetComposition
(
Point
const
&
p
)
};
}
#endif
Loading