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
eaa5461b
Commit
eaa5461b
authored
5 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
implemented SwitchProcess
parent
85605a85
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Processes/CMakeLists.txt
+1
-0
1 addition, 0 deletions
Processes/CMakeLists.txt
Processes/SwitchProcess/CMakeLists.txt
+48
-0
48 additions, 0 deletions
Processes/SwitchProcess/CMakeLists.txt
Processes/SwitchProcess/SwitchProcess.h
+85
-0
85 additions, 0 deletions
Processes/SwitchProcess/SwitchProcess.h
with
134 additions
and
0 deletions
Processes/CMakeLists.txt
+
1
−
0
View file @
eaa5461b
...
...
@@ -10,6 +10,7 @@ add_subdirectory (TrackingLine)
add_subdirectory
(
HadronicElasticModel
)
add_subdirectory
(
EnergyLoss
)
add_subdirectory
(
UrQMD
)
add_subdirectory
(
SwitchProcess
)
#add_custom_target(CORSIKAprocesses)
add_library
(
CORSIKAprocesses INTERFACE
)
...
...
This diff is collapsed.
Click to expand it.
Processes/SwitchProcess/CMakeLists.txt
0 → 100644
+
48
−
0
View file @
eaa5461b
set
(
MODEL_HEADERS
SwitchProcess.h
)
set
(
MODEL_NAMESPACE
corsika/process/switch_process
)
add_library
(
ProcessSwitch INTERFACE
)
CORSIKA_COPY_HEADERS_TO_NAMESPACE
(
ProcessSwitch
${
MODEL_NAMESPACE
}
${
MODEL_HEADERS
}
)
set_target_properties
(
ProcessStackInspector
PROPERTIES
VERSION
${
PROJECT_VERSION
}
SOVERSION 1
# PUBLIC_HEADER "${MODEL_HEADERS}"
)
# target dependencies on other libraries (also the header onlys)
target_link_libraries
(
ProcessSwitch
INTERFACE
CORSIKAunits
CORSIKAprocesssequence
)
target_include_directories
(
ProcessSwitch
INTERFACE
$<BUILD_INTERFACE:
${
PROJECT_BINARY_DIR
}
/include>
$<INSTALL_INTERFACE:include/include>
)
install
(
FILES
${
MODEL_HEADERS
}
DESTINATION include/
${
MODEL_NAMESPACE
}
)
# --------------------
# code unit testing
#add_executable (testStackInspector testSwitchProcess.cc)
#target_link_libraries (
# testSwitchProcess
# ProcessSwitch
# CORSIKAthirdparty # for catch2
# )
#CORSIKA_ADD_TEST(testStackInspector)
This diff is collapsed.
Click to expand it.
Processes/SwitchProcess/SwitchProcess.h
0 → 100644
+
85
−
0
View file @
eaa5461b
#ifndef _corsika_SwitchProcess_h
#define _corsika_SwitchProcess_h
#include
<corsika/process/InteractionProcess.h>
#include
<corsika/process/ProcessSequence.h>
#include
<corsika/setup/SetupStack.h>
#include
<corsika/units/PhysicalUnits.h>
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 an
* InteractionProcess when assembled into a greater ProcessSequence.
*/
template
<
class
TLowEProcess
,
class
THighEProcess
>
class
SwitchProcess
:
public
InteractionProcess
<
SwitchProcess
<
TLowEProcess
,
THighEProcess
>>
{
TLowEProcess
&
fLowEProcess
;
THighEProcess
&
fHighEProcess
;
units
::
si
::
HEPEnergyType
const
fThresholdEnergy
;
public:
SwitchProcess
(
TLowEProcess
&
vLowEProcess
,
THighEProcess
&
vHighEProcess
,
units
::
si
::
HEPEnergyType
vThresholdEnergy
)
:
fLowEProcess
(
vLowEProcess
)
,
fHighEProcess
(
vHighEProcess
)
,
fThresholdEnergy
(
vThresholdEnergy
)
{}
void
Init
()
{
fLowEProcess
.
Init
();
fHighEProcess
.
Init
();
}
template
<
typename
TParticle
>
units
::
si
::
GrammageType
GetInteractionLength
(
TParticle
&
vParticle
)
{
if
(
vParticle
.
GetEnergy
()
<
fThresholdEnergy
)
{
if
constexpr
(
is_process_sequence_v
<
TLowEProcess
>
)
{
return
fLowEProcess
.
GetTotalInteractionLength
(
vParticle
);
}
else
{
return
fLowEProcess
.
GetInteractionLength
(
vParticle
);
}
}
else
{
if
constexpr
(
is_process_sequence_v
<
THighEProcess
>
)
{
return
fHighEProcess
.
GetTotalInteractionLength
(
vParticle
);
}
else
{
return
fHighEProcess
.
GetInteractionLength
(
vParticle
);
}
}
}
// required to conform to ProcessSequence interface. We cannot just
// implement DoInteraction() because we want to call SelectInteraction
// in case a member process is a ProcessSequence.
template
<
typename
TParticle
,
typename
TSecondaries
>
EProcessReturn
SelectInteraction
(
TParticle
&
vP
,
TSecondaries
&
vS
,
[[
maybe_unused
]]
corsika
::
units
::
si
::
InverseGrammageType
lambda_select
,
corsika
::
units
::
si
::
InverseGrammageType
&
lambda_inv_count
)
{
if
(
vP
.
GetEnergy
()
<
fThresholdEnergy
)
{
if
constexpr
(
is_process_sequence_v
<
TLowEProcess
>
)
{
return
fLowEProcess
.
SelectInteraction
(
vP
,
vS
,
lambda_select
,
lambda_inv_count
);
}
else
{
return
fLowEProcess
.
DoInteraction
(
vS
);
}
}
else
{
if
constexpr
(
is_process_sequence_v
<
THighEProcess
>
)
{
return
fHighEProcess
.
SelectInteraction
(
vP
,
vS
,
lambda_select
,
lambda_inv_count
);
}
else
{
return
fHighEProcess
.
DoInteraction
(
vS
);
}
}
}
};
}
// namespace corsika::process::switch_process
template
<
typename
A
,
typename
B
>
struct
corsika
::
process
::
is_process_sequence
<
corsika
::
process
::
switch_process
::
SwitchProcess
<
A
,
B
>>
:
std
::
true_type
{};
#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