IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Pranav Sampathkumar
corsika
Commits
7e5bc6f2
Commit
7e5bc6f2
authored
5 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
fixed handling of SwitchProcess inside ProcessSequence
parent
d83a2fd8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/ProcessSequence/ProcessSequence.h
+17
-6
17 additions, 6 deletions
Framework/ProcessSequence/ProcessSequence.h
Processes/SwitchProcess/SwitchProcess.h
+2
-2
2 additions, 2 deletions
Processes/SwitchProcess/SwitchProcess.h
with
19 additions
and
8 deletions
Framework/ProcessSequence/ProcessSequence.h
+
17
−
6
View file @
7e5bc6f2
...
...
@@ -57,9 +57,15 @@ namespace corsika::process {
class
SwitchProcess
;
// fwd-decl.
}
// to detect SwitchProcesses inside the ProcessSequence
template
<
typename
T
>
struct
is_switch_process
:
std
::
false_type
{};
template
<
typename
A
,
typename
B
>
struct
is_process_sequence
<
switch_process
::
SwitchProcess
<
A
,
B
>>
:
std
::
true_type
{};
struct
is_switch_process
<
switch_process
::
SwitchProcess
<
A
,
B
>>
:
std
::
true_type
{};
template
<
typename
T
>
bool
constexpr
is_switch_process_v
=
is_switch_process
<
T
>::
value
;
/**
T1 and T2 are both references if possible (lvalue), otherwise
...
...
@@ -75,6 +81,9 @@ namespace corsika::process {
static
bool
constexpr
t1ProcSeq
=
is_process_sequence_v
<
T1type
>
;
static
bool
constexpr
t2ProcSeq
=
is_process_sequence_v
<
T2type
>
;
static
bool
constexpr
t1SwitchProc
=
is_switch_process_v
<
T1type
>
;
static
bool
constexpr
t2SwitchProc
=
is_switch_process_v
<
T2type
>
;
public:
T1
A
;
// this is a reference, if possible
T2
B
;
// this is a reference, if possible
...
...
@@ -185,10 +194,12 @@ namespace corsika::process {
InverseGrammageType
tot
=
0
*
meter
*
meter
/
gram
;
if
constexpr
(
std
::
is_base_of_v
<
InteractionProcess
<
T1type
>
,
T1type
>
||
t1ProcSeq
)
{
if
constexpr
(
std
::
is_base_of_v
<
InteractionProcess
<
T1type
>
,
T1type
>
||
t1ProcSeq
||
t1SwitchProc
)
{
tot
+=
A
.
GetInverseInteractionLength
(
vP
);
}
if
constexpr
(
std
::
is_base_of_v
<
InteractionProcess
<
T2type
>
,
T2type
>
||
t2ProcSeq
)
{
if
constexpr
(
std
::
is_base_of_v
<
InteractionProcess
<
T2type
>
,
T2type
>
||
t2ProcSeq
||
t2SwitchProc
)
{
tot
+=
B
.
GetInverseInteractionLength
(
vP
);
}
return
tot
;
...
...
@@ -200,7 +211,7 @@ namespace corsika::process {
[[
maybe_unused
]]
corsika
::
units
::
si
::
InverseGrammageType
lambda_select
,
corsika
::
units
::
si
::
InverseGrammageType
&
lambda_inv_count
)
{
if
constexpr
(
t1ProcSeq
)
{
if
constexpr
(
t1ProcSeq
||
t1SwitchProc
)
{
// if A is a process sequence --> check inside
const
EProcessReturn
ret
=
A
.
SelectInteraction
(
vP
,
vS
,
lambda_select
,
lambda_inv_count
);
...
...
@@ -216,7 +227,7 @@ namespace corsika::process {
}
}
// end branch A
if
constexpr
(
t2ProcSeq
)
{
if
constexpr
(
t2ProcSeq
||
t2SwitchProc
)
{
// if A is a process sequence --> check inside
const
EProcessReturn
ret
=
B
.
SelectInteraction
(
vP
,
vS
,
lambda_select
,
lambda_inv_count
);
...
...
This diff is collapsed.
Click to expand it.
Processes/SwitchProcess/SwitchProcess.h
+
2
−
2
View file @
7e5bc6f2
...
...
@@ -12,8 +12,8 @@ namespace corsika::process::switch_process {
* This process provides an energy-based switch between two interaction processes P1 and
* P1. For energies below the threshold, P1 is invoked, otherwise P2. Both can be either
* single interaction processes or multiple ones combined in a ProcessSequence. A
* SwitchProcess itself will always be regarded as a
ProcessSequence rather than
a
n
*
InteractionProcess when assembled into a
greater ProcessSequence.
* SwitchProcess itself will always be regarded as a
distinct case when assembled into
a
*
(
greater
)
ProcessSequence.
*/
template
<
class
TLowEProcess
,
class
THighEProcess
>
...
...
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