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
1d992916
Commit
1d992916
authored
3 years ago
by
Maximilian Reininghaus
Committed by
Maximilian Reininghaus
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
setup::Stack with environment-type template
parent
340f0a1a
No related branches found
No related tags found
1 merge request
!429
Resolve "SetupStack.hpp depends on SetupEnvironment.hpp"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
corsika/detail/setup/SetupStack.hpp
+70
-55
70 additions, 55 deletions
corsika/detail/setup/SetupStack.hpp
corsika/setup/SetupStack.hpp
+6
-3
6 additions, 3 deletions
corsika/setup/SetupStack.hpp
examples/em_shower.cpp
+1
-1
1 addition, 1 deletion
examples/em_shower.cpp
with
77 additions
and
59 deletions
corsika/detail/setup/SetupStack.hpp
+
70
−
55
View file @
1d992916
...
@@ -20,61 +20,76 @@
...
@@ -20,61 +20,76 @@
namespace
corsika
{
namespace
corsika
{
namespace
setup
::
detail
{
namespace
setup
::
detail
{
template
<
typename
TEnvironment
=
setup
::
Environment
>
// ------------------------------------------
class
StackGenerator
{
// add geometry node data to stack. This is fundamentally needed
private:
// for robust tracking through multiple volumes.
using
env_type
=
TEnvironment
;
// the GeometryNode stack needs to know the type of geometry-nodes from the
// ------------------------------------------
// environment:
// add geometry node data to stack. This is fundamentally needed
template
<
typename
TStackIter
>
// for robust tracking through multiple volumes.
using
SetupGeometryDataInterface
=
typename
node
::
MakeGeometryDataInterface
<
TStackIter
,
setup
::
Environment
>::
type
;
// the GeometryNode stack needs to know the type of geometry-nodes from the
// environment:
// combine particle data stack with geometry information for tracking
template
<
typename
TStackIter
>
template
<
typename
TStackIter
>
using
StackWithGeometryInterface
=
using
SetupGeometryDataInterface
=
CombinedParticleInterface
<
VectorStack
::
pi_type
,
SetupGeometryDataInterface
,
typename
node
::
MakeGeometryDataInterface
<
TStackIter
,
env_type
>::
type
;
TStackIter
>
;
// combine particle data stack with geometry information for tracking
using
StackWithGeometry
=
template
<
typename
TStackIter
>
CombinedStack
<
typename
VectorStack
::
stack_data_type
,
using
StackWithGeometryInterface
=
node
::
GeometryData
<
setup
::
Environment
>
,
StackWithGeometryInterface
,
CombinedParticleInterface
<
VectorStack
::
pi_type
,
SetupGeometryDataInterface
,
DefaultSecondaryProducer
>
;
TStackIter
>
;
// ------------------------------------------
using
StackWithGeometry
=
// add weight data to stack. This is fundamentally needed
CombinedStack
<
typename
VectorStack
::
stack_data_type
,
// for thinning.
node
::
GeometryData
<
env_type
>
,
StackWithGeometryInterface
,
DefaultSecondaryProducer
>
;
// the "pure" weight stack (interface)
template
<
typename
TStackIter
>
template
<
class
T
>
using
SetupWeightDataInterface
=
using
StackWithGeometry_PI_type
=
typename
StackWithGeometry
::
template
pi_type
<
T
>;
typename
weights
::
MakeWeightDataInterface
<
TStackIter
>::
type
;
// ------------------------------------------
// combine geometry-node-vector data stack with weight information for tracking
// add weight data to stack. This is fundamentally needed
template
<
typename
TStackIter
>
// for thinning.
using
StackWithWeightInterface
=
CombinedParticleInterface
<
StackWithGeometry
::
pi_type
,
SetupWeightDataInterface
,
// the "pure" weight stack (interface)
TStackIter
>
;
template
<
typename
TStackIter
>
using
SetupWeightDataInterface
=
// the combined stack data: particle + geometry + weight
typename
weights
::
MakeWeightDataInterface
<
TStackIter
>::
type
;
using
StackWithWeight
=
CombinedStack
<
typename
StackWithGeometry
::
stack_data_type
,
weights
::
WeightData
,
// combine geometry-node-vector data stack with weight information for tracking
StackWithWeightInterface
,
DefaultSecondaryProducer
>
;
template
<
typename
TStackIter
>
using
StackWithWeightInterface
=
// ------------------------------------------
CombinedParticleInterface
<
StackWithGeometry_PI_type
,
SetupWeightDataInterface
,
// Add [OPTIONAL] history data to stack, too.
TStackIter
>
;
// This keeps the entire lineage of particles in memory.
public:
template
<
typename
TStackIter
>
// the combined stack data: particle + geometry + weight
using
StackWithHistoryInterface
=
using
StackWithWeight
=
CombinedParticleInterface
<
StackWithWeight
::
pi_type
,
CombinedStack
<
typename
StackWithGeometry
::
stack_data_type
,
weights
::
WeightData
,
history
::
HistoryEventDataInterface
,
TStackIter
>
;
StackWithWeightInterface
,
DefaultSecondaryProducer
>
;
using
StackWithHistory
=
private:
CombinedStack
<
typename
StackWithWeight
::
stack_data_type
,
template
<
typename
T
>
history
::
HistoryEventData
,
StackWithHistoryInterface
,
using
StackWithWeight_PI_type
=
typename
StackWithWeight
::
template
pi_type
<
T
>;
history
::
HistorySecondaryProducer
>
;
// ------------------------------------------
// Add [OPTIONAL] history data to stack, too.
// This keeps the entire lineage of particles in memory.
template
<
typename
TStackIter
>
using
StackWithHistoryInterface
=
CombinedParticleInterface
<
StackWithWeight_PI_type
,
history
::
HistoryEventDataInterface
,
TStackIter
>
;
public:
using
StackWithHistory
=
CombinedStack
<
typename
StackWithWeight
::
stack_data_type
,
history
::
HistoryEventData
,
StackWithHistoryInterface
,
history
::
HistorySecondaryProducer
>
;
};
}
// namespace setup::detail
}
// namespace setup::detail
...
...
This diff is collapsed.
Click to expand it.
corsika/setup/SetupStack.hpp
+
6
−
3
View file @
1d992916
...
@@ -24,18 +24,21 @@ namespace corsika::setup {
...
@@ -24,18 +24,21 @@ namespace corsika::setup {
/*
/*
* the version with history
* the version with history
*/
*/
using
Stack
=
detail
::
StackWithHistory
;
template
<
typename
TEnvironment
>
using
Stack
=
typename
detail
::
StackGenerator
<
TEnvironment
>::
StackWithWeight
;
#else // WITH_HISTORY
#else // WITH_HISTORY
/*
/*
* the version without history (and geometry data and weights)
* the version without history (and geometry data and weights)
*/
*/
using
Stack
=
detail
::
StackWithWeight
;
template
<
typename
TEnvironment
>
using
Stack
=
typename
detail
::
StackGenerator
<
TEnvironment
>::
StackWithWeight
;
#endif
#endif
// the correct secondary stack view
// the correct secondary stack view
using
StackView
=
typename
Stack
::
stack_view_type
;
template
<
typename
TEnvironment
>
using
StackView
=
typename
Stack
<
TEnvironment
>::
stack_view_type
;
}
// namespace corsika::setup
}
// namespace corsika::setup
This diff is collapsed.
Click to expand it.
examples/em_shower.cpp
+
1
−
1
View file @
1d992916
...
@@ -110,7 +110,7 @@ int main(int argc, char** argv) {
...
@@ -110,7 +110,7 @@ int main(int argc, char** argv) {
set_energy_production_threshold
(
pcode
,
energy
);
set_energy_production_threshold
(
pcode
,
energy
);
// setup particle stack, and add primary particle
// setup particle stack, and add primary particle
setup
::
Stack
stack
;
setup
::
Stack
<
EnvType
>
stack
;
stack
.
clear
();
stack
.
clear
();
const
Code
beamCode
=
Code
::
Electron
;
const
Code
beamCode
=
Code
::
Electron
;
auto
const
mass
=
get_mass
(
beamCode
);
auto
const
mass
=
get_mass
(
beamCode
);
...
...
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