With this PR, the concept of computation setups is introduced, and general as well as functionality related to scattering processes is implemented.
Description of the problem
One of the main tasks of this package is the computation of quantities like differential and total cross-section for given scattering processes and a given set of parameters. Usually, these quantities depend on a fixed set of initial parameters, and their value needs to be calculated for large amounts of input data. For example, the differential cross-section of a process depends on the generic scattering process, the compute model, and all sorts of initial parameters, which might be physical (e.g. energy scales) or technical (e.g. integrator settings). Once initialized, the differential cross-section is still a function of the external momenta of a scattering process. Therefore, for a given set of input data, i.e. momenta, one needs to be able to compute the respective value of the differential cross-section using the given setting.
Suggested solution
The initial parameters for a given quantity will be collected in a setup, which, once initialized, describes the initialized quantity, i.e. the quantity with fixed initial parameters. The actual computation can be performed by calling a member function compute on the setup object and the respective input arguments. The implementation described below defines an interface, that unifies this approach and extends the computation workflow by adding input verification and post-processing steps.
Implementation details
The root type for all setups is AbstractSetup, for which the following interface functions are defined:
None of those functions is exported, but they need to be added for a concrete implementation of AbstractSetup. For all functions, except _compute, a generic fallback is implemented, which uses a default implementation for the respective function. Based on the interface functions, the actual compute function is implemented as
compute(stp::AbstractSetup, input::Any)
where internally, the following steps are performed:
input validation by calling _input_validation
actual computation by calling _compute
post-processing by calling _post_computation
Additionally, based on AbstractSetup, a specialized version of setups related to the combination of scattering processes and compute models is implemented: AbstractProcessSetup<:AbstractSetup, where the following functions are added to the setup interface:
The possibilities for functionality based on the setup definition above are not exhausted by the set of interface functions defined with this PR. For example, the pre-and post-processing could be enhanced by more fine granular structures. Furthermore, the initialization step of a setup could have its input validation. This is currently delegated to the users, who implement a setup by themself. Finally, the set of functions defined on AbstractProcessSetup and delegated to the process and model, could be extended if necessary. However, all the points above should be considered only if they are necessary, which implies opening dedicated issues if any.
With this PR, the concept of computation setups is introduced, and general as well as functionality related to scattering processes is implemented.
Description of the problem
One of the main tasks of this package is the computation of quantities like differential and total cross-section for given scattering processes and a given set of parameters. Usually, these quantities depend on a fixed set of initial parameters, and their value needs to be calculated for large amounts of input data. For example, the differential cross-section of a process depends on the generic scattering process, the compute model, and all sorts of initial parameters, which might be physical (e.g. energy scales) or technical (e.g. integrator settings). Once initialized, the differential cross-section is still a function of the external momenta of a scattering process. Therefore, for a given set of input data, i.e. momenta, one needs to be able to compute the respective value of the differential cross-section using the given setting.
Suggested solution
The initial parameters for a given quantity will be collected in a setup, which, once initialized, describes the initialized quantity, i.e. the quantity with fixed initial parameters. The actual computation can be performed by calling a member function
compute
on the setup object and the respective input arguments. The implementation described below defines an interface, that unifies this approach and extends the computation workflow by adding input verification and post-processing steps.Implementation details
The root type for all setups is
AbstractSetup
, for which the following interface functions are defined:None of those functions is exported, but they need to be added for a concrete implementation of
AbstractSetup
. For all functions, except_compute
, a generic fallback is implemented, which uses a default implementation for the respective function. Based on the interface functions, the actual compute function is implemented aswhere internally, the following steps are performed:
_input_validation
_compute
_post_computation
Additionally, based on
AbstractSetup
, a specialized version of setups related to the combination of scattering processes and compute models is implemented:AbstractProcessSetup<:AbstractSetup
, where the following functions are added to the setup interface:Based on them, the following functions are delegated to the respective type parameter:
Final remarks
The possibilities for functionality based on the setup definition above are not exhausted by the set of interface functions defined with this PR. For example, the pre-and post-processing could be enhanced by more fine granular structures. Furthermore, the initialization step of a setup could have its input validation. This is currently delegated to the users, who implement a setup by themself. Finally, the set of functions defined on
AbstractProcessSetup
and delegated to the process and model, could be extended if necessary. However, all the points above should be considered only if they are necessary, which implies opening dedicated issues if any.