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
4cccc878
Commit
4cccc878
authored
6 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
added environment tree
parent
a520a1b5
No related branches found
No related tags found
1 merge request
!9
Resolve "Implement simple "homogenous" atmosphere model."
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Environment/BaseEnvironment.h
+57
-0
57 additions, 0 deletions
Environment/BaseEnvironment.h
with
57 additions
and
0 deletions
Environment/BaseEnvironment.h
0 → 100644
+
57
−
0
View file @
4cccc878
#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
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